v4.0.1 Release

Bug fixes!
*Touched up on machine code.
*Fixed bug where machine stays active after it has finished it's
process.
*Machine tile entity code now major factor in block active/inactive
state.
*Fixed bug where Steve's Stopwatch/Weather Orb has no effect.
*Fixed bug where Storm/Rain text on Weather Orb is too big for it's
button.
*Fixed bug where server time does not change with Steve's Stopwatch.
*Modified Javadocs.
*Removed machine GUI block update.
*Fixed isMultiplayer() function.
*Removed BlockObsidianContainer class, will be added once I merge all
machine code.
*Touched up on packet handler.
*Added SIdeOnly checks for machine blocks.
*Updated version to 4.0.1
This commit is contained in:
Aidan Brady 2012-08-18 13:40:59 -04:00
parent 271335b1dd
commit cf4221d1d6
27 changed files with 987 additions and 1090 deletions

View file

@ -45,9 +45,12 @@ public class BlockBase extends Block
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if(blockID == ObsidianIngots.refinedObsidianID)
{
if(entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 19, world, x, y, z);
}
}
return false;
}

View file

@ -3,6 +3,8 @@ package net.uberkat.obsidian.common;
import java.util.ArrayList;
import java.util.Random;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
@ -10,22 +12,21 @@ public class BlockCombiner extends BlockContainer
{
private Random combinerRand = new Random();
private static boolean keepCombinerInventory = false;
private static int currentTextureIndex = 0;
private static int currentFrontTextureIndex = 0;
public BlockCombiner(int par1)
{
super(par1, Material.iron);
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
private void setDefaultDirection(World world, int par2, int par3, int par4)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
int var5 = world.getBlockId(par2, par3, par4 - 1);
int var6 = world.getBlockId(par2, par3, par4 + 1);
int var7 = world.getBlockId(par2 - 1, par3, par4);
int var8 = world.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
@ -48,77 +49,89 @@ public class BlockCombiner extends BlockContainer
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
world.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
world.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
world.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
world.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
world.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
public int idDropped(int par1, Random par2Random, int par3)
public int idDropped(int par1, Random random, int par3)
{
return ObsidianIngots.combinerID;
}
public void onBlockAdded(World world, int par2, int par3, int par4)
{
setDefaultDirection(world, par2, par3, par4);
super.onBlockAdded(world, par2, par3, par4);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata > 5) return 14;
TileEntityCombiner tileEntity = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
if(tileEntity == null) return 0;
else if(tileEntity.machineBurnTime > 0) return 14;
else return 0;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
setDefaultDirection(par1World, par2, par3, par4);
super.onBlockAdded(par1World, par2, par3, par4);
}
@SideOnly(Side.CLIENT)
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntityCombiner tileEntity = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
boolean isActive = tileEntity.machineBurnTime > 0;
int metadata = world.getBlockMetadata(x, y, z);
int sideMeta = (metadata > 5 ? metadata - 8 : metadata);
return side != sideMeta ? 16 : (metadata > 5 ? currentTextureIndex : 17);
if(side == metadata)
{
return isActive ? currentFrontTextureIndex : 17;
}
else {
return 16;
}
}
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int par2, int par3, int par4, Random par5Random)
{
if(currentTextureIndex < 15 && currentTextureIndex > -1)
TileEntityCombiner tileEntity = (TileEntityCombiner)world.getBlockTileEntity(par2, par3, par4);
if(currentFrontTextureIndex < 15 && currentFrontTextureIndex > -1)
{
currentTextureIndex++;
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
currentFrontTextureIndex++;
world.markBlockAsNeedsUpdate(par2, par3, par4);
}
else if(currentTextureIndex == 15)
else if(currentFrontTextureIndex == 15)
{
currentTextureIndex = 0;
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
currentFrontTextureIndex = 0;
world.markBlockAsNeedsUpdate(par2, par3, par4);
}
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 5)
int metadata = world.getBlockMetadata(par2, par3, par4);
if (tileEntity.machineBurnTime > 0)
{
int metadata = (var6 - 8);
float var7 = (float)par2 + 0.5F;
float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)par4 + 0.5F;
@ -127,90 +140,80 @@ public class BlockCombiner extends BlockContainer
if (metadata == 4)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 5)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
public int getBlockTextureFromSide(int side)
{
return side != 3 ? 16 : (meta > 5 ? 0 : 17);
if(side == 3)
{
return 17;
}
else {
return 16;
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int i1, float f1, float f2, float f3)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}
else
{
TileEntityCombiner var6 = (TileEntityCombiner)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityCombiner tileEntity = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
if (var6 != null)
if (tileEntity != null)
{
par5EntityPlayer.openGui(ObsidianIngots.instance, 23, par1World, par2, par3, par4);
if(!entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 23, world, x, y, z);
}
else {
return false;
}
}
return true;
}
}
public static void updateCombinerBlockState(boolean par0, World par1World, int par2, int par3, int par4)
public static void updateBlock(World world, int x, int y, int z)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepCombinerInventory = true;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (par0)
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
if (tileEntity != null)
{
if(var5 <= 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5+8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
else
{
if(var5 > 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5-8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
tileEntity.validate();
world.setBlockTileEntity(x, y, z, tileEntity);
}
}
keepCombinerInventory = false;
if (var6 != null)
public void breakBlock(World world, int par2, int par3, int par4, int i1, int i2)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
}
}
public void breakBlock(World par1World, int par2, int par3, int par4, int i1, int i2)
{
if (!keepCombinerInventory)
{
TileEntityCombiner var5 = (TileEntityCombiner)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityCombiner var5 = (TileEntityCombiner)world.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
@ -234,7 +237,7 @@ public class BlockCombiner extends BlockContainer
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
EntityItem var12 = new EntityItem(world, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
@ -245,14 +248,13 @@ public class BlockCombiner extends BlockContainer
var12.motionX = (double)((float)this.combinerRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.combinerRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.combinerRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
}
world.spawnEntityInWorld(var12);
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, i1, i2);
super.breakBlock(world, par2, par3, par4, i1, i2);
}
public void addCreativeItems(ArrayList itemList)

View file

@ -3,6 +3,8 @@ package net.uberkat.obsidian.common;
import java.util.ArrayList;
import java.util.Random;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
@ -10,21 +12,19 @@ public class BlockCrusher extends BlockContainer
{
private Random crusherRand = new Random();
private static boolean keepCrusherInventory = false;
public BlockCrusher(int par1)
{
super(par1, Material.iron);
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
private void setDefaultDirection(World world, int par2, int par3, int par4)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
int var5 = world.getBlockId(par2, par3, par4 - 1);
int var6 = world.getBlockId(par2, par3, par4 + 1);
int var7 = world.getBlockId(par2 - 1, par3, par4);
int var8 = world.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
@ -47,66 +47,78 @@ public class BlockCrusher extends BlockContainer
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
world.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
world.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
world.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
world.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
world.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
public int idDropped(int par1, Random par2Random, int par3)
public int idDropped(int par1, Random random, int par3)
{
return ObsidianIngots.crusherID;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
public void onBlockAdded(World world, int par2, int par3, int par4)
{
setDefaultDirection(par1World, par2, par3, par4);
super.onBlockAdded(par1World, par2, par3, par4);
setDefaultDirection(world, par2, par3, par4);
super.onBlockAdded(world, par2, par3, par4);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata > 5) return 14;
TileEntityCrusher tileEntity = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
if(tileEntity == null) return 0;
else if(tileEntity.machineBurnTime > 0) return 14;
else return 0;
}
@SideOnly(Side.CLIENT)
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntityCrusher tileEntity = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
boolean isActive = tileEntity.machineBurnTime > 0;
int metadata = world.getBlockMetadata(x, y, z);
int sideMeta = (metadata > 5 ? metadata - 8 : metadata);
return side != sideMeta ? 2 : (metadata > 5 ? 16 : 17);
if(side == metadata)
{
return isActive ? 16 : 17;
}
else {
return 2;
}
}
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int par2, int par3, int par4, Random par5Random)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 5)
TileEntityCrusher tileEntity = (TileEntityCrusher)world.getBlockTileEntity(par2, par3, par4);
int metadata = world.getBlockMetadata(par2, par3, par4);
if (tileEntity.machineBurnTime > 0)
{
int metadata = (var6 - 8);
float var7 = (float)par2 + 0.5F;
float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)par4 + 0.5F;
@ -115,82 +127,74 @@ public class BlockCrusher extends BlockContainer
if (metadata == 4)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 5)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
public int getBlockTextureFromSide(int side)
{
return side != 3 ? 2 : (meta > 5 ? 16 : 17);
if(side == 3)
{
return 17;
}
else {
return 2;
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int i1, float f1, float f2, float f3)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}
else
{
TileEntityCrusher var6 = (TileEntityCrusher)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityCrusher tileEntity = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
if (var6 != null)
if (tileEntity != null)
{
par5EntityPlayer.openGui(ObsidianIngots.instance, 24, par1World, par2, par3, par4);
if(!entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 24, world, x, y, z);
}
else {
return false;
}
}
return true;
}
}
public static void updateCrusherBlockState(boolean par0, World par1World, int par2, int par3, int par4)
public static void updateBlock(World world, int x, int y, int z)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepCrusherInventory = true;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (par0)
{
if(var5 <= 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5+8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
else
{
if(var5 > 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5-8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
keepCrusherInventory = false;
if (var6 != null)
if (tileEntity != null)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
tileEntity.validate();
world.setBlockTileEntity(x, y, z, tileEntity);
}
}
@ -199,11 +203,9 @@ public class BlockCrusher extends BlockContainer
return new TileEntityCrusher();
}
public void breakBlock(World par1World, int par2, int par3, int par4, int i1, int i2)
public void breakBlock(World world, int par2, int par3, int par4, int i1, int i2)
{
if (!keepCrusherInventory)
{
TileEntityCrusher var5 = (TileEntityCrusher)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityCrusher var5 = (TileEntityCrusher)world.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
@ -227,7 +229,7 @@ public class BlockCrusher extends BlockContainer
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
EntityItem var12 = new EntityItem(world, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
@ -238,14 +240,13 @@ public class BlockCrusher extends BlockContainer
var12.motionX = (double)((float)this.crusherRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.crusherRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.crusherRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
}
world.spawnEntityInWorld(var12);
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, i1, i2);
super.breakBlock(world, par2, par3, par4, i1, i2);
}
public void addCreativeItems(ArrayList itemList)

View file

@ -3,6 +3,8 @@ package net.uberkat.obsidian.common;
import java.util.ArrayList;
import java.util.Random;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
@ -10,56 +12,47 @@ public class BlockEnrichmentChamber extends BlockContainer
{
private Random chamberRand = new Random();
private static boolean keepChamberInventory = false;
public BlockEnrichmentChamber(int par1)
{
super(par1, Material.iron);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata > 5) return 14;
else return 0;
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
world.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
world.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
world.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
world.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
private void setDefaultDirection(World world, int par2, int par3, int par4)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
int var5 = world.getBlockId(par2, par3, par4 - 1);
int var6 = world.getBlockId(par2, par3, par4 + 1);
int var7 = world.getBlockId(par2 - 1, par3, par4);
int var8 = world.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
@ -82,34 +75,53 @@ public class BlockEnrichmentChamber extends BlockContainer
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
world.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public int idDropped(int par1, Random par2Random, int par3)
public int idDropped(int par1, Random random, int par3)
{
return ObsidianIngots.enrichmentChamberID;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
public void onBlockAdded(World world, int par2, int par3, int par4)
{
setDefaultDirection(par1World, par2, par3, par4);
super.onBlockAdded(par1World, par2, par3, par4);
setDefaultDirection(world, par2, par3, par4);
super.onBlockAdded(world, par2, par3, par4);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
TileEntityEnrichmentChamber tileEntity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
if(tileEntity == null) return 0;
else if(tileEntity.machineBurnTime > 0) return 14;
else return 0;
}
@SideOnly(Side.CLIENT)
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntityEnrichmentChamber tileEntity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
boolean isActive = tileEntity.machineBurnTime > 0;
int metadata = world.getBlockMetadata(x, y, z);
int sideMeta = (metadata > 5 ? metadata - 8 : metadata);
return side != sideMeta ? 2 : (metadata > 5 ? 8 : 9);
if(side == metadata)
{
return isActive ? 8 : 9;
}
else {
return 2;
}
}
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int par2, int par3, int par4, Random par5Random)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 5)
TileEntityEnrichmentChamber tileEntity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(par2, par3, par4);
int metadata = world.getBlockMetadata(par2, par3, par4);
if (tileEntity.machineBurnTime > 0)
{
int metadata = (var6 - 8);
float var7 = (float)par2 + 0.5F;
float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)par4 + 0.5F;
@ -118,81 +130,74 @@ public class BlockEnrichmentChamber extends BlockContainer
if (metadata == 4)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 5)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
public int getBlockTextureFromSide(int side)
{
return side != 3 ? 2 : (meta > 5 ? 8 : 9);
if(side == 3)
{
return 9;
}
else {
return 2;
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int i1, float f1, float f2, float f3)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}
else
{
TileEntityEnrichmentChamber var6 = (TileEntityEnrichmentChamber)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityEnrichmentChamber tileEntity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
if (var6 != null)
if (tileEntity != null)
{
par5EntityPlayer.openGui(ObsidianIngots.instance, 21, par1World, par2, par3, par4);
if(!entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 21, world, x, y, z);
}
else {
return false;
}
}
return true;
}
}
public static void updateChamberBlockState(boolean par0, World par1World, int par2, int par3, int par4)
public static void updateBlock(World world, int x, int y, int z)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepChamberInventory = true;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (par0)
{
if(var5 <= 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5+8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
else
{
if(var5 > 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5-8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
keepChamberInventory = false;
if (var6 != null)
if (tileEntity != null)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
tileEntity.validate();
world.setBlockTileEntity(x, y, z, tileEntity);
}
}
@ -201,11 +206,9 @@ public class BlockEnrichmentChamber extends BlockContainer
return new TileEntityEnrichmentChamber();
}
public void onBlockRemoval(World par1World, int par2, int par3, int par4, int i1, int i2)
public void onBlockRemoval(World world, int par2, int par3, int par4, int i1, int i2)
{
if(!keepChamberInventory)
{
TileEntityEnrichmentChamber var5 = (TileEntityEnrichmentChamber)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityEnrichmentChamber var5 = (TileEntityEnrichmentChamber)world.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
@ -229,7 +232,7 @@ public class BlockEnrichmentChamber extends BlockContainer
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
EntityItem var12 = new EntityItem(world, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
@ -240,13 +243,13 @@ public class BlockEnrichmentChamber extends BlockContainer
var12.motionX = (double)((float)this.chamberRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.chamberRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.chamberRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
world.spawnEntityInWorld(var12);
}
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, i1, i2);
super.breakBlock(world, par2, par3, par4, i1, i2);
}
public void addCreativeItems(ArrayList itemList)

View file

@ -1,25 +0,0 @@
package net.uberkat.obsidian.common;
import java.util.ArrayList;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
public class BlockObsidianContainer extends BlockContainer
{
public BlockObsidianContainer(int i, Material material)
{
super(i, material);
}
public TileEntity createNewTileEntity(World world)
{
return null;
}
public String getTextureFile()
{
return "/obsidian/terrain.png";
}
}

View file

@ -3,6 +3,8 @@ package net.uberkat.obsidian.common;
import java.util.ArrayList;
import java.util.Random;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
@ -10,8 +12,6 @@ public class BlockPlatinumCompressor extends BlockContainer
{
private Random compressorRand = new Random();
private static boolean keepCompressorInventory = false;
private static int currentTextureIndex;
public BlockPlatinumCompressor(int par1)
@ -19,14 +19,14 @@ public class BlockPlatinumCompressor extends BlockContainer
super(par1, Material.iron);
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
private void setDefaultDirection(World world, int par2, int par3, int par4)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
int var5 = world.getBlockId(par2, par3, par4 - 1);
int var6 = world.getBlockId(par2, par3, par4 + 1);
int var7 = world.getBlockId(par2 - 1, par3, par4);
int var8 = world.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
@ -49,77 +49,89 @@ public class BlockPlatinumCompressor extends BlockContainer
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
world.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
world.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
world.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
world.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
world.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
public int idDropped(int par1, Random par2Random, int par3)
public int idDropped(int par1, Random random, int par3)
{
return ObsidianIngots.platinumCompressorID;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
public void onBlockAdded(World world, int par2, int par3, int par4)
{
setDefaultDirection(par1World, par2, par3, par4);
super.onBlockAdded(par1World, par2, par3, par4);
setDefaultDirection(world, par2, par3, par4);
super.onBlockAdded(world, par2, par3, par4);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata > 5) return 14;
TileEntityPlatinumCompressor tileEntity = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
if(tileEntity == null) return 0;
else if(tileEntity.machineBurnTime > 0) return 14;
else return 0;
}
@SideOnly(Side.CLIENT)
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntityPlatinumCompressor tileEntity = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
boolean isActive = tileEntity.machineBurnTime > 0;
int metadata = world.getBlockMetadata(x, y, z);
int sideMeta = (metadata > 5 ? metadata - 8 : metadata);
return side != sideMeta ? 16 : (metadata > 5 ? currentTextureIndex : 17);
if(side == metadata)
{
return isActive ? currentTextureIndex : 17;
}
else {
return 16;
}
}
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int par2, int par3, int par4, Random par5Random)
{
TileEntityPlatinumCompressor tileEntity = (TileEntityPlatinumCompressor)world.getBlockTileEntity(par2, par3, par4);
if(currentTextureIndex < 15 && currentTextureIndex > -1)
{
currentTextureIndex++;
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
world.markBlockAsNeedsUpdate(par2, par3, par4);
}
else if(currentTextureIndex == 15)
{
currentTextureIndex = 0;
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
world.markBlockAsNeedsUpdate(par2, par3, par4);
}
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 5)
int metadata = world.getBlockMetadata(par2, par3, par4);
if (tileEntity.machineBurnTime > 0)
{
int metadata = (var6 - 8);
float var7 = (float)par2 + 0.5F;
float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)par4 + 0.5F;
@ -128,82 +140,74 @@ public class BlockPlatinumCompressor extends BlockContainer
if (metadata == 4)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 5)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
public int getBlockTextureFromSide(int side)
{
return side != 3 ? 16 : (meta > 5 ? 0 : 17);
if(side == 3)
{
return 17;
}
else {
return 16;
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int i1, float f1, float f2, float f3)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}
else
{
TileEntityPlatinumCompressor var6 = (TileEntityPlatinumCompressor)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityPlatinumCompressor tileEntity = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
if (var6 != null)
if (tileEntity != null)
{
par5EntityPlayer.openGui(ObsidianIngots.instance, 22, par1World, par2, par3, par4);
if(!entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 22, world, x, y, z);
}
else {
return false;
}
}
return true;
}
}
public static void updateCompressorBlockState(boolean par0, World par1World, int par2, int par3, int par4)
public static void updateBlock(World world, int x, int y, int z)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepCompressorInventory = true;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (par0)
{
if(var5 <= 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5+8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
else
{
if(var5 > 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5-8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
keepCompressorInventory = false;
if (var6 != null)
if (tileEntity != null)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
tileEntity.validate();
world.setBlockTileEntity(x, y, z, tileEntity);
}
}
@ -212,11 +216,9 @@ public class BlockPlatinumCompressor extends BlockContainer
return new TileEntityPlatinumCompressor();
}
public void breakBlock(World par1World, int par2, int par3, int par4, int i1, int i2)
public void breakBlock(World world, int par2, int par3, int par4, int i1, int i2)
{
if (!keepCompressorInventory)
{
TileEntityPlatinumCompressor var5 = (TileEntityPlatinumCompressor)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityPlatinumCompressor var5 = (TileEntityPlatinumCompressor)world.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
@ -240,7 +242,7 @@ public class BlockPlatinumCompressor extends BlockContainer
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
EntityItem var12 = new EntityItem(world, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
@ -251,14 +253,13 @@ public class BlockPlatinumCompressor extends BlockContainer
var12.motionX = (double)((float)this.compressorRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.compressorRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.compressorRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
}
world.spawnEntityInWorld(var12);
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, i1, i2);
super.breakBlock(world, par2, par3, par4, i1, i2);
}
public void addCreativeItems(ArrayList itemList)

View file

@ -7,14 +7,14 @@ import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.BlockProxy;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
public class BlockTheoreticalElementizer extends BlockContainer
{
private Random elementizerRand = new Random();
private static boolean keepElementizerInventory = false;
public int currentFrontTextureIndex = 0;
public int currentBackTextureIndex = 16;
public int currentSideTextureIndex = 32;
public BlockTheoreticalElementizer(int par1)
@ -22,49 +22,42 @@ public class BlockTheoreticalElementizer extends BlockContainer
super(par1, Material.iron);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata > 5) return 15;
else return 0;
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
world.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
world.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
world.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
world.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
private void setDefaultDirection(World world, int par2, int par3, int par4)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
int var5 = world.getBlockId(par2, par3, par4 - 1);
int var6 = world.getBlockId(par2, par3, par4 + 1);
int var7 = world.getBlockId(par2 - 1, par3, par4);
int var8 = world.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
@ -87,33 +80,52 @@ public class BlockTheoreticalElementizer extends BlockContainer
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
world.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public int idDropped(int par1, Random par2Random, int par3)
public int idDropped(int par1, Random random, int par3)
{
return ObsidianIngots.elementizerID;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
public void onBlockAdded(World world, int par2, int par3, int par4)
{
setDefaultDirection(par1World, par2, par3, par4);
super.onBlockAdded(par1World, par2, par3, par4);
setDefaultDirection(world, par2, par3, par4);
super.onBlockAdded(world, par2, par3, par4);
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
TileEntityTheoreticalElementizer tileEntity = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
if(tileEntity == null) return 0;
else if(tileEntity.machineBurnTime > 0) return 14;
else return 0;
}
@SideOnly(Side.CLIENT)
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntityTheoreticalElementizer tileEntity = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
boolean isActive = tileEntity.machineBurnTime > 0;
int metadata = world.getBlockMetadata(x, y, z);
int sideMeta = (metadata > 5 ? metadata - 8 : metadata);
if(side == 0 || side == 1)
{
return metadata > 5 ? 52 : 50;
return isActive ? 52 : 50;
}
else {
return side != sideMeta ? (metadata > 5 ? currentSideTextureIndex : 51) : (metadata > 5 ? currentFrontTextureIndex : 48);
if(side == metadata)
{
return isActive ? currentFrontTextureIndex : 48;
}
else if(side == ForgeDirection.getOrientation(metadata).getOpposite().ordinal())
{
return isActive ? currentBackTextureIndex : 49;
}
else {
return isActive ? currentSideTextureIndex : 51;
}
}
}
@ -128,6 +140,15 @@ public class BlockTheoreticalElementizer extends BlockContainer
currentFrontTextureIndex = 0;
}
if(currentBackTextureIndex < 31 && currentBackTextureIndex > 15)
{
currentBackTextureIndex++;
}
if(currentBackTextureIndex == 31)
{
currentBackTextureIndex = 16;
}
if(currentSideTextureIndex < 47 && currentSideTextureIndex > 31)
{
currentSideTextureIndex++;
@ -138,17 +159,18 @@ public class BlockTheoreticalElementizer extends BlockContainer
}
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int par2, int par3, int par4, Random par5Random)
{
TileEntityTheoreticalElementizer tileEntity = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(par2, par3, par4);
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
int metadata = world.getBlockMetadata(par2, par3, par4);
if (tileEntity.machineBurnTime > 0)
{
updateTexture(par1World, par2, par3, par4);
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 5)
{
int metadata = (var6 - 8);
updateTexture(world, par2, par3, par4);
float var7 = (float)par2 + 0.5F;
float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)par4 + 0.5F;
@ -157,100 +179,84 @@ public class BlockTheoreticalElementizer extends BlockContainer
if (metadata == 4)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 5)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (metadata == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
public int getBlockTextureFromSide(int side)
{
if(side == 0 || side == 1)
{
return meta > 5 ? 52 : 50;
return 50;
}
else if(side == 3)
{
return meta > 5 ? currentFrontTextureIndex : 48;
return 48;
}
else {
return meta > 5 ? currentSideTextureIndex : 51;
return 51;
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int i1, float f1, float f2, float f3)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}
else
{
TileEntityTheoreticalElementizer var6 = (TileEntityTheoreticalElementizer)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityTheoreticalElementizer tileEntity = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
if (var6 != null)
if (tileEntity != null)
{
par5EntityPlayer.openGui(ObsidianIngots.instance, 25, par1World, par2, par3, par4);
if(!entityplayer.isSneaking())
{
entityplayer.openGui(ObsidianIngots.instance, 25, world, x, y, z);
}
else {
return false;
}
}
return true;
}
}
public static void updateElementizerBlockState(boolean par0, World par1World, int par2, int par3, int par4)
public static void updateBlock(World world, int x, int y, int z)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepElementizerInventory = true;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (par0)
world.markBlockAsNeedsUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
if (tileEntity != null)
{
if(var5 <= 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5+8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
}
}
else
{
if(var5 > 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5-8);
par1World.markBlockAsNeedsUpdate(par2, par3, par4);
par1World.updateAllLightTypes(par2, par3, par4);
tileEntity.validate();
world.setBlockTileEntity(x, y, z, tileEntity);
}
}
keepElementizerInventory = false;
if (var6 != null)
public void breakBlock(World world, int par2, int par3, int par4, int i1, int i2)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
}
}
public void breakBlock(World par1World, int par2, int par3, int par4, int i1, int i2)
{
if(!keepElementizerInventory)
{
TileEntityTheoreticalElementizer var5 = (TileEntityTheoreticalElementizer)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityTheoreticalElementizer var5 = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
@ -274,7 +280,7 @@ public class BlockTheoreticalElementizer extends BlockContainer
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
EntityItem var12 = new EntityItem(world, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
@ -285,13 +291,13 @@ public class BlockTheoreticalElementizer extends BlockContainer
var12.motionX = (double)((float)this.elementizerRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.elementizerRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.elementizerRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
world.spawnEntityInWorld(var12);
}
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, i1, i2);
super.breakBlock(world, par2, par3, par4, i1, i2);
}
public void addCreativeItems(ArrayList itemList)

View file

@ -42,14 +42,14 @@ public class ContainerCombiner extends Container
{
ICrafting var2 = (ICrafting)this.crafters.get(var1);
if (this.lastCookTime != this.combiner.combinerCookTime)
if (this.lastCookTime != this.combiner.machineCookTime)
{
var2.updateCraftingInventoryInfo(this, 0, this.combiner.combinerCookTime);
var2.updateCraftingInventoryInfo(this, 0, this.combiner.machineCookTime);
}
if (this.lastBurnTime != this.combiner.combinerBurnTime)
if (this.lastBurnTime != this.combiner.machineBurnTime)
{
var2.updateCraftingInventoryInfo(this, 1, this.combiner.combinerBurnTime);
var2.updateCraftingInventoryInfo(this, 1, this.combiner.machineBurnTime);
}
if (this.lastItemBurnTime != this.combiner.currentItemBurnTime)
@ -58,8 +58,8 @@ public class ContainerCombiner extends Container
}
}
this.lastCookTime = this.combiner.combinerCookTime;
this.lastBurnTime = this.combiner.combinerBurnTime;
this.lastCookTime = this.combiner.machineCookTime;
this.lastBurnTime = this.combiner.machineBurnTime;
this.lastItemBurnTime = this.combiner.currentItemBurnTime;
}
@ -67,12 +67,12 @@ public class ContainerCombiner extends Container
{
if (par1 == 0)
{
this.combiner.combinerCookTime = par2;
this.combiner.machineCookTime = par2;
}
if (par1 == 1)
{
this.combiner.combinerBurnTime = par2;
this.combiner.machineBurnTime = par2;
}
if (par1 == 2)

View file

@ -42,14 +42,14 @@ public class ContainerCrusher extends Container
{
ICrafting var2 = (ICrafting)this.crafters.get(var1);
if (this.lastCookTime != this.crusher.crusherCookTime)
if (this.lastCookTime != this.crusher.machineCookTime)
{
var2.updateCraftingInventoryInfo(this, 0, this.crusher.crusherCookTime);
var2.updateCraftingInventoryInfo(this, 0, this.crusher.machineCookTime);
}
if (this.lastBurnTime != this.crusher.crusherBurnTime)
if (this.lastBurnTime != this.crusher.machineBurnTime)
{
var2.updateCraftingInventoryInfo(this, 1, this.crusher.crusherBurnTime);
var2.updateCraftingInventoryInfo(this, 1, this.crusher.machineBurnTime);
}
if (this.lastItemBurnTime != this.crusher.currentItemBurnTime)
@ -58,8 +58,8 @@ public class ContainerCrusher extends Container
}
}
this.lastCookTime = this.crusher.crusherCookTime;
this.lastBurnTime = this.crusher.crusherBurnTime;
this.lastCookTime = this.crusher.machineCookTime;
this.lastBurnTime = this.crusher.machineBurnTime;
this.lastItemBurnTime = this.crusher.currentItemBurnTime;
}
@ -67,12 +67,12 @@ public class ContainerCrusher extends Container
{
if (par1 == 0)
{
this.crusher.crusherCookTime = par2;
this.crusher.machineCookTime = par2;
}
if (par1 == 1)
{
this.crusher.crusherBurnTime = par2;
this.crusher.machineBurnTime = par2;
}
if (par1 == 2)

View file

@ -42,14 +42,14 @@ public class ContainerEnrichmentChamber extends Container
{
ICrafting var2 = (ICrafting)this.crafters.get(var1);
if (this.lastCookTime != this.chamber.chamberCookTime)
if (this.lastCookTime != this.chamber.machineCookTime)
{
var2.updateCraftingInventoryInfo(this, 0, this.chamber.chamberCookTime);
var2.updateCraftingInventoryInfo(this, 0, this.chamber.machineCookTime);
}
if (this.lastBurnTime != this.chamber.chamberBurnTime)
if (this.lastBurnTime != this.chamber.machineBurnTime)
{
var2.updateCraftingInventoryInfo(this, 1, this.chamber.chamberBurnTime);
var2.updateCraftingInventoryInfo(this, 1, this.chamber.machineBurnTime);
}
if (this.lastItemBurnTime != this.chamber.currentItemBurnTime)
@ -58,8 +58,8 @@ public class ContainerEnrichmentChamber extends Container
}
}
this.lastCookTime = this.chamber.chamberCookTime;
this.lastBurnTime = this.chamber.chamberBurnTime;
this.lastCookTime = this.chamber.machineCookTime;
this.lastBurnTime = this.chamber.machineBurnTime;
this.lastItemBurnTime = this.chamber.currentItemBurnTime;
}
@ -67,12 +67,12 @@ public class ContainerEnrichmentChamber extends Container
{
if (par1 == 0)
{
this.chamber.chamberCookTime = par2;
this.chamber.machineCookTime = par2;
}
if (par1 == 1)
{
this.chamber.chamberBurnTime = par2;
this.chamber.machineBurnTime = par2;
}
if (par1 == 2)

View file

@ -42,14 +42,14 @@ public class ContainerPlatinumCompressor extends Container
{
ICrafting var2 = (ICrafting)this.crafters.get(var1);
if (this.lastCookTime != this.compressor.compressorCookTime)
if (this.lastCookTime != this.compressor.machineCookTime)
{
var2.updateCraftingInventoryInfo(this, 0, this.compressor.compressorCookTime);
var2.updateCraftingInventoryInfo(this, 0, this.compressor.machineCookTime);
}
if (this.lastBurnTime != this.compressor.compressorBurnTime)
if (this.lastBurnTime != this.compressor.machineBurnTime)
{
var2.updateCraftingInventoryInfo(this, 1, this.compressor.compressorBurnTime);
var2.updateCraftingInventoryInfo(this, 1, this.compressor.machineBurnTime);
}
if (this.lastItemBurnTime != this.compressor.currentItemBurnTime)
@ -58,8 +58,8 @@ public class ContainerPlatinumCompressor extends Container
}
}
this.lastCookTime = this.compressor.compressorCookTime;
this.lastBurnTime = this.compressor.compressorBurnTime;
this.lastCookTime = this.compressor.machineCookTime;
this.lastBurnTime = this.compressor.machineBurnTime;
this.lastItemBurnTime = this.compressor.currentItemBurnTime;
}
@ -67,12 +67,12 @@ public class ContainerPlatinumCompressor extends Container
{
if (par1 == 0)
{
this.compressor.compressorCookTime = par2;
this.compressor.machineCookTime = par2;
}
if (par1 == 1)
{
this.compressor.compressorBurnTime = par2;
this.compressor.machineBurnTime = par2;
}
if (par1 == 2)

View file

@ -42,14 +42,14 @@ public class ContainerTheoreticalElementizer extends Container
{
ICrafting var2 = (ICrafting)this.crafters.get(var1);
if (this.lastCookTime != this.elementizer.elementizerCookTime)
if (this.lastCookTime != this.elementizer.machineCookTime)
{
var2.updateCraftingInventoryInfo(this, 0, this.elementizer.elementizerCookTime);
var2.updateCraftingInventoryInfo(this, 0, this.elementizer.machineCookTime);
}
if (this.lastBurnTime != this.elementizer.elementizerBurnTime)
if (this.lastBurnTime != this.elementizer.machineBurnTime)
{
var2.updateCraftingInventoryInfo(this, 1, this.elementizer.elementizerBurnTime);
var2.updateCraftingInventoryInfo(this, 1, this.elementizer.machineBurnTime);
}
if (this.lastItemBurnTime != this.elementizer.currentItemBurnTime)
@ -58,8 +58,8 @@ public class ContainerTheoreticalElementizer extends Container
}
}
this.lastCookTime = this.elementizer.elementizerCookTime;
this.lastBurnTime = this.elementizer.elementizerBurnTime;
this.lastCookTime = this.elementizer.machineCookTime;
this.lastBurnTime = this.elementizer.machineBurnTime;
this.lastItemBurnTime = this.elementizer.currentItemBurnTime;
}
@ -67,12 +67,12 @@ public class ContainerTheoreticalElementizer extends Container
{
if (par1 == 0)
{
this.elementizer.elementizerCookTime = par2;
this.elementizer.machineCookTime = par2;
}
if (par1 == 1)
{
this.elementizer.elementizerBurnTime = par2;
this.elementizer.machineBurnTime = par2;
}
if (par1 == 2)

View file

@ -31,7 +31,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
* @author AidanBrady
*
*/
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.0")
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.0.1")
@NetworkMod(channels = { "ObsidianIngots" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class ObsidianIngots
{
@ -50,7 +50,7 @@ public class ObsidianIngots
public static ObsidianHooks hooks;
//Initial Declarations
public static Version versionNumber = new Version(4, 0, 0);
public static Version versionNumber = new Version(4, 0, 1);
public static String latestVersionNumber;
public static String recentNews;
public static String hostIP = "71.56.58.57";

View file

@ -132,11 +132,11 @@ public class ObsidianUtils
/**
* Checks if the game is running on multiplayer.
* @return - if world is multiplayer
* @return if world is multiplayer
*/
public static boolean isMultiplayer()
{
if(!FMLServerHandler.instance().getServer().isSinglePlayer())
if(!FMLClientHandler.instance().getClient().isSingleplayer())
{
return true;
}
@ -147,7 +147,7 @@ public class ObsidianUtils
/**
* Checks if the mod is running on the latest version.
* @return - if mod is latest version
* @return if mod is latest version
*/
public static boolean isClientLatestVersion()
{
@ -162,7 +162,7 @@ public class ObsidianUtils
/**
* Checks if Minecraft is running in offline mode.
* @return - if mod is running in offline mode.
* @return if mod is running in offline mode.
*/
public static boolean isOffline()
{

View file

@ -34,21 +34,21 @@ public class PacketHandler implements IPacketHandler
if(packetData == 1)
{
System.out.println("[ObsidianIngots] Received '1' packet from " + entityplayer.username + ".");
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 1);
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 6);
entityplayer.inventory.getCurrentItem().damageItem(4999, entityplayer);
}
if(packetData == 2)
{
System.out.println("[ObsidianIngots] Received '2' packet from " + entityplayer.username + ".");
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 2);
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 12);
entityplayer.inventory.getCurrentItem().damageItem(4999, entityplayer);
}
if(packetData == 3)
{
System.out.println("[ObsidianIngots] Received '3' packet from " + entityplayer.username + ".");
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 3);
ObsidianUtils.setHourForward(ModLoader.getMinecraftServerInstance().worldServerForDimension(0), 18);
entityplayer.inventory.getCurrentItem().damageItem(4999, entityplayer);
}
if(packetData == 5)

View file

@ -1,7 +1,5 @@
package net.uberkat.obsidian.common;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import net.minecraft.src.*;
@ -11,10 +9,10 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] combinerItemStacks = new ItemStack[3];
private ItemStack[] machineItemStacks = new ItemStack[3];
/** The number of ticks that the furnace will keep burning */
public int combinerBurnTime = 0;
public int machineBurnTime = 0;
/**
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
@ -22,14 +20,14 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
public int currentItemBurnTime = 0;
/** The number of ticks that the current item has been cooking for */
public int combinerCookTime = 0;
public int machineCookTime = 0;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.combinerItemStacks.length;
return this.machineItemStacks.length;
}
/**
@ -37,7 +35,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public ItemStack getStackInSlot(int par1)
{
return this.combinerItemStacks[par1];
return this.machineItemStacks[par1];
}
/**
@ -46,23 +44,23 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public ItemStack decrStackSize(int par1, int par2)
{
if (this.combinerItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var3;
if (this.combinerItemStacks[par1].stackSize <= par2)
if (this.machineItemStacks[par1].stackSize <= par2)
{
var3 = this.combinerItemStacks[par1];
this.combinerItemStacks[par1] = null;
var3 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.combinerItemStacks[par1].splitStack(par2);
var3 = this.machineItemStacks[par1].splitStack(par2);
if (this.combinerItemStacks[par1].stackSize == 0)
if (this.machineItemStacks[par1].stackSize == 0)
{
this.combinerItemStacks[par1] = null;
this.machineItemStacks[par1] = null;
}
return var3;
@ -80,10 +78,10 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.combinerItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var2 = this.combinerItemStacks[par1];
this.combinerItemStacks[par1] = null;
ItemStack var2 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var2;
}
else
@ -97,7 +95,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.combinerItemStacks[par1] = par2ItemStack;
this.machineItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
@ -120,22 +118,22 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.combinerItemStacks = new ItemStack[this.getSizeInventory()];
this.machineItemStacks = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.combinerItemStacks.length)
if (var5 >= 0 && var5 < this.machineItemStacks.length)
{
this.combinerItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
this.machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.combinerBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.combinerCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.combinerItemStacks[1]);
this.machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.machineCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.machineItemStacks[1]);
}
/**
@ -144,17 +142,17 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.combinerBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.combinerCookTime);
par1NBTTagCompound.setShort("BurnTime", (short)this.machineBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.machineCookTime);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.combinerItemStacks.length; ++var3)
for (int var3 = 0; var3 < this.machineItemStacks.length; ++var3)
{
if (this.combinerItemStacks[var3] != null)
if (this.machineItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.combinerItemStacks[var3].writeToNBT(var4);
this.machineItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
@ -177,7 +175,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public int getCookProgressScaled(int par1)
{
return this.combinerCookTime * par1 / 200;
return this.machineCookTime * par1 / 200;
}
/**
@ -191,7 +189,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
this.currentItemBurnTime = 200;
}
return this.combinerBurnTime * par1 / this.currentItemBurnTime;
return this.machineBurnTime * par1 / this.currentItemBurnTime;
}
/**
@ -199,7 +197,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public boolean isBurning()
{
return this.combinerBurnTime > 0;
return this.machineBurnTime > 0;
}
/**
@ -208,31 +206,31 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
public void updateEntity()
{
boolean var1 = this.combinerBurnTime > 0;
boolean var1 = this.machineBurnTime > 0;
boolean var2 = false;
if (this.combinerBurnTime > 0)
if (this.machineBurnTime > 0)
{
--this.combinerBurnTime;
--this.machineBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.combinerBurnTime == 0 && this.canSmelt())
if (this.machineBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.combinerBurnTime = getItemBurnTime(this.combinerItemStacks[1]);
this.currentItemBurnTime = this.machineBurnTime = getItemBurnTime(this.machineItemStacks[1]);
if (this.combinerBurnTime > 0)
if (this.machineBurnTime > 0)
{
var2 = true;
if (this.combinerItemStacks[1] != null)
if (this.machineItemStacks[1] != null)
{
--this.combinerItemStacks[1].stackSize;
--this.machineItemStacks[1].stackSize;
if (this.combinerItemStacks[1].stackSize == 0)
if (this.machineItemStacks[1].stackSize == 0)
{
this.combinerItemStacks[1] = null;
this.machineItemStacks[1] = null;
}
}
}
@ -240,24 +238,24 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
if (this.isBurning() && this.canSmelt())
{
++this.combinerCookTime;
++this.machineCookTime;
if (this.combinerCookTime == 200)
if (this.machineCookTime == 200)
{
this.combinerCookTime = 0;
this.machineCookTime = 0;
this.smeltItem();
var2 = true;
}
}
else
{
this.combinerCookTime = 0;
this.machineCookTime = 0;
}
if (var1 != this.combinerBurnTime > 0)
if (var1 != this.machineBurnTime > 0)
{
var2 = true;
BlockCombiner.updateCombinerBlockState(this.combinerBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
BlockCombiner.updateBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
@ -265,6 +263,7 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
{
this.onInventoryChanged();
}
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
/**
@ -272,17 +271,17 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
*/
private boolean canSmelt()
{
if (this.combinerItemStacks[0] == null)
if (this.machineItemStacks[0] == null)
{
return false;
}
else
{
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(this.combinerItemStacks[0]);
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (var1 == null) return false;
if (this.combinerItemStacks[2] == null) return true;
if (!this.combinerItemStacks[2].isItemEqual(var1)) return false;
int result = combinerItemStacks[2].stackSize + var1.stackSize;
if (this.machineItemStacks[2] == null) return true;
if (!this.machineItemStacks[2].isItemEqual(var1)) return false;
int result = machineItemStacks[2].stackSize + var1.stackSize;
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@ -294,13 +293,13 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
{
if (this.canSmelt())
{
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(this.combinerItemStacks[0]);
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (this.combinerItemStacks[2] == null)
if (this.machineItemStacks[2] == null)
{
this.combinerItemStacks[2] = var1.copy();
this.machineItemStacks[2] = var1.copy();
}
else if (this.combinerItemStacks[2].isItemEqual(var1))
else if (this.machineItemStacks[2].isItemEqual(var1))
{
//==========================================================
//Adding extra importance here, so this really small bug
@ -311,15 +310,15 @@ public class TileEntityCombiner extends TileEntity implements IInventory, ISided
//
//
//
this.combinerItemStacks[2].stackSize += var1.stackSize;
this.machineItemStacks[2].stackSize += var1.stackSize;
//==========================================================
}
--this.combinerItemStacks[0].stackSize;
--this.machineItemStacks[0].stackSize;
if (this.combinerItemStacks[0].stackSize <= 0)
if (this.machineItemStacks[0].stackSize <= 0)
{
this.combinerItemStacks[0] = null;
this.machineItemStacks[0] = null;
}
}
}

View file

@ -1,7 +1,5 @@
package net.uberkat.obsidian.common;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import net.minecraft.src.*;
@ -11,10 +9,10 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] crusherItemStacks = new ItemStack[3];
private ItemStack[] machineItemStacks = new ItemStack[3];
/** The number of ticks that the furnace will keep burning */
public int crusherBurnTime = 0;
public int machineBurnTime = 0;
/**
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
@ -22,14 +20,14 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
public int currentItemBurnTime = 0;
/** The number of ticks that the current item has been cooking for */
public int crusherCookTime = 0;
public int machineCookTime = 0;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.crusherItemStacks.length;
return this.machineItemStacks.length;
}
/**
@ -37,7 +35,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public ItemStack getStackInSlot(int par1)
{
return this.crusherItemStacks[par1];
return this.machineItemStacks[par1];
}
/**
@ -46,23 +44,23 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public ItemStack decrStackSize(int par1, int par2)
{
if (this.crusherItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var3;
if (this.crusherItemStacks[par1].stackSize <= par2)
if (this.machineItemStacks[par1].stackSize <= par2)
{
var3 = this.crusherItemStacks[par1];
this.crusherItemStacks[par1] = null;
var3 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.crusherItemStacks[par1].splitStack(par2);
var3 = this.machineItemStacks[par1].splitStack(par2);
if (this.crusherItemStacks[par1].stackSize == 0)
if (this.machineItemStacks[par1].stackSize == 0)
{
this.crusherItemStacks[par1] = null;
this.machineItemStacks[par1] = null;
}
return var3;
@ -80,10 +78,10 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.crusherItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var2 = this.crusherItemStacks[par1];
this.crusherItemStacks[par1] = null;
ItemStack var2 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var2;
}
else
@ -97,7 +95,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.crusherItemStacks[par1] = par2ItemStack;
this.machineItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
@ -120,22 +118,22 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.crusherItemStacks = new ItemStack[this.getSizeInventory()];
this.machineItemStacks = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.crusherItemStacks.length)
if (var5 >= 0 && var5 < this.machineItemStacks.length)
{
this.crusherItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
this.machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.crusherBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.crusherCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.crusherItemStacks[1]);
this.machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.machineCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.machineItemStacks[1]);
}
/**
@ -144,17 +142,17 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.crusherBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.crusherCookTime);
par1NBTTagCompound.setShort("BurnTime", (short)this.machineBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.machineCookTime);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.crusherItemStacks.length; ++var3)
for (int var3 = 0; var3 < this.machineItemStacks.length; ++var3)
{
if (this.crusherItemStacks[var3] != null)
if (this.machineItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.crusherItemStacks[var3].writeToNBT(var4);
this.machineItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
@ -177,7 +175,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public int getCookProgressScaled(int par1)
{
return this.crusherCookTime * par1 / 200;
return this.machineCookTime * par1 / 200;
}
/**
@ -191,7 +189,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
this.currentItemBurnTime = 200;
}
return this.crusherBurnTime * par1 / this.currentItemBurnTime;
return this.machineBurnTime * par1 / this.currentItemBurnTime;
}
/**
@ -199,7 +197,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public boolean isBurning()
{
return this.crusherBurnTime > 0;
return this.machineBurnTime > 0;
}
/**
@ -208,31 +206,31 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
public void updateEntity()
{
boolean var1 = this.crusherBurnTime > 0;
boolean var1 = this.machineBurnTime > 0;
boolean var2 = false;
if (this.crusherBurnTime > 0)
if (this.machineBurnTime > 0)
{
--this.crusherBurnTime;
--this.machineBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.crusherBurnTime == 0 && this.canSmelt())
if (this.machineBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.crusherBurnTime = getItemBurnTime(this.crusherItemStacks[1]);
this.currentItemBurnTime = this.machineBurnTime = getItemBurnTime(this.machineItemStacks[1]);
if (this.crusherBurnTime > 0)
if (this.machineBurnTime > 0)
{
var2 = true;
if (this.crusherItemStacks[1] != null)
if (this.machineItemStacks[1] != null)
{
--this.crusherItemStacks[1].stackSize;
--this.machineItemStacks[1].stackSize;
if (this.crusherItemStacks[1].stackSize == 0)
if (this.machineItemStacks[1].stackSize == 0)
{
this.crusherItemStacks[1] = null;
this.machineItemStacks[1] = null;
}
}
}
@ -240,24 +238,24 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
if (this.isBurning() && this.canSmelt())
{
++this.crusherCookTime;
++this.machineCookTime;
if (this.crusherCookTime == 200)
if (this.machineCookTime == 200)
{
this.crusherCookTime = 0;
this.machineCookTime = 0;
this.smeltItem();
var2 = true;
}
}
else
{
this.crusherCookTime = 0;
this.machineCookTime = 0;
}
if (var1 != this.crusherBurnTime > 0)
if (var1 != this.machineBurnTime > 0)
{
var2 = true;
BlockCrusher.updateCrusherBlockState(this.crusherBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
BlockCrusher.updateBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
@ -265,6 +263,7 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
{
this.onInventoryChanged();
}
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
/**
@ -272,17 +271,17 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
*/
private boolean canSmelt()
{
if (this.crusherItemStacks[0] == null)
if (this.machineItemStacks[0] == null)
{
return false;
}
else
{
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(this.crusherItemStacks[0]);
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (var1 == null) return false;
if (this.crusherItemStacks[2] == null) return true;
if (!this.crusherItemStacks[2].isItemEqual(var1)) return false;
int result = crusherItemStacks[2].stackSize + var1.stackSize;
if (this.machineItemStacks[2] == null) return true;
if (!this.machineItemStacks[2].isItemEqual(var1)) return false;
int result = machineItemStacks[2].stackSize + var1.stackSize;
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@ -294,13 +293,13 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
{
if (this.canSmelt())
{
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(this.crusherItemStacks[0]);
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (this.crusherItemStacks[2] == null)
if (this.machineItemStacks[2] == null)
{
this.crusherItemStacks[2] = var1.copy();
this.machineItemStacks[2] = var1.copy();
}
else if (this.crusherItemStacks[2].isItemEqual(var1))
else if (this.machineItemStacks[2].isItemEqual(var1))
{
//==========================================================
//Adding extra importance here, so this really small bug
@ -311,15 +310,15 @@ public class TileEntityCrusher extends TileEntity implements IInventory, ISidedI
//
//
//
this.crusherItemStacks[2].stackSize += var1.stackSize;
this.machineItemStacks[2].stackSize += var1.stackSize;
//==========================================================
}
--this.crusherItemStacks[0].stackSize;
--this.machineItemStacks[0].stackSize;
if (this.crusherItemStacks[0].stackSize <= 0)
if (this.machineItemStacks[0].stackSize <= 0)
{
this.crusherItemStacks[0] = null;
this.machineItemStacks[0] = null;
}
}
}

View file

@ -11,10 +11,10 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] chamberItemStacks = new ItemStack[3];
private ItemStack[] machineItemStacks = new ItemStack[3];
/** The number of ticks that the furnace will keep burning */
public int chamberBurnTime = 0;
public int machineBurnTime = 0;
/**
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
@ -22,14 +22,14 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
public int currentItemBurnTime = 0;
/** The number of ticks that the current item has been cooking for */
public int chamberCookTime = 0;
public int machineCookTime = 0;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.chamberItemStacks.length;
return this.machineItemStacks.length;
}
/**
@ -37,7 +37,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public ItemStack getStackInSlot(int par1)
{
return this.chamberItemStacks[par1];
return this.machineItemStacks[par1];
}
/**
@ -46,23 +46,23 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public ItemStack decrStackSize(int par1, int par2)
{
if (this.chamberItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var3;
if (this.chamberItemStacks[par1].stackSize <= par2)
if (this.machineItemStacks[par1].stackSize <= par2)
{
var3 = this.chamberItemStacks[par1];
this.chamberItemStacks[par1] = null;
var3 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.chamberItemStacks[par1].splitStack(par2);
var3 = this.machineItemStacks[par1].splitStack(par2);
if (this.chamberItemStacks[par1].stackSize == 0)
if (this.machineItemStacks[par1].stackSize == 0)
{
this.chamberItemStacks[par1] = null;
this.machineItemStacks[par1] = null;
}
return var3;
@ -80,10 +80,10 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.chamberItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var2 = this.chamberItemStacks[par1];
this.chamberItemStacks[par1] = null;
ItemStack var2 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var2;
}
else
@ -97,7 +97,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.chamberItemStacks[par1] = par2ItemStack;
this.machineItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
@ -120,22 +120,22 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.chamberItemStacks = new ItemStack[this.getSizeInventory()];
this.machineItemStacks = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.chamberItemStacks.length)
if (var5 >= 0 && var5 < this.machineItemStacks.length)
{
this.chamberItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
this.machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.chamberBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.chamberCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.chamberItemStacks[1]);
this.machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.machineCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.machineItemStacks[1]);
}
/**
@ -144,17 +144,17 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.chamberBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.chamberCookTime);
par1NBTTagCompound.setShort("BurnTime", (short)this.machineBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.machineCookTime);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.chamberItemStacks.length; ++var3)
for (int var3 = 0; var3 < this.machineItemStacks.length; ++var3)
{
if (this.chamberItemStacks[var3] != null)
if (this.machineItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.chamberItemStacks[var3].writeToNBT(var4);
this.machineItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
@ -177,7 +177,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public int getCookProgressScaled(int par1)
{
return this.chamberCookTime * par1 / 200;
return this.machineCookTime * par1 / 200;
}
/**
@ -191,7 +191,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
this.currentItemBurnTime = 200;
}
return this.chamberBurnTime * par1 / this.currentItemBurnTime;
return this.machineBurnTime * par1 / this.currentItemBurnTime;
}
/**
@ -199,7 +199,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public boolean isBurning()
{
return this.chamberBurnTime > 0;
return this.machineBurnTime > 0;
}
/**
@ -208,31 +208,31 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
public void updateEntity()
{
boolean var1 = this.chamberBurnTime > 0;
boolean var1 = this.machineBurnTime > 0;
boolean var2 = false;
if (this.chamberBurnTime > 0)
if (this.machineBurnTime > 0)
{
--this.chamberBurnTime;
--this.machineBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.chamberBurnTime == 0 && this.canSmelt())
if (this.machineBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.chamberBurnTime = getItemBurnTime(this.chamberItemStacks[1]);
this.currentItemBurnTime = this.machineBurnTime = getItemBurnTime(this.machineItemStacks[1]);
if (this.chamberBurnTime > 0)
if (this.machineBurnTime > 0)
{
var2 = true;
if (this.chamberItemStacks[1] != null)
if (this.machineItemStacks[1] != null)
{
--this.chamberItemStacks[1].stackSize;
--this.machineItemStacks[1].stackSize;
if (this.chamberItemStacks[1].stackSize == 0)
if (this.machineItemStacks[1].stackSize == 0)
{
this.chamberItemStacks[1] = null;
this.machineItemStacks[1] = null;
}
}
}
@ -240,24 +240,24 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
if (this.isBurning() && this.canSmelt())
{
++this.chamberCookTime;
++this.machineCookTime;
if (this.chamberCookTime == 200)
if (this.machineCookTime == 200)
{
this.chamberCookTime = 0;
this.machineCookTime = 0;
this.smeltItem();
var2 = true;
}
}
else
{
this.chamberCookTime = 0;
this.machineCookTime = 0;
}
if (var1 != this.chamberBurnTime > 0)
if (var1 != this.machineBurnTime > 0)
{
var2 = true;
BlockEnrichmentChamber.updateChamberBlockState(this.chamberBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
BlockEnrichmentChamber.updateBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
@ -265,6 +265,7 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
{
this.onInventoryChanged();
}
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
/**
@ -272,17 +273,17 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
*/
private boolean canSmelt()
{
if (this.chamberItemStacks[0] == null)
if (this.machineItemStacks[0] == null)
{
return false;
}
else
{
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(this.chamberItemStacks[0]);
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (var1 == null) return false;
if (this.chamberItemStacks[2] == null) return true;
if (!this.chamberItemStacks[2].isItemEqual(var1)) return false;
int result = chamberItemStacks[2].stackSize + var1.stackSize;
if (this.machineItemStacks[2] == null) return true;
if (!this.machineItemStacks[2].isItemEqual(var1)) return false;
int result = machineItemStacks[2].stackSize + var1.stackSize;
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@ -294,13 +295,13 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
{
if (this.canSmelt())
{
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(this.chamberItemStacks[0]);
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (this.chamberItemStacks[2] == null)
if (this.machineItemStacks[2] == null)
{
this.chamberItemStacks[2] = var1.copy();
this.machineItemStacks[2] = var1.copy();
}
else if (this.chamberItemStacks[2].isItemEqual(var1))
else if (this.machineItemStacks[2].isItemEqual(var1))
{
//==========================================================
//Adding extra importance here, so this really small bug
@ -311,15 +312,15 @@ public class TileEntityEnrichmentChamber extends TileEntity implements IInventor
//
//
//
this.chamberItemStacks[2].stackSize += var1.stackSize;
this.machineItemStacks[2].stackSize += var1.stackSize;
//==========================================================
}
--this.chamberItemStacks[0].stackSize;
--this.machineItemStacks[0].stackSize;
if (this.chamberItemStacks[0].stackSize <= 0)
if (this.machineItemStacks[0].stackSize <= 0)
{
this.chamberItemStacks[0] = null;
this.machineItemStacks[0] = null;
}
}
}

View file

@ -11,10 +11,10 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] compressorItemStacks = new ItemStack[3];
private ItemStack[] machineItemStacks = new ItemStack[3];
/** The number of ticks that the furnace will keep burning */
public int compressorBurnTime = 0;
public int machineBurnTime = 0;
/**
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
@ -22,14 +22,14 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
public int currentItemBurnTime = 0;
/** The number of ticks that the current item has been cooking for */
public int compressorCookTime = 0;
public int machineCookTime = 0;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.compressorItemStacks.length;
return this.machineItemStacks.length;
}
/**
@ -37,7 +37,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public ItemStack getStackInSlot(int par1)
{
return this.compressorItemStacks[par1];
return this.machineItemStacks[par1];
}
/**
@ -46,23 +46,23 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public ItemStack decrStackSize(int par1, int par2)
{
if (this.compressorItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var3;
if (this.compressorItemStacks[par1].stackSize <= par2)
if (this.machineItemStacks[par1].stackSize <= par2)
{
var3 = this.compressorItemStacks[par1];
this.compressorItemStacks[par1] = null;
var3 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.compressorItemStacks[par1].splitStack(par2);
var3 = this.machineItemStacks[par1].splitStack(par2);
if (this.compressorItemStacks[par1].stackSize == 0)
if (this.machineItemStacks[par1].stackSize == 0)
{
this.compressorItemStacks[par1] = null;
this.machineItemStacks[par1] = null;
}
return var3;
@ -80,10 +80,10 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.compressorItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var2 = this.compressorItemStacks[par1];
this.compressorItemStacks[par1] = null;
ItemStack var2 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var2;
}
else
@ -97,7 +97,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.compressorItemStacks[par1] = par2ItemStack;
this.machineItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
@ -120,22 +120,22 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.compressorItemStacks = new ItemStack[this.getSizeInventory()];
this.machineItemStacks = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.compressorItemStacks.length)
if (var5 >= 0 && var5 < this.machineItemStacks.length)
{
this.compressorItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
this.machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.compressorBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.compressorCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.compressorItemStacks[1]);
this.machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.machineCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.machineItemStacks[1]);
}
/**
@ -144,17 +144,17 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.compressorBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.compressorCookTime);
par1NBTTagCompound.setShort("BurnTime", (short)this.machineBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.machineCookTime);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.compressorItemStacks.length; ++var3)
for (int var3 = 0; var3 < this.machineItemStacks.length; ++var3)
{
if (this.compressorItemStacks[var3] != null)
if (this.machineItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.compressorItemStacks[var3].writeToNBT(var4);
this.machineItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
@ -177,7 +177,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public int getCookProgressScaled(int par1)
{
return this.compressorCookTime * par1 / 200;
return this.machineCookTime * par1 / 200;
}
/**
@ -191,7 +191,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
this.currentItemBurnTime = 200;
}
return this.compressorBurnTime * par1 / this.currentItemBurnTime;
return this.machineBurnTime * par1 / this.currentItemBurnTime;
}
/**
@ -199,7 +199,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public boolean isBurning()
{
return this.compressorBurnTime > 0;
return this.machineBurnTime > 0;
}
/**
@ -208,31 +208,31 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
public void updateEntity()
{
boolean var1 = this.compressorBurnTime > 0;
boolean var1 = this.machineBurnTime > 0;
boolean var2 = false;
if (this.compressorBurnTime > 0)
if (this.machineBurnTime > 0)
{
--this.compressorBurnTime;
--this.machineBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.compressorBurnTime == 0 && this.canSmelt())
if (this.machineBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.compressorBurnTime = getItemBurnTime(this.compressorItemStacks[1]);
this.currentItemBurnTime = this.machineBurnTime = getItemBurnTime(this.machineItemStacks[1]);
if (this.compressorBurnTime > 0)
if (this.machineBurnTime > 0)
{
var2 = true;
if (this.compressorItemStacks[1] != null)
if (this.machineItemStacks[1] != null)
{
--this.compressorItemStacks[1].stackSize;
--this.machineItemStacks[1].stackSize;
if (this.compressorItemStacks[1].stackSize == 0)
if (this.machineItemStacks[1].stackSize == 0)
{
this.compressorItemStacks[1] = null;
this.machineItemStacks[1] = null;
}
}
}
@ -240,24 +240,24 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
if (this.isBurning() && this.canSmelt())
{
++this.compressorCookTime;
++this.machineCookTime;
if (this.compressorCookTime == 200)
if (this.machineCookTime == 200)
{
this.compressorCookTime = 0;
this.machineCookTime = 0;
this.smeltItem();
var2 = true;
}
}
else
{
this.compressorCookTime = 0;
this.machineCookTime = 0;
}
if (var1 != this.compressorBurnTime > 0)
if (var1 != this.machineBurnTime > 0)
{
var2 = true;
BlockPlatinumCompressor.updateCompressorBlockState(this.compressorBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
BlockPlatinumCompressor.updateBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
@ -265,6 +265,7 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
{
this.onInventoryChanged();
}
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
/**
@ -272,17 +273,17 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
*/
private boolean canSmelt()
{
if (this.compressorItemStacks[0] == null)
if (this.machineItemStacks[0] == null)
{
return false;
}
else
{
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(this.compressorItemStacks[0]);
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (var1 == null) return false;
if (this.compressorItemStacks[2] == null) return true;
if (!this.compressorItemStacks[2].isItemEqual(var1)) return false;
int result = compressorItemStacks[2].stackSize + var1.stackSize;
if (this.machineItemStacks[2] == null) return true;
if (!this.machineItemStacks[2].isItemEqual(var1)) return false;
int result = machineItemStacks[2].stackSize + var1.stackSize;
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@ -294,13 +295,13 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
{
if (this.canSmelt())
{
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(this.compressorItemStacks[0]);
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(this.machineItemStacks[0]);
if (this.compressorItemStacks[2] == null)
if (this.machineItemStacks[2] == null)
{
this.compressorItemStacks[2] = var1.copy();
this.machineItemStacks[2] = var1.copy();
}
else if (this.compressorItemStacks[2].isItemEqual(var1))
else if (this.machineItemStacks[2].isItemEqual(var1))
{
//==========================================================
//Adding extra importance here, so this really small bug
@ -311,15 +312,15 @@ public class TileEntityPlatinumCompressor extends TileEntity implements IInvento
//
//
//
this.compressorItemStacks[2].stackSize += var1.stackSize;
this.machineItemStacks[2].stackSize += var1.stackSize;
//==========================================================
}
--this.compressorItemStacks[0].stackSize;
--this.machineItemStacks[0].stackSize;
if (this.compressorItemStacks[0].stackSize <= 0)
if (this.machineItemStacks[0].stackSize <= 0)
{
this.compressorItemStacks[0] = null;
this.machineItemStacks[0] = null;
}
}
}

View file

@ -4,7 +4,6 @@ import java.util.Random;
import net.minecraftforge.common.ISidedInventory;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@ -15,10 +14,10 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] elementizerItemStacks = new ItemStack[3];
private ItemStack[] machineItemStacks = new ItemStack[3];
/** The number of ticks that the furnace will keep burning */
public int elementizerBurnTime = 0;
public int machineBurnTime = 0;
/**
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
@ -26,14 +25,14 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
public int currentItemBurnTime = 0;
/** The number of ticks that the current item has been cooking for */
public int elementizerCookTime = 0;
public int machineCookTime = 0;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.elementizerItemStacks.length;
return this.machineItemStacks.length;
}
/**
@ -41,7 +40,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public ItemStack getStackInSlot(int par1)
{
return this.elementizerItemStacks[par1];
return this.machineItemStacks[par1];
}
/**
@ -50,23 +49,23 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public ItemStack decrStackSize(int par1, int par2)
{
if (this.elementizerItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var3;
if (this.elementizerItemStacks[par1].stackSize <= par2)
if (this.machineItemStacks[par1].stackSize <= par2)
{
var3 = this.elementizerItemStacks[par1];
this.elementizerItemStacks[par1] = null;
var3 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.elementizerItemStacks[par1].splitStack(par2);
var3 = this.machineItemStacks[par1].splitStack(par2);
if (this.elementizerItemStacks[par1].stackSize == 0)
if (this.machineItemStacks[par1].stackSize == 0)
{
this.elementizerItemStacks[par1] = null;
this.machineItemStacks[par1] = null;
}
return var3;
@ -84,10 +83,10 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.elementizerItemStacks[par1] != null)
if (this.machineItemStacks[par1] != null)
{
ItemStack var2 = this.elementizerItemStacks[par1];
this.elementizerItemStacks[par1] = null;
ItemStack var2 = this.machineItemStacks[par1];
this.machineItemStacks[par1] = null;
return var2;
}
else
@ -101,7 +100,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.elementizerItemStacks[par1] = par2ItemStack;
this.machineItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
@ -124,22 +123,22 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.elementizerItemStacks = new ItemStack[this.getSizeInventory()];
this.machineItemStacks = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.elementizerItemStacks.length)
if (var5 >= 0 && var5 < this.machineItemStacks.length)
{
this.elementizerItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
this.machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.elementizerBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.elementizerCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.elementizerItemStacks[1]);
this.machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.machineCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getItemBurnTime(this.machineItemStacks[1]);
}
/**
@ -148,17 +147,17 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.elementizerBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.elementizerCookTime);
par1NBTTagCompound.setShort("BurnTime", (short)this.machineBurnTime);
par1NBTTagCompound.setShort("CookTime", (short)this.machineCookTime);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.elementizerItemStacks.length; ++var3)
for (int var3 = 0; var3 < this.machineItemStacks.length; ++var3)
{
if (this.elementizerItemStacks[var3] != null)
if (this.machineItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.elementizerItemStacks[var3].writeToNBT(var4);
this.machineItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
@ -183,7 +182,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public int getCookProgressScaled(int par1)
{
return this.elementizerCookTime * par1 / 1000;
return this.machineCookTime * par1 / 1000;
}
@SideOnly(Side.CLIENT)
@ -199,7 +198,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
this.currentItemBurnTime = 1000;
}
return this.elementizerBurnTime * par1 / this.currentItemBurnTime;
return this.machineBurnTime * par1 / this.currentItemBurnTime;
}
/**
@ -207,7 +206,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public boolean isBurning()
{
return this.elementizerBurnTime > 0;
return this.machineBurnTime > 0;
}
/**
@ -216,31 +215,31 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
public void updateEntity()
{
boolean var1 = this.elementizerBurnTime > 0;
boolean var1 = this.machineBurnTime > 0;
boolean var2 = false;
if (this.elementizerBurnTime > 0)
if (this.machineBurnTime > 0)
{
--this.elementizerBurnTime;
--this.machineBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.elementizerBurnTime == 0 && this.canSmelt())
if (this.machineBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.elementizerBurnTime = getItemBurnTime(this.elementizerItemStacks[1]);
this.currentItemBurnTime = this.machineBurnTime = getItemBurnTime(this.machineItemStacks[1]);
if (this.elementizerBurnTime > 0)
if (this.machineBurnTime > 0)
{
var2 = true;
if (this.elementizerItemStacks[1] != null)
if (this.machineItemStacks[1] != null)
{
--this.elementizerItemStacks[1].stackSize;
--this.machineItemStacks[1].stackSize;
if (this.elementizerItemStacks[1].stackSize == 0)
if (this.machineItemStacks[1].stackSize == 0)
{
this.elementizerItemStacks[1] = null;
this.machineItemStacks[1] = null;
}
}
}
@ -248,24 +247,24 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
if (this.isBurning() && this.canSmelt())
{
++this.elementizerCookTime;
++this.machineCookTime;
if (this.elementizerCookTime == 1000)
if (this.machineCookTime == 1000)
{
this.elementizerCookTime = 0;
this.machineCookTime = 0;
this.smeltItem();
var2 = true;
}
}
else
{
this.elementizerCookTime = 0;
this.machineCookTime = 0;
}
if (var1 != this.elementizerBurnTime > 0)
if (var1 != this.machineBurnTime > 0)
{
var2 = true;
BlockTheoreticalElementizer.updateElementizerBlockState(this.elementizerBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
BlockTheoreticalElementizer.updateBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
@ -273,6 +272,7 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
{
this.onInventoryChanged();
}
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
/**
@ -280,14 +280,14 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
*/
private boolean canSmelt()
{
if (this.elementizerItemStacks[0] == null)
if (this.machineItemStacks[0] == null)
{
return false;
}
else
{
if (elementizerItemStacks[0].getItem().shiftedIndex != ObsidianIngots.EnrichedAlloy.shiftedIndex) return false;
if (this.elementizerItemStacks[2] == null) return true;
if (machineItemStacks[0].getItem().shiftedIndex != ObsidianIngots.EnrichedAlloy.shiftedIndex) return false;
if (this.machineItemStacks[2] == null) return true;
}
return false;
}
@ -301,16 +301,16 @@ public class TileEntityTheoreticalElementizer extends TileEntity implements IInv
{
ItemStack itemstack = new ItemStack(getRandomMagicItem(), 1);
if (this.elementizerItemStacks[2] == null)
if (this.machineItemStacks[2] == null)
{
this.elementizerItemStacks[2] = itemstack.copy();
this.machineItemStacks[2] = itemstack.copy();
}
--this.elementizerItemStacks[0].stackSize;
--this.machineItemStacks[0].stackSize;
if (this.elementizerItemStacks[0].stackSize <= 0)
if (this.machineItemStacks[0].stackSize <= 0)
{
this.elementizerItemStacks[0] = null;
this.machineItemStacks[0] = null;
}
}
}

