mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +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
@@ -38,7 +38,7 @@ import mekanism.common.tile.TileEntityStructuralGlass;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
@@ -48,7 +48,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
@@ -123,11 +123,11 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@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.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(block == this && tileEntity instanceof IMultiblock)
|
||||
{
|
||||
@@ -217,9 +217,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
public IIcon getIcon(IBlockAccess world, BlockPos pos, int side)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
|
||||
switch(blockType)
|
||||
{
|
||||
@@ -227,16 +227,16 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
switch(meta)
|
||||
{
|
||||
case 6:
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
boolean active = MekanismUtils.isActive(world, x, y, z);
|
||||
boolean active = MekanismUtils.isActive(world, pos);
|
||||
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||
case 14:
|
||||
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
|
||||
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(pos);
|
||||
|
||||
if(side == tileEntity1.facing)
|
||||
{
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][1] : icons[meta][0];
|
||||
return MekanismUtils.isActive(world, pos) ? icons[meta][1] : icons[meta][0];
|
||||
}
|
||||
else {
|
||||
return icons[meta][2];
|
||||
@@ -248,13 +248,13 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
switch(meta)
|
||||
{
|
||||
case 2:
|
||||
TileEntityInductionPort tileEntity = (TileEntityInductionPort)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionPort tileEntity = (TileEntityInductionPort)world.getTileEntity(pos);
|
||||
return icons[meta][tileEntity.mode ? 1 : 0];
|
||||
case 3:
|
||||
TileEntityInductionCell tileEntity1 = (TileEntityInductionCell)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionCell tileEntity1 = (TileEntityInductionCell)world.getTileEntity(pos);
|
||||
return icons[meta][tileEntity1.tier.ordinal()];
|
||||
case 4:
|
||||
TileEntityInductionProvider tileEntity2 = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionProvider tileEntity2 = (TileEntityInductionProvider)world.getTileEntity(pos);
|
||||
return icons[meta][tileEntity2.tier.ordinal()];
|
||||
default:
|
||||
return getIcon(side, meta);
|
||||
@@ -349,9 +349,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z)
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
|
||||
switch(blockType)
|
||||
{
|
||||
@@ -361,7 +361,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getTileEntity(x, y, z);
|
||||
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
@@ -380,14 +380,14 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
}
|
||||
default:
|
||||
return super.canCreatureSpawn(type, world, x, y, z);
|
||||
return super.canCreatureSpawn(type, world, pos);
|
||||
}
|
||||
case BASIC_BLOCK_2:
|
||||
switch(meta)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
TileEntityInductionCasing tileEntity = (TileEntityInductionCasing)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionCasing tileEntity = (TileEntityInductionCasing)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
@@ -406,23 +406,23 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
}
|
||||
default:
|
||||
return super.canCreatureSpawn(type, world, x, y, z);
|
||||
return super.canCreatureSpawn(type, world, pos);
|
||||
}
|
||||
default:
|
||||
return super.canCreatureSpawn(type, world, x, y, z);
|
||||
return super.canCreatureSpawn(type, world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player)
|
||||
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
|
||||
if(blockType == BasicBlock.BASIC_BLOCK_1)
|
||||
{
|
||||
if(!world.isRemote && meta == 6)
|
||||
{
|
||||
TileEntityBin bin = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
TileEntityBin bin = (TileEntityBin)world.getTileEntity(pos);
|
||||
MovingObjectPosition pos = MekanismUtils.rayTrace(world, player);
|
||||
|
||||
if(pos != null && pos.sideHit == bin.facing)
|
||||
@@ -443,9 +443,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@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, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
int metadata = world.getBlockMetadata(pos);
|
||||
|
||||
if(blockType == BasicBlock.BASIC_BLOCK_1)
|
||||
{
|
||||
@@ -461,7 +461,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 1, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, 1, world, pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -470,7 +470,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 33, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, 33, world, pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -482,26 +482,26 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
|
||||
if(metadata == 6)
|
||||
{
|
||||
TileEntityBin bin = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
TileEntityBin bin = (TileEntityBin)world.getTileEntity(pos);
|
||||
|
||||
if(entityplayer.getCurrentEquippedItem() != null && MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
|
||||
if(entityplayer.getCurrentEquippedItem() != null && MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
{
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
dismantleBlock(world, pos, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
}
|
||||
|
||||
int change = EnumFacing.ROTATION_MATRIX[EnumFacing.UP.ordinal()][bin.facing];
|
||||
|
||||
bin.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
world.notifyBlocksOfNeighborChange(pos, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -543,11 +543,11 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
else if(metadata == 9 || metadata == 11)
|
||||
{
|
||||
return ((IMultiblock)world.getTileEntity(x, y, z)).onActivate(entityplayer);
|
||||
return ((IMultiblock)world.getTileEntity(pos)).onActivate(entityplayer);
|
||||
}
|
||||
else if(metadata == 10)
|
||||
{
|
||||
return ((IStructuralMultiblock)world.getTileEntity(x, y, z)).onActivate(entityplayer);
|
||||
return ((IStructuralMultiblock)world.getTileEntity(pos)).onActivate(entityplayer);
|
||||
}
|
||||
}
|
||||
else if(blockType == BasicBlock.BASIC_BLOCK_2)
|
||||
@@ -559,7 +559,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
|
||||
if(metadata == 1 || metadata == 2)
|
||||
{
|
||||
return ((IMultiblock)world.getTileEntity(x, y, z)).onActivate(entityplayer);
|
||||
return ((IMultiblock)world.getTileEntity(pos)).onActivate(entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,9 +567,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, EnumFacing side)
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return !(blockType == BasicBlock.BASIC_BLOCK_1 && world.getBlockMetadata(x, y, z) == 10);
|
||||
return !(blockType == BasicBlock.BASIC_BLOCK_1 && world.getBlockMetadata(pos) == 10);
|
||||
}
|
||||
|
||||
public static boolean manageInventory(EntityPlayer player, TileEntityDynamicTank tileEntity)
|
||||
@@ -712,10 +712,10 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
int metadata = world.getBlockMetadata(pos);
|
||||
|
||||
if(tileEntity instanceof IActiveState)
|
||||
{
|
||||
@@ -778,9 +778,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
public void onBlockAdded(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
@@ -836,11 +836,11 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z) instanceof TileEntityBasicBlock)
|
||||
if(world.getTileEntity(pos) instanceof TileEntityBasicBlock)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
int side = MathHelper.floor_double((entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int height = Math.round(entityliving.rotationPitch);
|
||||
int change = 3;
|
||||
@@ -869,7 +869,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(pos);
|
||||
|
||||
if(tileEntity instanceof IBoundingBlock)
|
||||
{
|
||||
@@ -877,13 +877,13 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147479_m(x, y, z);
|
||||
world.updateLightByType(EnumSkyBlock.Block, x, y, z);
|
||||
world.updateLightByType(EnumSkyBlock.Sky, x, y, z);
|
||||
world.func_147479_m(pos);
|
||||
world.updateLightByType(EnumSkyBlock.Block, pos);
|
||||
world.updateLightByType(EnumSkyBlock.Sky, pos);
|
||||
|
||||
if(!world.isRemote && world.getTileEntity(x, y, z) != null)
|
||||
if(!world.isRemote && world.getTileEntity(pos) != null)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IMultiblock)
|
||||
{
|
||||
@@ -898,15 +898,15 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
ItemStack ret = new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
ItemStack ret = new ItemStack(this, 1, world.getBlockMetadata(pos));
|
||||
|
||||
if(blockType == BasicBlock.BASIC_BLOCK_1)
|
||||
{
|
||||
if(ret.getItemDamage() == 6)
|
||||
{
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(pos);
|
||||
InventoryBin inv = new InventoryBin(ret);
|
||||
|
||||
inv.setItemCount(tileEntity.getItemCount());
|
||||
@@ -921,17 +921,17 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
{
|
||||
if(ret.getItemDamage() == 3)
|
||||
{
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(pos);
|
||||
((ItemBlockBasic)ret.getItem()).setTier(ret, tileEntity.tier.getBaseTier());
|
||||
}
|
||||
else if(ret.getItemDamage() == 4)
|
||||
{
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(pos);
|
||||
((ItemBlockBasic)ret.getItem()).setTier(ret, tileEntity.tier.getBaseTier());
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyStorage)
|
||||
{
|
||||
@@ -943,13 +943,13 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
|
||||
{
|
||||
@@ -959,19 +959,19 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
|
||||
ItemStack itemStack = getPickBlock(null, world, pos, null);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
@@ -980,7 +980,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -990,23 +990,23 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, int side)
|
||||
{
|
||||
Coord4D obj = new Coord4D(x, y, z).offset(EnumFacing.getFront(side).getOpposite());
|
||||
Coord4D obj = new Coord4D(pos).offset(EnumFacing.getFront(side).getOpposite());
|
||||
|
||||
if(blockType == BasicBlock.BASIC_BLOCK_1 && obj.getBlockState(world) == 10)
|
||||
{
|
||||
return ctms[10][0].shouldRenderSide(world, x, y, z, side);
|
||||
return ctms[10][0].shouldRenderSide(world, pos, side);
|
||||
}
|
||||
else {
|
||||
return super.shouldSideBeRendered(world, x, y, z, side);
|
||||
return super.shouldSideBeRendered(world, pos, side);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing[] getValidRotations(World world, int x, int y, int z)
|
||||
public EnumFacing[] getValidRotations(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
EnumFacing[] valid = new EnumFacing[6];
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
@@ -1026,9 +1026,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, EnumFacing axis)
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
{
|
||||
@@ -1045,9 +1045,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta)
|
||||
public CTMData getCTMData(IBlockAccess world, BlockPos pos, int meta)
|
||||
{
|
||||
if(ctms[meta][1] != null && MekanismUtils.isActive(world, x, y, z))
|
||||
if(ctms[meta][1] != null && MekanismUtils.isActive(world, pos))
|
||||
{
|
||||
return ctms[meta][1];
|
||||
}
|
||||
@@ -1056,12 +1056,12 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
{
|
||||
if(meta == 3)
|
||||
{
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(pos);
|
||||
return ctms[meta][tileEntity.tier.ordinal()];
|
||||
}
|
||||
else if(meta == 4)
|
||||
{
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(pos);
|
||||
return ctms[meta][tileEntity.tier.ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
|
||||
public boolean shouldRenderBlock(IBlockAccess world, BlockPos pos, int meta)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package mekanism.common.block;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import mekanism.common.tile.TileEntityAdvancedBoundingBlock;
|
||||
import mekanism.common.tile.TileEntityBoundingBlock;
|
||||
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.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -25,53 +26,59 @@ public class BlockBounding extends Block
|
||||
setResistance(8F);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon(BlockBasic.ICON_BASE);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
try {
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z);
|
||||
return world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).onBlockActivated(world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, entityplayer, facing, playerX, playerY, playerZ);
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
|
||||
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
|
||||
return state1.getBlock().onBlockActivated(world, tileEntity.mainPos, state1, entityplayer, side, hitX, hitY, hitZ);
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
try {
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z);
|
||||
return world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).getPickBlock(target, world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, player);
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
|
||||
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
|
||||
return state1.getBlock().getPickBlock(target, world, tileEntity.mainPos, player);
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
try {
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z);
|
||||
return world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).removedByPlayer(world, player, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, willHarvest);
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
|
||||
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
|
||||
return state1.getBlock().removedByPlayer(world, tileEntity.mainPos, player, willHarvest);
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
try {
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z);
|
||||
tileEntity.onNeighborChange(block);
|
||||
world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).onNeighborBlockChange(world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, this);
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
|
||||
tileEntity.onNeighborChange(state.getBlock());
|
||||
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
|
||||
state1.getBlock().onNeighborBlockChange(world, tileEntity.mainPos, state1, this);
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
@@ -82,7 +89,7 @@ public class BlockBounding extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -100,25 +107,19 @@ public class BlockBounding extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata)
|
||||
public boolean hasTileEntity(IBlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
public TileEntity createTileEntity(World world, IBlockState state)
|
||||
{
|
||||
if(metadata == 0)
|
||||
if(getMetaFromState(state) == 0)
|
||||
{
|
||||
return new TileEntityBoundingBlock();
|
||||
}
|
||||
else if(metadata == 1)
|
||||
else if(getMetaFromState(state) == 1)
|
||||
{
|
||||
return new TileEntityAdvancedBoundingBlock();
|
||||
}
|
||||
|
||||
@@ -10,14 +10,16 @@ import mekanism.common.tile.TileEntityCardboardBox;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -28,8 +30,6 @@ public class BlockCardboardBox extends BlockContainer
|
||||
{
|
||||
private static boolean testingPlace = false;
|
||||
|
||||
public IIcon[] icons = new IIcon[6];
|
||||
|
||||
public BlockCardboardBox()
|
||||
{
|
||||
super(Material.cloth);
|
||||
@@ -38,6 +38,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
setResistance(1F);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
@@ -59,20 +60,21 @@ public class BlockCardboardBox extends BlockContainer
|
||||
return meta == 0 ? icons[1] : icons[2];
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
public boolean isReplaceable(World world, BlockPos pos)
|
||||
{
|
||||
return testingPlace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote && entityplayer.isSneaking())
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(MekanismBlocks.CardboardBox);
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z);
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity.storedData != null)
|
||||
{
|
||||
@@ -80,7 +82,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
|
||||
testingPlace = true;
|
||||
|
||||
if(!data.block.canPlaceBlockAt(world, x, y, z))
|
||||
if(!data.block.canPlaceBlockAt(world, pos))
|
||||
{
|
||||
testingPlace = false;
|
||||
return true;
|
||||
@@ -90,21 +92,22 @@ public class BlockCardboardBox extends BlockContainer
|
||||
|
||||
if(data.block != null)
|
||||
{
|
||||
data.meta = data.block.onBlockPlaced(world, x, y, z, facing, hitX, hitY, hitZ, data.meta);
|
||||
IBlockState newstate = data.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, data.meta, entityplayer);
|
||||
data.meta = newstate.getBlock().getMetaFromState(newstate);
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, data.block, data.meta, 3);
|
||||
world.setBlockState(pos, data.block.getStateFromMeta(data.meta), 3);
|
||||
|
||||
if(data.tileTag != null && world.getTileEntity(x, y, z) != null)
|
||||
if(data.tileTag != null && world.getTileEntity(pos) != null)
|
||||
{
|
||||
data.updateLocation(x, y, z);
|
||||
world.getTileEntity(x, y, z).readFromNBT(data.tileTag);
|
||||
data.updateLocation(pos);
|
||||
world.getTileEntity(pos).readFromNBT(data.tileTag);
|
||||
}
|
||||
|
||||
if(data.block != null)
|
||||
{
|
||||
data.block.onBlockPlacedBy(world, x, y, z, entityplayer, new ItemStack(data.block, 1, data.meta));
|
||||
data.block.onPostBlockPlaced(world, x, y, z, data.meta);
|
||||
data.block.onBlockPlacedBy(world, pos, data.block.getStateFromMeta(data.meta), entityplayer, new ItemStack(data.block, 1, data.meta));
|
||||
//TODO: data.block.onPostBlockPlaced(world, pos, data.meta);
|
||||
}
|
||||
|
||||
float motion = 0.7F;
|
||||
@@ -112,7 +115,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -127,11 +130,11 @@ public class BlockCardboardBox extends BlockContainer
|
||||
return new TileEntityCardboardBox();
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
|
||||
ItemStack itemStack = getPickBlock(null, world, pos, null);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
@@ -140,7 +143,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -149,11 +152,12 @@ public class BlockCardboardBox extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z);
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
ItemStack itemStack = new ItemStack(MekanismBlocks.CardboardBox, 1, world.getBlockMetadata(x, y, z));
|
||||
ItemStack itemStack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
|
||||
if(itemStack.getItemDamage() == 1)
|
||||
{
|
||||
@@ -167,7 +171,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
|
||||
{
|
||||
@@ -176,12 +180,12 @@ public class BlockCardboardBox extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,7 +195,7 @@ public class BlockCardboardBox extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -211,13 +215,13 @@ public class BlockCardboardBox extends BlockContainer
|
||||
|
||||
public BlockData() {}
|
||||
|
||||
public void updateLocation(int x, int y, int z)
|
||||
public void updateLocation(BlockPos pos)
|
||||
{
|
||||
if(tileTag != null)
|
||||
{
|
||||
tileTag.setInteger("x", x);
|
||||
tileTag.setInteger("y", y);
|
||||
tileTag.setInteger("z", z);
|
||||
tileTag.setInteger("x", pos.getX());
|
||||
tileTag.setInteger("y", pos.getY());
|
||||
tileTag.setInteger("z", pos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -25,6 +26,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing.AxisDirection;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -54,33 +57,35 @@ public class BlockEnergyCube extends BlockContainer
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon(BlockBasic.ICON_BASE);
|
||||
}
|
||||
*/
|
||||
|
||||
@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.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof TileEntityBasicBlock)
|
||||
{
|
||||
((TileEntityBasicBlock)tileEntity).onNeighborChange(block);
|
||||
((TileEntityBasicBlock)tileEntity).onNeighborChange(neighborBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int height = Math.round(entityliving.rotationPitch);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
int side = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int height = Math.round(placer.rotationPitch);
|
||||
int change = 3;
|
||||
|
||||
if(height >= 65)
|
||||
@@ -102,7 +107,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(pos) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,14 +117,14 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List<ItemStack> list)
|
||||
{
|
||||
for(EnergyCubeTier tier : EnergyCubeTier.values())
|
||||
{
|
||||
@@ -135,7 +140,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, 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(ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem()))
|
||||
{
|
||||
@@ -147,29 +152,32 @@ public class BlockEnergyCube extends BlockContainer
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z);
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
|
||||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
dismantleBlock(world, pos, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench) tool).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench) tool).wrenchUsed(entityplayer, pos);
|
||||
}
|
||||
|
||||
int change = EnumFacing.ROTATION_MATRIX[side][tileEntity.facing];
|
||||
EnumFacing rotated = tileEntity.facing.rotateAround(side.getAxis());
|
||||
rotated = side.getAxisDirection() == AxisDirection.POSITIVE ? rotated : rotated.getOpposite();
|
||||
|
||||
int change = rotated.ordinal();
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
world.notifyNeighborsOfStateChange(pos, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -178,7 +186,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 8, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, 8, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +195,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
|
||||
{
|
||||
@@ -196,11 +204,11 @@ public class BlockEnergyCube extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,12 +217,6 @@ public class BlockEnergyCube extends BlockContainer
|
||||
return new TileEntityEnergyCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
@@ -228,9 +230,9 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z);
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
|
||||
ItemStack itemStack = new ItemStack(MekanismBlocks.EnergyCube);
|
||||
|
||||
IEnergyCube energyCube = (IEnergyCube)itemStack.getItem();
|
||||
@@ -245,11 +247,11 @@ public class BlockEnergyCube extends BlockContainer
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
|
||||
ItemStack itemStack = getPickBlock(null, world, pos, null);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
@@ -258,7 +260,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -273,22 +275,22 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
|
||||
public int getComparatorInputOverride(World world, BlockPos pos)
|
||||
{
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z);
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
|
||||
return tileEntity.getRedstoneLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, EnumFacing side)
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing[] getValidRotations(World world, int x, int y, int z)
|
||||
public EnumFacing[] getValidRotations(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
EnumFacing[] valid = new EnumFacing[6];
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
@@ -308,9 +310,9 @@ public class BlockEnergyCube extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, EnumFacing axis)
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
{
|
||||
|
||||
@@ -14,13 +14,15 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
@@ -42,19 +44,21 @@ public class BlockGasTank extends BlockContainer
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon("mekanism:SteelCasing");
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int side = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 3;
|
||||
|
||||
switch(side)
|
||||
@@ -66,25 +70,25 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(pos) > 0;
|
||||
}
|
||||
|
||||
@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.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof TileEntityBasicBlock)
|
||||
{
|
||||
((TileEntityBasicBlock)tileEntity).onNeighborChange(block);
|
||||
((TileEntityBasicBlock)tileEntity).onNeighborChange(neighborBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float playerX, float playerY, float playerZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem()))
|
||||
{
|
||||
@@ -96,27 +100,27 @@ public class BlockGasTank extends BlockContainer
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z);
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
dismantleBlock(world, pos, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
|
||||
int change = EnumFacing.ROTATION_MATRIX[EnumFacing.UP.ordinal()][tileEntity.facing];
|
||||
int change = tileEntity.facing.rotateY().ordinal();
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
world.notifyNeighborsOfStateChange(pos, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +129,7 @@ public class BlockGasTank extends BlockContainer
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 10, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, 10, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +137,7 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
|
||||
{
|
||||
@@ -142,19 +146,19 @@ public class BlockGasTank extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
|
||||
ItemStack itemStack = getPickBlock(null, world, pos, null);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
@@ -163,7 +167,7 @@ public class BlockGasTank extends BlockContainer
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -178,17 +182,11 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
@@ -198,7 +196,7 @@ public class BlockGasTank extends BlockContainer
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,16 +206,16 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z);
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank);
|
||||
|
||||
IGasItem storageTank = (IGasItem)itemStack.getItem();
|
||||
storageTank.setGas(itemStack, tileEntity.gasTank.getGas());
|
||||
|
||||
ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem();
|
||||
inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack);
|
||||
inventory.setInventory(tileEntity.getInventory(), itemStack);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
@@ -229,16 +227,16 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
|
||||
public int getComparatorInputOverride(World world, BlockPos pos)
|
||||
{
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z);
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
return tileEntity.getRedstoneLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing[] getValidRotations(World world, int x, int y, int z)
|
||||
public EnumFacing[] getValidRotations(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
EnumFacing[] valid = new EnumFacing[6];
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
@@ -258,9 +256,9 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, EnumFacing axis)
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,8 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -98,8 +99,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -250,9 +251,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
int side = MathHelper.floor_double((entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int height = Math.round(entityliving.rotationPitch);
|
||||
int change = 3;
|
||||
@@ -310,7 +311,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(pos);
|
||||
|
||||
if(tileEntity instanceof IBoundingBlock)
|
||||
{
|
||||
@@ -319,25 +320,25 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, Block block, int meta)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IBoundingBlock)
|
||||
{
|
||||
((IBoundingBlock)tileEntity).onBreak();
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
super.breakBlock(world, pos, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
public void randomDisplayTick(World world, BlockPos pos, Random random)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
if(MekanismUtils.isActive(world, x, y, z) && ((IActiveState)tileEntity).renderUpdate() && client.machineEffects)
|
||||
if(MekanismUtils.isActive(world, pos) && ((IActiveState)tileEntity).renderUpdate() && client.machineEffects)
|
||||
{
|
||||
float xRandom = (float)x + 0.5F;
|
||||
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
|
||||
@@ -376,11 +377,11 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
if(general.enableAmbientLighting)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IActiveState)
|
||||
{
|
||||
@@ -437,10 +438,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
public IIcon getIcon(IBlockAccess world, BlockPos pos, int side)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
int meta = world.getBlockMetadata(pos);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
switch(blockType)
|
||||
{
|
||||
@@ -453,13 +454,13 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
case 3:
|
||||
case 9:
|
||||
case 10:
|
||||
boolean active = MekanismUtils.isActive(world, x, y, z);
|
||||
boolean active = MekanismUtils.isActive(world, pos);
|
||||
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
TileEntityFactory factory = (TileEntityFactory)tileEntity;
|
||||
active = MekanismUtils.isActive(world, x, y, z);
|
||||
active = MekanismUtils.isActive(world, pos);
|
||||
|
||||
return factoryIcons[factory.tier.ordinal()][factory.recipeType.ordinal()][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||
default:
|
||||
@@ -470,7 +471,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
{
|
||||
case 3:
|
||||
case 5:
|
||||
boolean active = MekanismUtils.isActive(world, x, y, z);
|
||||
boolean active = MekanismUtils.isActive(world, pos);
|
||||
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||
default:
|
||||
return icons[meta][0];
|
||||
@@ -479,7 +480,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
switch(meta)
|
||||
{
|
||||
case 3:
|
||||
boolean active = MekanismUtils.isActive(world, x, y, z);
|
||||
boolean active = MekanismUtils.isActive(world, pos);
|
||||
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||
default:
|
||||
return icons[meta][0];
|
||||
@@ -543,7 +544,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float posX, float posY, float posZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, EntityPlayer entityplayer, int side, float posX, float posY, float posZ)
|
||||
{
|
||||
if(ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem()))
|
||||
{
|
||||
@@ -555,24 +556,24 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
int metadata = world.getBlockMetadata(pos);
|
||||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
{
|
||||
if(entityplayer.isSneaking() && MachineType.get(blockType, metadata) != MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
dismantleBlock(world, pos, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
}
|
||||
|
||||
int change = EnumFacing.ROTATION_MATRIX[EnumFacing.UP.ordinal()][tileEntity.facing];
|
||||
@@ -595,7 +596,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
world.notifyBlocksOfNeighborChange(pos, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -636,7 +637,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -655,7 +656,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
|
||||
if(teleporter.owner.equals(entityplayer.getName()) || MekanismUtils.isOp((EntityPlayerMP)entityplayer))
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos);
|
||||
}
|
||||
else {
|
||||
entityplayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("gui.teleporter.noAccess")));
|
||||
@@ -666,7 +667,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
default:
|
||||
if(!entityplayer.isSneaking() && type.guiId != -1)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -707,7 +708,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -719,49 +720,49 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World world, int x, int y, int z)
|
||||
public float getBlockHardness(World world, BlockPos pos)
|
||||
{
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(pos)) != MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
return blockHardness;
|
||||
}
|
||||
else {
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(pos);
|
||||
return tileEntity.canAccess() ? 3.5F : -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
public float getExplosionResistance(Entity entity, World world, BlockPos pos, double explosionX, double explosionY, double explosionZ)
|
||||
{
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(pos)) != MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
return blockResistance;
|
||||
}
|
||||
else {
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(pos);
|
||||
return tileEntity.canAccess() ? 3.5F : -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
float motion = 0.7F;
|
||||
double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
private boolean manageInventory(EntityPlayer player, TileEntityPortableTank tileEntity)
|
||||
@@ -875,11 +876,11 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@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.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof TileEntityBasicBlock)
|
||||
{
|
||||
@@ -908,10 +909,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
ItemStack itemStack = new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
ItemStack itemStack = new ItemStack(this, 1, world.getBlockMetadata(pos));
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
@@ -982,9 +983,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
public void onBlockAdded(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
@@ -996,9 +997,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
|
||||
public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, int side)
|
||||
{
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(x, y, z));
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(pos));
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -1009,11 +1010,11 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
|
||||
ItemStack itemStack = getPickBlock(null, world, pos, null);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
@@ -1022,7 +1023,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
@@ -1031,9 +1032,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(x, y, z));
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(pos));
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -1050,20 +1051,20 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, BlockPos pos)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z) instanceof TileEntityChargepad)
|
||||
if(world.getTileEntity(pos) instanceof TileEntityChargepad)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
return super.getCollisionBoundingBoxFromPool(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, EnumFacing side)
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(x, y, z));
|
||||
MachineType type = MachineType.get(blockType, world.getBlockMetadata(pos));
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -1349,9 +1350,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing[] getValidRotations(World world, int x, int y, int z)
|
||||
public EnumFacing[] getValidRotations(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
EnumFacing[] valid = new EnumFacing[6];
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
@@ -1371,9 +1372,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, EnumFacing axis)
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
{
|
||||
@@ -1390,9 +1391,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side)
|
||||
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, int side)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityLaserAmplifier)
|
||||
{
|
||||
@@ -1403,9 +1404,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta)
|
||||
public CTMData getCTMData(IBlockAccess world, BlockPos pos, int meta)
|
||||
{
|
||||
if(ctms[meta][1] != null && MekanismUtils.isActive(world, x, y, z))
|
||||
if(ctms[meta][1] != null && MekanismUtils.isActive(world, pos))
|
||||
{
|
||||
return ctms[meta][1];
|
||||
}
|
||||
@@ -1414,7 +1415,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderBlock(IBlockAccess world, int x, int y, int z, int meta)
|
||||
public boolean shouldRenderBlock(IBlockAccess world, BlockPos pos, int meta)
|
||||
{
|
||||
return !MachineType.get(this, meta).hasModel;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import mekanism.common.Mekanism;
|
||||
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -24,8 +24,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public class BlockOre extends Block
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public BlockOre()
|
||||
{
|
||||
super(Material.rock);
|
||||
@@ -34,6 +32,7 @@ public class BlockOre extends Block
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
@@ -42,23 +41,17 @@ public class BlockOre extends Block
|
||||
icons[1] = register.registerIcon("mekanism:CopperOre");
|
||||
icons[2] = register.registerIcon("mekanism:TinOre");
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List<ItemStack> list)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, 0));
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
|
||||
@@ -9,11 +9,14 @@ import mekanism.common.MekanismBlocks;
|
||||
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -35,6 +38,7 @@ public class BlockPlastic extends Block
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
@@ -60,29 +64,30 @@ public class BlockPlastic extends Block
|
||||
blockIcon = register.registerIcon("mekanism:RoadPlasticBlock");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity e)
|
||||
public Vec3 modifyAcceleration(World world, BlockPos pos, Entity e, Vec3 motion)
|
||||
{
|
||||
if(this == MekanismBlocks.RoadPlasticBlock)
|
||||
{
|
||||
double boost = 1.6;
|
||||
|
||||
double a = Math.atan2(e.motionX, e.motionZ);
|
||||
e.motionX += Math.sin(a) * boost * slipperiness;
|
||||
e.motionZ += Math.cos(a) * boost * slipperiness;
|
||||
double a = Math.atan2(motion.xCoord, motion.zCoord);
|
||||
return new Vec3(motion.xCoord + Math.sin(a) * boost * slipperiness, motion.yCoord, motion.zCoord + Math.cos(a) * boost * slipperiness);
|
||||
}
|
||||
return motion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return i;
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List<ItemStack> list)
|
||||
{
|
||||
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||
{
|
||||
@@ -91,15 +96,15 @@ public class BlockPlastic extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass)
|
||||
{
|
||||
return getRenderColor(world.getBlockMetadata(x, y, z));
|
||||
return getRenderColor(world.getBlockState(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderColor(int meta)
|
||||
public int getRenderColor(IBlockState state)
|
||||
{
|
||||
EnumColor colour = EnumColor.DYES[meta];
|
||||
EnumColor colour = EnumColor.DYES[getMetaFromState(state)];
|
||||
return (int)(colour.getColor(0)*255) << 16 | (int)(colour.getColor(1)*255) << 8 | (int)(colour.getColor(2)*255);
|
||||
}
|
||||
|
||||
@@ -113,24 +118,4 @@ public class BlockPlastic extends Block
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(World world, int x, int y, int z, EnumFacing side, int colour)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta != (15 - colour))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 15-colour, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return Mekanism.proxy.PLASTIC_RENDER_ID;
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,12 @@ import mekanism.common.Mekanism;
|
||||
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -20,13 +23,13 @@ public class BlockPlasticFence extends BlockFence
|
||||
{
|
||||
public BlockPlasticFence()
|
||||
{
|
||||
super("mekanism:PlasticFence", Material.clay);
|
||||
super(Material.clay);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List<ItemStack> list)
|
||||
{
|
||||
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||
{
|
||||
@@ -35,35 +38,22 @@ public class BlockPlasticFence extends BlockFence
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass)
|
||||
{
|
||||
return getRenderColor(world.getBlockMetadata(x, y, z));
|
||||
return getRenderColor(world.getBlockState(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderColor(int meta)
|
||||
public int getRenderColor(IBlockState state)
|
||||
{
|
||||
EnumColor colour = EnumColor.DYES[meta];
|
||||
EnumColor colour = EnumColor.DYES[getMetaFromState(state)];
|
||||
return (int)(colour.getColor(0)*255) << 16 | (int)(colour.getColor(1)*255) << 8 | (int)(colour.getColor(2)*255);
|
||||
|
||||
}
|
||||
|
||||
public boolean recolourBlock(World world, int x, int y, int z, EnumFacing side, int colour)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta != (15 - colour))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 15-colour, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return i;
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,8 @@ import mekanism.common.MekanismItems;
|
||||
|
||||
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.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSalt extends Block
|
||||
{
|
||||
@@ -21,16 +19,18 @@ public class BlockSalt extends Block
|
||||
setHardness(0.5F);
|
||||
setStepSound(soundTypeSand);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon("mekanism:SaltBlock");
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon("mekanism:SaltBlock");
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune)
|
||||
{
|
||||
return MekanismItems.Salt;
|
||||
}
|
||||
|
||||
@@ -737,13 +737,13 @@ public final class MekanismUtils
|
||||
* @param boundingLocation - coordinates of bounding block
|
||||
* @param orig - original block
|
||||
*/
|
||||
public static void makeAdvancedBoundingBlock(World world, Coord4D boundingLocation, Coord4D orig)
|
||||
public static void makeAdvancedBoundingBlock(World world, BlockPos boundingLocation, Coord4D orig)
|
||||
{
|
||||
world.setBlockState(boundingLocation, MekanismBlocks.BoundingBlock.getStateFromMeta(1), 0);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
((TileEntityAdvancedBoundingBlock)boundingLocation.getTileEntity(world)).setMainLocation(orig);
|
||||
((TileEntityAdvancedBoundingBlock)world.getTileEntity(boundingLocation)).setMainLocation(orig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user