Résolu Compatibilité serveur
-
nouvelle question, ça concerne pas vraiment le titre mais bon, pour éviter de faire 50 sujets, est-ce normal que je ne trouve pas les escaliers dans la texture de minecraft ?
et la fonction suivant : public static void addSmeltingRecipe() {
GameRegistry.addSmelting(Blocks.obsidian, new ItemStack(obsiingot, 1), 20.0f);
}et sensé faire fondre un blocks d’obsi pour donner un obsiingot non ???
car j’aimerais faire des escaliers en obsidienne avec cela.
et également rien à voir mais comment gérer la distance de la flèche avec les différents temps de chargement ? car c’est genre trop loin ^^
-
Pour les escaliers Minecraft utilise la même texture que les blocs, c’est pour ça que tu ne trouve pas la texture.
Pour ta fonction gameregistry, mets là dans la classe principale ou vérifies que ta fonction addSmeltingRecipe est bien appelé dans la classe principale.Et pour la flèche, je ne peux pas regarder maintenant je suis sur mon portable.
-
Si tu parles de la flèche de chargement pour le four, tu ne peux pas la changer, certains avaient déjà proposé des commits pour changer çà mais çà n’a jamais été accepté.
EDIT : regarde peut être avec un tick event pour changer si c’est ton item à l’intérieur la vitesse.
-
non je parlais de la flèche d’un arc, il est vrai que j’étais pas clair ensuite j’ai réussi à résoudre le problème du four mais tu dis que c’est la même texture pour l’escalier que celui du bloc, mais comment on peut voir l’escalier alors si ça ressemble à un bloc ?
-
L’escalier utilise un model, comme la barrière et les fence gate auquel tu appliques la texture du block. J’ai pas compris ton histoire de flèche par contre.
-
bah sur les arcs, quand je charge a peine ma flèche, elle part a l’autre bout du monde
-
avec le code ce serait mieux
-
package fr.craftesys.items.common; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; public class BowItem extends ItemBow { private IIcon[] iconbuffer; private static String[] rubisbow = new String[] {"_pull_0", "_pull_1", "_pull_2"}; public BowItem() { super(); this.maxStackSize = 1; this.setMaxDamage(1000); } @Override public void registerIcons(IIconRegister iconregister) { iconbuffer = new IIcon[rubisbow.length]; itemIcon = iconregister.registerIcon(this.getIconString()); for(int i = 0; i < rubisbow.length; i++) { iconbuffer* = iconregister.registerIcon(this.getIconString() + rubisbow*); } } @Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem().equals(ModItems.rubisbow)) { int k = usingItem.getMaxItemUseDuration() - useRemaining; if(k >= 18) return iconbuffer[2]; if(k > 13) return iconbuffer[1]; if(k > 0) return iconbuffer[0]; } return getIconIndex(stack); } @Override public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) { int charge = this.getMaxItemUseDuration(stack) - itemInUseCount; ArrowLooseEvent event = new ArrowLooseEvent(player, stack, charge); MinecraftForge.EVENT_BUS.post(event); if(event.isCanceled()) { return; } charge = event.charge; boolean creativeOrInfinity = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; if(creativeOrInfinity || player.inventory.hasItem(Items.arrow)) { float power = 1000000000000000000F; if((double)power < 1.0D) { return; } if(power > 1.0F) { power = 1.0F; } EntityArrow arrow = new EntityArrow(world, player, power * 1.0F); if(power == 1.0F) { arrow.setIsCritical(true); } int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); if(var9 > 0) { arrow.setDamage(arrow.getDamage() + (double)var9 * 0.9D + 0.5D); } int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); if(var10 > 0) { arrow.setKnockbackStrength(var10); } if(EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) { arrow.setFire(100); } stack.damageItem(1, player); world.playSoundAtEntity(player, "random.rubisbow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + power * 0.5F); if(creativeOrInfinity) { arrow.canBePickedUp = 2; } else { player.inventory.consumeInventoryItem(Items.arrow); } if(!world.isRemote) { world.spawnEntityInWorld(arrow); } } } @Override public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { return stack; } @Override public int getMaxItemUseDuration(ItemStack stack) { return 1000; } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.bow; } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow)) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); } return stack; } @Override public int getItemEnchantability() { return 1; } }
-
Apprends à coder avant, je comprends pas l’utilité de faire çà :
float power = 1000000000000000000F; if((double)power < 1.0D) { return; } if(power > 1.0F) { power = 1.0F; }
-
a donner une valeur au power pour faire la suite ?
le probleme en faite, c’est qu’il n’y a pas de différence de portées entre le fait de tendre l’arc ou pas, elle reste a la valeur a laquelle l’arc n’est pas tendu.
et l’histoire de model que prend le bloc pour l’escalier et une texture de bloc, j’ai pas trop compris (j’ai jamais fait de java avant, c’est mon premier mod donc c’est normal que je demande beaucoup de truc ^^ )
-
Un peu normal qu’il n’y a pas de différence entre l’arc chargé ou pas puisque ta valeur power prend toujours la même valeur sans dépendre en compte de la valeur de la variable charge …
-
si je fais ça :
charge = event.charge; boolean creativeOrInfinity = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; if(creativeOrInfinity || player.inventory.hasItem(Items.arrow)) { float power = 1F; if((double)charge < 1.0F) { power = 1.5F; } if(charge > 1.0F) { power = 1.7F; }
je devrais avoir une différence non ?
-
Tu n’appelles jamais la méthode du joueur pour savoir à quel point l’arc est chargé, regarde le code de minecraft.
-
problème réglé ::)
-
Regarde la classe EntityPlayer, il y a des méthodes getItemInUseDuration et getItemInUseCount pour savoir depuis combien de temps ton arc est utilisé.
-
La variable charge gère déjà ça non ?
Faudrait regarder le code de ItemBow -
oui, après avoir regardé attentivement la classe de base j’ai compris, cependant la classe BlockStairs est juste étrange ^^ pourquoi mettre des noms genre p_14416541541_21561_185 je vois pas la simplicité, il code mal celui la
-
çà s’appelle des noms obfusqués, çà sert à rendre le code illisible justement. Il faut regarder le type des paramètres : généralement, lorsqu’un type World est suivit de 3 entiers, ce sont les positions x,y,z.
-
bonjour à tous, voila je vais post la class Blockstairs car je comprend strictement rien, j’aimerais donc savoir ce qu’il faut vraiment, car je pense pas que tout soit nécessaire (de simple escaliers genre obsi).
ou si vous préférez directement ici
package fr.craftesys.items.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; import net.minecraft.block.material.MapColor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class test extends Block { private static final int[][] field_150150_a = new int[][] {{2, 6}, {3, 7}, {2, 3}, {6, 7}, {0, 4}, {1, 5}, {0, 1}, {4, 5}}; private final Block field_150149_b; private final int field_150151_M; private boolean field_150152_N; private int field_150153_O; private static final String __OBFID = "CL_00000314"; protected test(Block p_i45428_1_, int p_i45428_2_) { super(p_i45428_1_.getMaterial()); this.field_150149_b = p_i45428_1_; this.field_150151_M = p_i45428_2_; this.setHardness(p_i45428_1_.getBlockHardness(null, 0, 0, 0)); this.setStepSound(p_i45428_1_.stepSound); this.setLightOpacity(255); this.setCreativeTab(CreativeTabs.tabBlock); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { if (this.field_150152_N) { this.setBlockBounds(0.5F * (float)(this.field_150153_O % 2), 0.5F * (float)(this.field_150153_O / 2 % 2), 0.5F * (float)(this.field_150153_O / 4 % 2), 0.5F + 0.5F * (float)(this.field_150153_O % 2), 0.5F + 0.5F * (float)(this.field_150153_O / 2 % 2), 0.5F + 0.5F * (float)(this.field_150153_O / 4 % 2)); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 10; } public void func_150147_e(IBlockAccess p_150147_1_, int p_150147_2_, int p_150147_3_, int p_150147_4_) { int l = p_150147_1_.getBlockMetadata(p_150147_2_, p_150147_3_, p_150147_4_); if ((l & 4) != 0) { this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); } } public static boolean func_150148_a(Block p_150148_0_) { return p_150148_0_ instanceof BlockStairs; } private boolean func_150146_f(IBlockAccess p_150146_1_, int p_150146_2_, int p_150146_3_, int p_150146_4_, int p_150146_5_) { Block block = p_150146_1_.getBlock(p_150146_2_, p_150146_3_, p_150146_4_); return func_150148_a(block) && p_150146_1_.getBlockMetadata(p_150146_2_, p_150146_3_, p_150146_4_) == p_150146_5_; } public boolean func_150145_f(IBlockAccess p_150145_1_, int p_150145_2_, int p_150145_3_, int p_150145_4_) { int l = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_); int i1 = l & 3; float f = 0.5F; float f1 = 1.0F; if ((l & 4) != 0) { f = 0.0F; f1 = 0.5F; } float f2 = 0.0F; float f3 = 1.0F; float f4 = 0.0F; float f5 = 0.5F; boolean flag = true; Block block; int j1; int k1; if (i1 == 0) { f2 = 0.5F; f5 = 1.0F; block = p_150145_1_.getBlock(p_150145_2_ + 1, p_150145_3_, p_150145_4_); j1 = p_150145_1_.getBlockMetadata(p_150145_2_ + 1, p_150145_3_, p_150145_4_); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 3 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ + 1, l)) { f5 = 0.5F; flag = false; } else if (k1 == 2 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ - 1, l)) { f4 = 0.5F; flag = false; } } } else if (i1 == 1) { f3 = 0.5F; f5 = 1.0F; block = p_150145_1_.getBlock(p_150145_2_ - 1, p_150145_3_, p_150145_4_); j1 = p_150145_1_.getBlockMetadata(p_150145_2_ - 1, p_150145_3_, p_150145_4_); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 3 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ + 1, l)) { f5 = 0.5F; flag = false; } else if (k1 == 2 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ - 1, l)) { f4 = 0.5F; flag = false; } } } else if (i1 == 2) { f4 = 0.5F; f5 = 1.0F; block = p_150145_1_.getBlock(p_150145_2_, p_150145_3_, p_150145_4_ + 1); j1 = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_ + 1); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 1 && !this.func_150146_f(p_150145_1_, p_150145_2_ + 1, p_150145_3_, p_150145_4_, l)) { f3 = 0.5F; flag = false; } else if (k1 == 0 && !this.func_150146_f(p_150145_1_, p_150145_2_ - 1, p_150145_3_, p_150145_4_, l)) { f2 = 0.5F; flag = false; } } } else if (i1 == 3) { block = p_150145_1_.getBlock(p_150145_2_, p_150145_3_, p_150145_4_ - 1); j1 = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_ - 1); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 1 && !this.func_150146_f(p_150145_1_, p_150145_2_ + 1, p_150145_3_, p_150145_4_, l)) { f3 = 0.5F; flag = false; } else if (k1 == 0 && !this.func_150146_f(p_150145_1_, p_150145_2_ - 1, p_150145_3_, p_150145_4_, l)) { f2 = 0.5F; flag = false; } } } this.setBlockBounds(f2, f, f4, f3, f1, f5); return flag; } public boolean func_150144_g(IBlockAccess p_150144_1_, int p_150144_2_, int p_150144_3_, int p_150144_4_) { int l = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_); int i1 = l & 3; float f = 0.5F; float f1 = 1.0F; if ((l & 4) != 0) { f = 0.0F; f1 = 0.5F; } float f2 = 0.0F; float f3 = 0.5F; float f4 = 0.5F; float f5 = 1.0F; boolean flag = false; Block block; int j1; int k1; if (i1 == 0) { block = p_150144_1_.getBlock(p_150144_2_ - 1, p_150144_3_, p_150144_4_); j1 = p_150144_1_.getBlockMetadata(p_150144_2_ - 1, p_150144_3_, p_150144_4_); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 3 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ - 1, l)) { f4 = 0.0F; f5 = 0.5F; flag = true; } else if (k1 == 2 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ + 1, l)) { f4 = 0.5F; f5 = 1.0F; flag = true; } } } else if (i1 == 1) { block = p_150144_1_.getBlock(p_150144_2_ + 1, p_150144_3_, p_150144_4_); j1 = p_150144_1_.getBlockMetadata(p_150144_2_ + 1, p_150144_3_, p_150144_4_); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { f2 = 0.5F; f3 = 1.0F; k1 = j1 & 3; if (k1 == 3 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ - 1, l)) { f4 = 0.0F; f5 = 0.5F; flag = true; } else if (k1 == 2 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ + 1, l)) { f4 = 0.5F; f5 = 1.0F; flag = true; } } } else if (i1 == 2) { block = p_150144_1_.getBlock(p_150144_2_, p_150144_3_, p_150144_4_ - 1); j1 = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_ - 1); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { f4 = 0.0F; f5 = 0.5F; k1 = j1 & 3; if (k1 == 1 && !this.func_150146_f(p_150144_1_, p_150144_2_ - 1, p_150144_3_, p_150144_4_, l)) { flag = true; } else if (k1 == 0 && !this.func_150146_f(p_150144_1_, p_150144_2_ + 1, p_150144_3_, p_150144_4_, l)) { f2 = 0.5F; f3 = 1.0F; flag = true; } } } else if (i1 == 3) { block = p_150144_1_.getBlock(p_150144_2_, p_150144_3_, p_150144_4_ + 1); j1 = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_ + 1); if (func_150148_a(block) && (l & 4) == (j1 & 4)) { k1 = j1 & 3; if (k1 == 1 && !this.func_150146_f(p_150144_1_, p_150144_2_ - 1, p_150144_3_, p_150144_4_, l)) { flag = true; } else if (k1 == 0 && !this.func_150146_f(p_150144_1_, p_150144_2_ + 1, p_150144_3_, p_150144_4_, l)) { f2 = 0.5F; f3 = 1.0F; flag = true; } } } if (flag) { this.setBlockBounds(f2, f, f4, f3, f1, f5); } return flag; } /** * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity */ public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) { this.func_150147_e(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_); super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_); boolean flag = this.func_150145_f(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_); super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_); if (flag && this.func_150144_g(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_)) { super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_); } this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } /** * Called when a player hits the block. Args: world, x, y, z, player */ public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_) { this.field_150149_b.onBlockClicked(p_149699_1_, p_149699_2_, p_149699_3_, p_149699_4_, p_149699_5_); } /** * A randomly called display update to be able to add particles or other items for display */ @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { this.field_150149_b.randomDisplayTick(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_, p_149734_5_); } /** * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData */ public void onBlockDestroyedByPlayer(World p_149664_1_, int p_149664_2_, int p_149664_3_, int p_149664_4_, int p_149664_5_) { this.field_150149_b.onBlockDestroyedByPlayer(p_149664_1_, p_149664_2_, p_149664_3_, p_149664_4_, p_149664_5_); } /** * Returns how much this block can resist explosions from the passed in entity. */ public float getExplosionResistance(Entity p_149638_1_) { return this.field_150149_b.getExplosionResistance(p_149638_1_); } /** * How many world ticks before ticking */ public int tickRate(World p_149738_1_) { return this.field_150149_b.tickRate(p_149738_1_); } /** * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d */ public void velocityToAddToEntity(World p_149640_1_, int p_149640_2_, int p_149640_3_, int p_149640_4_, Entity p_149640_5_, Vec3 p_149640_6_) { this.field_150149_b.velocityToAddToEntity(p_149640_1_, p_149640_2_, p_149640_3_, p_149640_4_, p_149640_5_, p_149640_6_); } /** * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z */ @SideOnly(Side.CLIENT) public int getMixedBrightnessForBlock(IBlockAccess p_149677_1_, int p_149677_2_, int p_149677_3_, int p_149677_4_) { return this.field_150149_b.getMixedBrightnessForBlock(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_); } /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return this.field_150149_b.getRenderBlockPass(); } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return this.field_150149_b.getIcon(p_149691_1_, this.field_150151_M); } /** * Returns the bounding box of the wired rectangular prism to render. */ @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) { return this.field_150149_b.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); } /** * Returns if this block is collidable (only used by Fire). Args: x, y, z */ public boolean isCollidable() { return this.field_150149_b.isCollidable(); } /** * Returns whether this block is collideable based on the arguments passed in * @param par1 block metaData * @param par2 whether the player right-clicked while holding a boat */ public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) { return this.field_150149_b.canCollideCheck(p_149678_1_, p_149678_2_); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return this.field_150149_b.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { this.onNeighborBlockChange(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, Blocks.air); this.field_150149_b.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); } public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { this.field_150149_b.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } /** * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity */ public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity p_149724_5_) { this.field_150149_b.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_); } /** * Ticks the block if it's been scheduled */ public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { this.field_150149_b.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_); } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { return this.field_150149_b.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, 0, 0.0F, 0.0F, 0.0F); } /** * Called upon the block being destroyed by an explosion */ public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_) { this.field_150149_b.onBlockDestroyedByExplosion(p_149723_1_, p_149723_2_, p_149723_3_, p_149723_4_, p_149723_5_); } public MapColor getMapColor(int p_149728_1_) { return this.field_150149_b.getMapColor(this.field_150151_M); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int i1 = p_149689_1_.getBlockMetadata(p_149689_2_, p_149689_3_, p_149689_4_) & 4; if (l == 0) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2 | i1, 2); } if (l == 1) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 1 | i1, 2); } if (l == 2) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3 | i1, 2); } if (l == 3) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 0 | i1, 2); } } /** * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata */ public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { return p_149660_5_ != 0 && (p_149660_5_ == 1 || (double)p_149660_7_ <= 0.5D) ? p_149660_9_ : p_149660_9_ | 4; } /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, * x, y, z, startVec, endVec */ public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_) { MovingObjectPosition[] amovingobjectposition = new MovingObjectPosition[8]; int l = p_149731_1_.getBlockMetadata(p_149731_2_, p_149731_3_, p_149731_4_); int i1 = l & 3; boolean flag = (l & 4) == 4; int[] aint = field_150150_a[i1 + (flag?4:0)]; this.field_150152_N = true; int k1; int l1; int i2; for (int j1 = 0; j1 < 8; ++j1) { this.field_150153_O = j1; int[] aint1 = aint; k1 = aint.length; for (l1 = 0; l1 < k1; ++l1) { i2 = aint1[l1]; if (i2 == j1) { ; } } amovingobjectposition[j1] = super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_); } int[] aint2 = aint; int k2 = aint.length; for (k1 = 0; k1 < k2; ++k1) { l1 = aint2[k1]; amovingobjectposition[l1] = null; } MovingObjectPosition movingobjectposition1 = null; double d1 = 0.0D; MovingObjectPosition[] amovingobjectposition1 = amovingobjectposition; i2 = amovingobjectposition.length; for (int j2 = 0; j2 < i2; ++j2) { MovingObjectPosition movingobjectposition = amovingobjectposition1[j2]; if (movingobjectposition != null) { double d0 = movingobjectposition.hitVec.squareDistanceTo(p_149731_6_); if (d0 > d1) { movingobjectposition1 = movingobjectposition; d1 = d0; } } } return movingobjectposition1; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) {} }
-
Il va falloir que tu crées un nouveau sujet à chaque fois, on va pas régler tous tes problèmes sur un seul sujet.
Pour les escaliers : tu n’as pas besoin de créer une nouvelle classe, regarde dans le code de Minecraft.