View file

@ -8,12 +8,12 @@ import net.uberkat.obsidian.common.TileEntityCombiner;
public class GuiCombiner extends GuiContainer
{
private TileEntityCombiner combinerInventory;
private TileEntityCombiner machineInventory;
public GuiCombiner(InventoryPlayer par1InventoryPlayer, TileEntityCombiner par2TileEntityCombiner)
{
super(new ContainerCombiner(par1InventoryPlayer, par2TileEntityCombiner));
combinerInventory = par2TileEntityCombiner;
machineInventory = par2TileEntityCombiner;
}
/**
@ -25,11 +25,6 @@ public class GuiCombiner extends GuiContainer
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
}
public void onGuiClosed()
{
BlockCombiner.updateCombinerBlockState(combinerInventory.combinerBurnTime > 0, combinerInventory.worldObj, combinerInventory.xCoord, combinerInventory.yCoord, combinerInventory.zCoord);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@ -43,13 +38,13 @@ public class GuiCombiner extends GuiContainer
drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
int var7;
if (this.combinerInventory.isBurning())
if (this.machineInventory.isBurning())
{
var7 = this.combinerInventory.getBurnTimeRemainingScaled(12);
var7 = this.machineInventory.getBurnTimeRemainingScaled(12);
this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
}
var7 = this.combinerInventory.getCookProgressScaled(24);
var7 = this.machineInventory.getCookProgressScaled(24);
this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16);
}
}

View file

@ -9,12 +9,12 @@ import net.uberkat.obsidian.common.TileEntityCrusher;
public class GuiCrusher extends GuiContainer
{
private TileEntityCrusher crusherInventory;
private TileEntityCrusher machineInventory;
public GuiCrusher(InventoryPlayer par1InventoryPlayer, TileEntityCrusher par2TileEntityCrusher)
{
super(new ContainerCrusher(par1InventoryPlayer, par2TileEntityCrusher));
crusherInventory = par2TileEntityCrusher;
machineInventory = par2TileEntityCrusher;
}
/**
@ -26,11 +26,6 @@ public class GuiCrusher extends GuiContainer
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
}
public void onGuiClosed()
{
BlockCrusher.updateCrusherBlockState(crusherInventory.crusherBurnTime > 0, crusherInventory.worldObj, crusherInventory.xCoord, crusherInventory.yCoord, crusherInventory.zCoord);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@ -44,13 +39,13 @@ public class GuiCrusher extends GuiContainer
drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
int var7;
if (this.crusherInventory.isBurning())
if (this.machineInventory.isBurning())
{
var7 = this.crusherInventory.getBurnTimeRemainingScaled(12);
var7 = this.machineInventory.getBurnTimeRemainingScaled(12);
this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
}
var7 = this.crusherInventory.getCookProgressScaled(24);
var7 = this.machineInventory.getCookProgressScaled(24);
this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16);
}
}

View file

@ -8,12 +8,12 @@ import net.uberkat.obsidian.common.TileEntityEnrichmentChamber;
public class GuiEnrichmentChamber extends GuiContainer
{
private TileEntityEnrichmentChamber chamberInventory;
private TileEntityEnrichmentChamber machineInventory;
public GuiEnrichmentChamber(InventoryPlayer par1InventoryPlayer, TileEntityEnrichmentChamber par2TileEntityEnrichmentChamber)
{
super(new ContainerEnrichmentChamber(par1InventoryPlayer, par2TileEntityEnrichmentChamber));
chamberInventory = par2TileEntityEnrichmentChamber;
machineInventory = par2TileEntityEnrichmentChamber;
}
/**
@ -25,11 +25,6 @@ public class GuiEnrichmentChamber extends GuiContainer
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
}
public void onGuiClosed()
{
BlockEnrichmentChamber.updateChamberBlockState(chamberInventory.chamberBurnTime > 0, chamberInventory.worldObj, chamberInventory.xCoord, chamberInventory.yCoord, chamberInventory.zCoord);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@ -43,13 +38,13 @@ public class GuiEnrichmentChamber extends GuiContainer
drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
int var7;
if (this.chamberInventory.isBurning())
if (this.machineInventory.isBurning())
{
var7 = this.chamberInventory.getBurnTimeRemainingScaled(12);
var7 = this.machineInventory.getBurnTimeRemainingScaled(12);
this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
}
var7 = this.chamberInventory.getCookProgressScaled(24);
var7 = this.machineInventory.getCookProgressScaled(24);
this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16);
}
}

View file

@ -8,12 +8,12 @@ import net.uberkat.obsidian.common.TileEntityPlatinumCompressor;
public class GuiPlatinumCompressor extends GuiContainer
{
private TileEntityPlatinumCompressor compressorInventory;
private TileEntityPlatinumCompressor machineInventory;
public GuiPlatinumCompressor(InventoryPlayer par1InventoryPlayer, TileEntityPlatinumCompressor par2TileEntityPlatinumCompressor)
{
super(new ContainerPlatinumCompressor(par1InventoryPlayer, par2TileEntityPlatinumCompressor));
compressorInventory = par2TileEntityPlatinumCompressor;
machineInventory = par2TileEntityPlatinumCompressor;
}
/**
@ -25,11 +25,6 @@ public class GuiPlatinumCompressor extends GuiContainer
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
}
public void onGuiClosed()
{
BlockPlatinumCompressor.updateCompressorBlockState(compressorInventory.compressorBurnTime > 0, compressorInventory.worldObj, compressorInventory.xCoord, compressorInventory.yCoord, compressorInventory.zCoord);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@ -43,13 +38,13 @@ public class GuiPlatinumCompressor extends GuiContainer
drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
int var7;
if (this.compressorInventory.isBurning())
if (this.machineInventory.isBurning())
{
var7 = this.compressorInventory.getBurnTimeRemainingScaled(12);
var7 = this.machineInventory.getBurnTimeRemainingScaled(12);
this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
}
var7 = this.compressorInventory.getCookProgressScaled(24);
var7 = this.machineInventory.getCookProgressScaled(24);
this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16);
}
}

View file

@ -58,64 +58,32 @@ public class GuiStopwatch extends GuiScreen {
{
if(guibutton.id == 1)
{
if(mc.isSingleplayer())
{
ObsidianUtils.setHourForward(player.worldObj, 0);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(0);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 2)
{
if(mc.isSingleplayer())
{
ObsidianUtils.setHourForward(player.worldObj, 6);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(1);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 3)
{
if(mc.isSingleplayer())
{
ObsidianUtils.setHourForward(player.worldObj, 12);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(2);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 4)
{
if(mc.isSingleplayer())
{
ObsidianUtils.setHourForward(player.worldObj, 18);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(3);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 5)
{
mc.displayGuiScreen(new GuiCredits());

View file

@ -8,12 +8,12 @@ import net.uberkat.obsidian.common.TileEntityTheoreticalElementizer;
public class GuiTheoreticalElementizer extends GuiContainer
{
private TileEntityTheoreticalElementizer elementizerInventory;
private TileEntityTheoreticalElementizer machineInventory;
public GuiTheoreticalElementizer(InventoryPlayer par1InventoryPlayer, TileEntityTheoreticalElementizer par2TileEntityTheoreticalElementizer)
{
super(new ContainerTheoreticalElementizer(par1InventoryPlayer, par2TileEntityTheoreticalElementizer));
elementizerInventory = par2TileEntityTheoreticalElementizer;
machineInventory = par2TileEntityTheoreticalElementizer;
}
/**
@ -25,11 +25,6 @@ public class GuiTheoreticalElementizer extends GuiContainer
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
}
public void onGuiClosed()
{
BlockTheoreticalElementizer.updateElementizerBlockState(elementizerInventory.elementizerBurnTime > 0, elementizerInventory.worldObj, elementizerInventory.xCoord, elementizerInventory.yCoord, elementizerInventory.zCoord);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@ -43,13 +38,13 @@ public class GuiTheoreticalElementizer extends GuiContainer
drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
int var7;
if (this.elementizerInventory.isBurning())
if (this.machineInventory.isBurning())
{
var7 = this.elementizerInventory.getBurnTimeRemainingScaled(12);
var7 = this.machineInventory.getBurnTimeRemainingScaled(12);
this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
}
var7 = this.elementizerInventory.getCookProgressScaled(24);
var7 = this.machineInventory.getCookProgressScaled(24);
this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16);
}
}

View file

@ -20,8 +20,8 @@ public class GuiWeatherOrb extends GuiScreen {
{
controlList.clear();
controlList.add(new GuiButton(1, width / 2 - 80, height / 2 - 65, 50, 20, "Clear"));
controlList.add(new GuiButton(2, width / 2 - 80, height / 2 - 35, 50, 20, "Storm/Rain"));
controlList.add(new GuiButton(3, width / 2 + 5, height / 2 - 65, 50, 20, "Storm"));
controlList.add(new GuiButton(2, width / 2 - 80, height / 2 - 35, 50, 20, "Storm"));
controlList.add(new GuiButton(3, width / 2 + 5, height / 2 - 65, 50, 20, "Haze"));
controlList.add(new GuiButton(4, width / 2 + 5, height / 2 - 35, 50, 20, "Rain"));
controlList.add(new GuiButton(5, width / 2 - 94, height / 2 + 30, 80, 20, "Credits"));
controlList.add(new GuiButton(6, width / 2 - 10, height / 2 + 30, 80, 20, "Close"));
@ -58,69 +58,32 @@ public class GuiWeatherOrb extends GuiScreen {
{
if(guibutton.id == 1)
{
if(mc.isSingleplayer())
{
player.worldObj.getWorldInfo().setRaining(false);
player.worldObj.getWorldInfo().setThundering(false);
player.worldObj.setRainStrength(0.0F);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(5);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 2)
{
if(mc.isSingleplayer())
{
player.worldObj.getWorldInfo().setRaining(true);
player.worldObj.getWorldInfo().setThundering(true);
player.worldObj.setRainStrength(1.0F);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(6);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 3)
{
if(mc.isSingleplayer())
{
player.worldObj.getWorldInfo().setThundering(true);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(7);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 4)
{
if(mc.isSingleplayer())
{
player.worldObj.getWorldInfo().setRaining(true);
player.worldObj.setRainStrength(1.0F);
player.inventory.getCurrentItem().damageItem(4999, player);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
else {
ObsidianUtils.sendPacketDataInt(8);
ObsidianUtils.doExplosion(player);
mc.displayGuiScreen(null);
}
}
if(guibutton.id == 5)
{
mc.displayGuiScreen(new GuiCredits());