Créer une Echelle
-
Bonjours,
Je voudrai créer une echelle qui va 2 fois plus vite, j’ai chercher plusieur chose mais pas trouver, j’ai essayer de faire des entity. mais aucun marche j’ai meme fait qu’il était jump.
Voilà mon code:
package fac; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import static net.minecraftforge.common.util.ForgeDirection.*; public class echelle extends Block { protected echelle() { super(Material.circuits); this.setCreativeTab(CreativeTabs.tabDecorations); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z); return super.getCollisionBoundingBoxFromPool(world, x, y, z); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { this.func_149797_b(world.getBlockMetadata(x, y, z)); } /** * Returns the bounding box of the wired rectangular prism to render. */ @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z); return super.getSelectedBoundingBoxFromPool(world, x, y, z); } public void func_149797_b(int p_149797_1_) { float f = 0.125F; if (p_149797_1_ == 2) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } if (p_149797_1_ == 3) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } if (p_149797_1_ == 4) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } if (p_149797_1_ == 5) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 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 8; } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ 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); } /** * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata */ public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { int j1 = metadata; if ((metadata == 0 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 2; } if ((j1 == 0 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 3; } if ((j1 == 0 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 4; } if ((j1 == 0 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 5; } return j1; } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */ public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { int l = world.getBlockMetadata(x, y, z); boolean flag = false; if (l == 2 && world.isSideSolid(x, y, z + 1, NORTH)) { flag = true; } if (l == 3 && world.isSideSolid(x, y, z - 1, SOUTH)) { flag = true; } if (l == 4 && world.isSideSolid(x + 1, y, z, WEST)) { flag = true; } if (l == 5 && world.isSideSolid(x - 1, y, z, EAST)) { flag = true; } if (!flag) { this.dropBlockAsItem(world, x, y, z, l, 0); world.setBlockToAir(x, y, z); } super.onNeighborBlockChange(world, x, y, z, block); } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random random) { return 1; } @Override public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { return true; } }
-
Tu a tenter de modifier les valeurs un peu de partout?
-
Oui j’ai rien trouver tous c’est qui était en rapport avec Y
-
Up Please
-
Je vais me retenir sur le fait que tu ne respecte pas vraiment la convention Java pour le nom de ta classe, et la “convention” de Minecraft pour le nom de classe
( BlockEchelle serait déjà mieux, et BlockFastLadder serait encore meilleur )Mise a part ça, je pense que le tout est géré par le player, et non par le bloc de l’echelle. Tu devrais pouvoir faire ça en utilisant des events.
-
Dsl, je vais modifier sa.
Ok je regard du coter de l’event player
Edit: Rien trouver, tous se que j’essayer font crash ou ne marche pas du tout
-
Sinon 2 solution
-ré-créer la classe échelle pour ce que tu veut avoir comme sa tu pourra changer se que tu veut
-cherche un mod open source qui rajoute des echelles
-
Rien trouver