Résolu Echelle plus rapide
-
Bonjour, j’ai crée une nouvelle échelle dans mon mod voici le code:
Cependant, comment je fait pour que l’on puisse monter l’échelle plus vite ?
:::[font=Courier Newpackage ]com.plasmania.icenfire.blocks%(#cc7832)[; ] import com.plasmania.icenfire.IceNFire%(#cc7832)[; ]import cpw.mods.fml.relauncher.Side%(#cc7832)[; ]import cpw.mods.fml.relauncher.SideOnly%(#cc7832)[; ]import java.util.Random%(#cc7832)[; ] import net.minecraft.block.Block%(#cc7832)[; ]import net.minecraft.block.material.Material%(#cc7832)[; ]import net.minecraft.creativetab.CreativeTabs%(#cc7832)[; ]import net.minecraft.entity.EntityLivingBase%(#cc7832)[; ]import net.minecraft.init.Blocks%(#cc7832)[; ]import net.minecraft.util.AxisAlignedBB%(#cc7832)[; ]import net.minecraft.world.IBlockAccess%(#cc7832)[; ]import net.minecraft.world.World%(#cc7832)[; ] import net.minecraftforge.common.util.ForgeDirection%(#cc7832)[; ]import static net.minecraftforge.common.util.ForgeDirection.*%(#cc7832)[; ] %(#629755)[*/** *]%(#629755)[* * Created by PlasMania on 31/07/2015. *]%(#629755)[* */ *]public class IronLadder extends Block { private static final String *__OBFID *= "CL_00000262"%(#cc7832)[; ] public IronLadder() { super(Material.*circuits*)%(#cc7832)[; ] this.setCreativeTab(IceNFire.*iceNFireBlocks*)%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been *]%(#629755)[* * cleared to be reused) *]%(#629755)[* */ *] public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z)%(#cc7832)[; ] return super.getCollisionBoundingBoxFromPool(world, x, y, z)%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Updates the blocks bounds based on its current state. Args: world, x, y, z *]%(#629755)[* */ *] public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) { this.updateLadderBounds(iBlockAccess.getBlockMetadata(x, y, z))%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Returns the bounding box of the wired rectangular prism to render. *]%(#629755)[* */ *] @SideOnly(Side.*CLIENT*) public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z)%(#cc7832)[; ] return super.getSelectedBoundingBoxFromPool(world, x, y, z)%(#cc7832)[; ] } public void updateLadderBounds(int i) { float f = 0.125F%(#cc7832)[; ] if (i == 2) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F)%(#cc7832)[; ] } if (i == 3) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f)%(#cc7832)[; ] } if (i == 4) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F)%(#cc7832)[; ] } if (i == 5) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F)%(#cc7832)[; ] } } %(#629755)[*/** *]%(#629755)[* * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two *]%(#629755)[* * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. *]%(#629755)[* */ *] public boolean isOpaqueCube() { %(#cc7832)[return false; ] } %(#629755)[*/** *]%(#629755)[* * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) *]%(#629755)[* */ *] public boolean renderAsNormalBlock() { %(#cc7832)[return false; ] } %(#629755)[*/** *]%(#629755)[* * The type of render function that is called for this block *]%(#629755)[* */ *] public int getRenderType() { return 8%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z *]%(#629755)[* */ *] public boolean canPlaceBlockAt(World world, int x, int y, int z) { return world.isSideSolid(x - 1, y, z, *EAST*) || world.isSideSolid(x + 1, y, z, *WEST*) || world.isSideSolid(x, y, z - 1, *SOUTH*) || world.isSideSolid(x, y, z + 1, *NORTH*)%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata *]%(#629755)[* */ *] public int onBlockPlaced(World world, int x, int y, int z, int m, float i, float j, float k, int l) { int j1 = l%(#cc7832)[; ] if ((l == 0 || m == 2) && world.isSideSolid(x, y, z + 1, *NORTH*)) { j1 = 2%(#cc7832)[; ] } if ((j1 == 0 || m == 3) && world.isSideSolid(x, y, z - 1, *SOUTH*)) { j1 = 3%(#cc7832)[; ] } if ((j1 == 0 || m == 4) && world.isSideSolid(x + 1, y, z, *WEST*)) { j1 = 4%(#cc7832)[; ] } if ((j1 == 0 || m == 5) && world.isSideSolid(x - 1, y, z, *EAST*)) { j1 = 5%(#cc7832)[; ] } return j1%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are *]%(#629755)[* * their own) Args: x, y, z, neighbor Block *]%(#629755)[* */ *] public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { int l = world.getBlockMetadata(x, y, z)%(#cc7832)[; ] boolean flag = %(#cc7832)[false; ] if (l == 2 && world.isSideSolid(x, y, z + 1, *NORTH*)) { flag = %(#cc7832)[true; ] } if (l == 3 && world.isSideSolid(x, y, z - 1, *SOUTH*)) { flag = %(#cc7832)[true; ] } if (l == 4 && world.isSideSolid(x + 1, y, z, *WEST*)) { flag = %(#cc7832)[true; ] } if (l == 5 && world.isSideSolid(x - 1, y, z, *EAST*)) { flag = %(#cc7832)[true; ] } if (!flag) { this.dropBlockAsItem(world, x, y, z, l, 0)%(#cc7832)[; ] world.setBlockToAir(x, y, z)%(#cc7832)[; ] } super.onNeighborBlockChange(world, x, y, z, block)%(#cc7832)[; ] } %(#629755)[*/** *]%(#629755)[* * Returns the quantity of items to drop on block destruction. *]%(#629755)[* */ *] public int quantityDropped(Random rand) { return 1%(#cc7832)[; ] } %(#bbb529)[@Override ] public boolean isLadder(IBlockAccess iBlockAccess, int x, int y, int z, EntityLivingBase entityLivingBase) { %(#cc7832)[return true; ] } }
:::
-
Salut
Je pense qu’il suffit simplement d’augmenter la valeur f dans updateLadderBounds
Je sais comment faire en 1.8, mais ne 1.7, c’est expérimental -
updateLadderBounds va modifié la hitbox et non la vitesse
-
applique un effet de speed quand le joueur st en collision avec l’échelle regarde dans le cactus la methode pour les degats et a la place des dégâts tu balance un potion de speed durant 1s
-
çà marchera pas : la vitesse n’influence pas sur le motion Y. En revanche le sujet a déjà été posé, fais une recherche sur le forum.
-
Salut,
Tu peux suprimmer ligne 24 :
%(#cc7832)[[font=Courier New]**private**] %(#7f0055)[**static**] %(#7f0055)[**final**] %(#000000)[[font=Courier New]String]%(#a9b7c6)[[font=Courier New] ]%(#9876aa)[[font=Courier New]*__OBFID ]*%(#666600)[[font=Courier New]=]%(#a9b7c6)[[font=Courier New] ]%(#6a8759)[[font=Courier New]"CL_00000262"]%(#cc7832)[[font=Courier New];]
C’est en décompilant Minecraft qu’on a cette ligne de code… inutile…
Et si tu n’a pas trouvé le sujet de l’autre personne qui avait le même problème :
http://www.minecraftforgefrance.fr/showthread.php?tid=1977&highlight=échelle
-
Merci, si je l’ai trouver
-
De rien et n’oublies pas la balise si ton problème est résolu sinon on est là