Modifier la vitesse d'une echelle
-
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
-
@‘robin4002’:
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; } -
@‘SCAREX’:
@‘robin4002’:
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; }Et si le joueur recule sur l échelle ?
Envoyé de mon GT-S7390G
-
@‘Diangle’:
@‘SCAREX’:
@‘robin4002’:
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; }Et si le joueur recule sur l échelle ?
Envoyé de mon GT-S7390G
Dans le code de minecraft, pour descendre faut appuyer sur aucune touche. Après si tu veux totalement changer le gameplay, je te laisse jeter un coup d’oeil à toutes les touches dans Minecraft.getMinecraft().gameSettings.keyBindCeQueTuVeux et si tu veux un keyBind custom, il y a un tutoriel pour ça sur le forum.
-
@‘SCAREX’:
@‘Diangle’:
@‘SCAREX’:
@‘robin4002’:
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; }Et si le joueur recule sur l échelle ?
Envoyé de mon GT-S7390G
Dans le code de minecraft, pour descendre faut appuyer sur aucune touche. Après si tu veux totalement changer le gameplay, je te laisse jeter un coup d’oeil à toutes les touches dans Minecraft.getMinecraft().gameSettings.keyBindCeQueTuVeux et si tu veux un keyBind custom, il y a un tutoriel pour ça sur le forum.
Non pas pour descendre xD Mais quand tu te met dos a une échelle et que tu appuis sur la touche de recule ^^
-
@‘Diangle’:
@‘SCAREX’:
@‘Diangle’:
@‘SCAREX’:
@‘robin4002’:
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { entity.motionY *= 1.1F; }Comme ça ?
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; }Et si le joueur recule sur l échelle ?
Envoyé de mon GT-S7390G
Dans le code de minecraft, pour descendre faut appuyer sur aucune touche. Après si tu veux totalement changer le gameplay, je te laisse jeter un coup d’oeil à toutes les touches dans Minecraft.getMinecraft().gameSettings.keyBindCeQueTuVeux et si tu veux un keyBind custom, il y a un tutoriel pour ça sur le forum.
Non pas pour descendre xD Mais quand tu te met dos a une échelle et que tu appuis sur la touche de recule ^^
J’arrive pas à trouver où le code est exécuté, il faut que tu cherches en profondeur de ton côté.
-
@‘SCAREX’:
@‘Diangle’:
@‘SCAREX’:
@‘Diangle’:
@‘SCAREX’:
Essaie avec çà :
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (Minecraft.getMinecraft().gameSettings.keyBindForward.isPressed()) entity.motionY *= 1.1F; }Et si le joueur recule sur l échelle ?
Envoyé de mon GT-S7390G
Dans le code de minecraft, pour descendre faut appuyer sur aucune touche. Après si tu veux totalement changer le gameplay, je te laisse jeter un coup d’oeil à toutes les touches dans Minecraft.getMinecraft().gameSettings.keyBindCeQueTuVeux et si tu veux un keyBind custom, il y a un tutoriel pour ça sur le forum.
Non pas pour descendre xD Mais quand tu te met dos a une échelle et que tu appuis sur la touche de recule ^^
J’arrive pas à trouver où le code est exécuté, il faut que tu cherches en profondeur de ton côté.
Eh bien pour cela tu check soit la direction (Nord - Sud - Est ou Ouest) que le joueur regarde ou alors tu regardes si rotationYaw ou rotationPitch je ne sais plus est compris entre telle et telle valeur afin de faire en sorte qu il y ait une condition qui check si le joueur est de dos et puis en second tu check si la touche pour reculer est presse et si les deux conditions sont validées et bien tu changeras motionY comme l avait deja dit Scarex.
-
regarde les source du mod ender io il ajoute les dark steel ladder qui vont plus vite que celle de base =P
-
Voilà :
package fr.scarex.st18.ST18Blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockLadder; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import fr.scarex.st18.ST18; public class AdvancedLadder extends BlockLadder { private static final String name = "advanced_ladder"; public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); protected AdvancedLadder() { GameRegistry.registerBlock(this, name); setUnlocalizedName(ST18.MODID + "_" + name); } @Override public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { if (entity.onGround || entity.isCollidedVertically) { return; } if (entity.motionY >= 0.1) { entity.setPosition(entity.posX, entity.posY + 1.0F, entity.posZ); } else if (entity.motionY <= -0.1) { Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock(); if (blockUnder == null || blockUnder == this) { entity.setPosition(entity.posX, entity.posY - 1.0F, entity.posZ); } } } }NOTES :
-ce code marche pour la 1.8, il faut modifier quelques trucs pour que ça fonctionne en 1.7.
-le 1.0F correspond à la vitesse voulue (ici 1.0F est très grand) -
merci pour vos réponse
-
j’ai pris la class de l’échelle et j’ai rajouter sa :
:::
@Overridepublic void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
if (entity.onGround || entity.isCollidedVertically) { return; }
if (entity.motionY >= 0.1) {
entity.setPosition(entity.posX, entity.posY + 1.0F, entity.posZ);
} else if (entity.motionY <= -0.1) {
Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock();
if (blockUnder == null || blockUnder == this) {
entity.setPosition(entity.posX, entity.posY - 1.0F, entity.posZ);
}
}
}
}:::
le problem sais que comme il le disait sais en 1.8
j’arrive pas a réparé sa : BlockPos dans “Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock();”si qu’elle qu’un saurais par quoi remplacé
-
j’ai pris la class de l’échelle et j’ai rajouter sa :
:::
@Overridepublic void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
if (entity.onGround || entity.isCollidedVertically) { return; }
if (entity.motionY >= 0.1) {
entity.setPosition(entity.posX, entity.posY + 1.0F, entity.posZ);
} else if (entity.motionY <= -0.1) {
Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock();
if (blockUnder == null || blockUnder == this) {
entity.setPosition(entity.posX, entity.posY - 1.0F, entity.posZ);
}
}
}
}:::
le problem sais que comme il le disait sais en 1.8
j’arrive pas a réparé sa : BlockPos dans “Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock();”si qu’elle qu’un saurais par quoi remplacé
ps: j’ai testé en la enlevant sa marche parfaitement apres quelque régalge je sais pas a quoi sa servait par contre
-
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)Block blockUnder = world.getBlockState(new BlockPos(entity.posX, entity.posY - 3, entity.posZ)).getBlock();↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Block blockUnder = world.getBlock(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) - 3, MathHelper.floor_double(entity.posZ)); -
sa sa marche aussi
@Overridepublic void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
if (entity.onGround || entity.isCollidedVertically) { return; }
if (entity.motionY >= 0.1) {
entity.setPosition(entity.posX, entity.posY + 0.2F, entity.posZ);
} else if (entity.motionY <= -0.1) {
{
entity.setPosition(entity.posX, entity.posY - 0.0F, entity.posZ);
}
}
}apres je vais faire ta version
-
@‘FairyOne’:
sa sa marche aussi
@Overridepublic void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
if (entity.onGround || entity.isCollidedVertically) { return; }
if (entity.motionY >= 0.1) {
entity.setPosition(entity.posX, entity.posY + 0.2F, entity.posZ);
} else if (entity.motionY <= -0.1) {
{
entity.setPosition(entity.posX, entity.posY - 0.0F, entity.posZ);
}
}
}apres je vais faire ta version
Ton code est le même que celui que j’ai trouvé.
-
oui mais j’ai enlever une ligne.
-
Merci de votre aide mais seulement j’ai un problème.
Quand on monte l’échelle il n’y a pas le son comme quand on monte un échelle normal. -
Tu peux aussi regarde dans le code de l’échelle, jouer un son est très simple.
-
@‘SCAREX’:
Tu peux aussi regarde dans le code de l’échelle, jouer un son est très simple.
Jouer un son n’est pas le problème, mais jouer un son lorsque le joueur bouge sur l’échelle c’est plus compliqué.
P.S: Je ne vois pas en quoi la classe BlockLadder de minecraft 1.7.10 pourrait m’aider…:::
package net.minecraft.block; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockLadder extends Block { private static final String __OBFID = "CL_00000262"; protected BlockLadder() { 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 p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); } /** * Returns the bounding box of the wired rectangular prism to render. */ public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) { this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); } public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_)); } public void func_149797_b(int p_149797_1_) { float var3 = 0.125F; if (p_149797_1_ == 2) { this.setBlockBounds(0.0F, 0.0F, 1.0F - var3, 1.0F, 1.0F, 1.0F); } if (p_149797_1_ == 3) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var3); } if (p_149797_1_ == 4) { this.setBlockBounds(1.0F - var3, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } if (p_149797_1_ == 5) { this.setBlockBounds(0.0F, 0.0F, 0.0F, var3, 1.0F, 1.0F); } } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 8; } public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return p_149742_1_.getBlock(p_149742_2_ - 1, p_149742_3_, p_149742_4_).isNormalCube() ? true : (p_149742_1_.getBlock(p_149742_2_ + 1, p_149742_3_, p_149742_4_).isNormalCube() ? true : (p_149742_1_.getBlock(p_149742_2_, p_149742_3_, p_149742_4_ - 1).isNormalCube() ? true : p_149742_1_.getBlock(p_149742_2_, p_149742_3_, p_149742_4_ + 1).isNormalCube())); } 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_) { int var10 = p_149660_9_; if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.getBlock(p_149660_2_, p_149660_3_, p_149660_4_ + 1).isNormalCube()) { var10 = 2; } if ((var10 == 0 || p_149660_5_ == 3) && p_149660_1_.getBlock(p_149660_2_, p_149660_3_, p_149660_4_ - 1).isNormalCube()) { var10 = 3; } if ((var10 == 0 || p_149660_5_ == 4) && p_149660_1_.getBlock(p_149660_2_ + 1, p_149660_3_, p_149660_4_).isNormalCube()) { var10 = 4; } if ((var10 == 0 || p_149660_5_ == 5) && p_149660_1_.getBlock(p_149660_2_ - 1, p_149660_3_, p_149660_4_).isNormalCube()) { var10 = 5; } return var10; } public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { int var6 = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_); boolean var7 = false; if (var6 == 2 && p_149695_1_.getBlock(p_149695_2_, p_149695_3_, p_149695_4_ + 1).isNormalCube()) { var7 = true; } if (var6 == 3 && p_149695_1_.getBlock(p_149695_2_, p_149695_3_, p_149695_4_ - 1).isNormalCube()) { var7 = true; } if (var6 == 4 && p_149695_1_.getBlock(p_149695_2_ + 1, p_149695_3_, p_149695_4_).isNormalCube()) { var7 = true; } if (var6 == 5 && p_149695_1_.getBlock(p_149695_2_ - 1, p_149695_3_, p_149695_4_).isNormalCube()) { var7 = true; } if (!var7) { this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, var6, 0); p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); } super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random p_149745_1_) { return 1; } }:::