mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Fix all the non-horrible blocks.
Down to 851 errors with package exclusions.
This commit is contained in:
1 parent
1591f921e1
commit
18a1dedf92
12 files changed
+367
-421
No files matched your search
@@ -6,13 +6,15 @@ import mekanism.common.tile.TileEntityObsidianTNT;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -20,8 +22,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockObsidianTNT extends Block
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public BlockObsidianTNT()
|
||||
{
|
||||
super(Material.tnt);
|
||||
@@ -29,63 +29,59 @@ public class BlockObsidianTNT extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
super.onBlockAdded(world, pos, state);
|
||||
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0)
|
||||
{
|
||||
explode(world, x, y, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
explode(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
|
||||
{
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0)
|
||||
{
|
||||
explode(world, x, y, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
explode(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
|
||||
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
EntityObsidianTNT entity = new EntityObsidianTNT(world, x + 0.5F, y + 0.5F, z + 0.5F);
|
||||
EntityObsidianTNT entity = new EntityObsidianTNT(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
|
||||
entity.fuse = world.rand.nextInt(entity.fuse / 4) + entity.fuse / 8;
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void explode(World world, int x, int y, int z)
|
||||
public void explode(World world, BlockPos pos)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
EntityObsidianTNT entity = new EntityObsidianTNT(world, x + 0.5F, y + 0.5F, z + 0.5F);
|
||||
EntityObsidianTNT entity = new EntityObsidianTNT(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
|
||||
world.spawnEntityInWorld(entity);
|
||||
world.playSoundAtEntity(entity, "game.tnt.primed", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel)
|
||||
{
|
||||
explode(world, x, y, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
explode(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return super.onBlockActivated(world, x, y, z, entityplayer, i1, f1, f2, f3);
|
||||
return super.onBlockActivated(world, pos, state, entityplayer, side, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,24 +91,6 @@ public class BlockObsidianTNT extends Block
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityObsidianTNT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
@@ -120,13 +98,7 @@ public class BlockObsidianTNT extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity entity)
|
||||
{
|
||||
if(entity instanceof EntityArrow && !world.isRemote)
|
||||
{
|
||||
@@ -134,8 +106,8 @@ public class BlockObsidianTNT extends Block
|
||||
|
||||
if(entityarrow.isBurning())
|
||||
{
|
||||
explode(world, x, y, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
explode(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user