Bon, mon problème a l’air d’être résolut 🙂
Je fait encore quelque teste et je confirme
Merci pour ton aide 😉
Voici mon code source pour ceux que sa interesse:
package com.yvelis.mtpblocks.blocks;
import cpw.mods.fml.common.network.Player;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World;
public class TpUpBlock extends Block
{
public TpUpBlock(int id)
{
super(id, Material.glass);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getAABBPool().getAABB((float)i + f, j, (float)k + f, (float)(i + 1) - f, (float)(j + 1) - f, (float)(k + 1) - f);
}
@Override
public void onEntityCollidedWithBlock(World world, int X, int Y, int Z, Entity entity)
{
if(!(entity instanceof EntityPlayer))
return;
if(world.isRemote)
return;
EntityPlayer player = (EntityPlayer) entity;
int posY = (int) player.posY + 1;
boolean locationFound = false;
while ( posY < world.getHeight() )
{
posY++;
if( !world.isAirBlock(X, posY, Z) && world.isAirBlock(X, posY + 1, Z) && world.isAirBlock(X, posY + 2, Z) && world.isAirBlock(X, posY + 3, Z))
{
locationFound = true;
break;
}
}
if(locationFound)
{
player.setPositionAndUpdate(X, posY + 1, Z);
player.worldObj.playSoundAtEntity(player, "mtpblocks:teleport", 1.0F, 1.0F);
}
else
player.sendChatToPlayer( ChatMessageComponent.createFromText("Aucune destination pour la teleportation") );
super.onEntityCollidedWithBlock(world, X, Y, Z, entity);
}
}
Edit: Tout a l’air d’être fonctionnel !
Résolut