Всем привет.Когда ставлю свою модель,фантомные блоки ставятся,но когда ее ломаю они не убираются,помогите пж.Вот код
Java:
package com.lnti.DecorElterion.block;
import com.lnti.DecorElterion.DecorElterion;
import com.lnti.DecorElterion.blocks.render.TileEntitybench;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class bench extends Block implements ITileEntityProvider {
public bench() {
super(Material.circuits);
setCreativeTab(DecorElterion.RpgBlockTab);
setHardness(0.25F);
setStepSound(soundTypeMetal);
setBlockTextureName("iron_block");
setBlockName("bench");
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntitybench();
}
public int getRenderType() {
return -1;
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack is) {
int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if(l == 0)
{
world.setBlock(x-1, y, z, DecorElterion.fantomblock);
}
else if(l == 1)
{
world.setBlock(x, y, z-1, DecorElterion.fantomblock);
}
else if(l == 2)
{
world.setBlock(x+1, y, z, DecorElterion.fantomblock);
}
else if(l == 3)
{
world.setBlock(x, y, z+1, DecorElterion.fantomblock);
}
world.setBlockMetadataWithNotify(x, y, z, l, 2);
}
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int par5)
{
int l = world.getBlockMetadata(x, y, z);
if(l == 0)
{
world.setBlockToAir(x-1, y, z);
}
else if(l == 1)
{
world.setBlockToAir(x, y, z-1);
}
else if(l == 2)
{
world.setBlockToAir(x+1, y, z);
}
else if(l == 3)
{
world.setBlockToAir(x, y, z+1);
}
}
}