Coder un hammer pour qu'il mine en 3X3

dinomatt37

Aventurier
9 Septembre 2021
20
0
3
16
Salut je voudrais savoir si quelqu'un pourrait m'aider pour mon mod minecraft,
je voudrais que quelqu'un m'aide ou me donner le cod(pour créer un hammer qui mine du 3x3).

Cordialement,
dinomatt37
 

Minsto

Architecte en herbe
7 Janvier 2014
42
4
73
36
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState block, BlockPos pos, EntityLivingBase living)
{
if(living instanceof EntityPlayer && !world.isRemote)
{
for(int x1 = -2; x1 < 3; x1++)
{
for(int y1 = -2; y1 < 3; y1++)
{
for(int z1 = -2; z1 < 3; z1++)
{
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();

TileEntity te = new TileEntity() {};

BlockPos pos1 = new BlockPos(x + x1, y + y1, z + z1);
if(world.getBlockState(pos1).getBlockHardness(world, pos1) >= 0) {
world.getBlockState(pos1).getBlock().harvestBlock(world, (EntityPlayer)living, pos1, block, te,stack);
world.setBlockToAir(pos1);
}

int exp = world.getBlockState(pos).getBlock().getExpDrop(world.getBlockState(pos), world, pos1, 0);
if(exp > 0) {
EntityXPOrb expOrb = new EntityXPOrb(world, x, y, z, exp);
world.spawnEntity(expOrb);
}
}
}
}
}
return super.onBlockDestroyed(stack, world, block, pos, living);
}
}