v4.1 Beta
*Merged all machines into a single class. *Merged all machines to use a single block ID. *Set up a new machine recipe system to take in 2 itemstacks instead of 1 int and 1 itemstack. *Updated machine field names. *Removed old block classes, including BlockCombiner, BlockCrusher, BlockEnrichmentChamber, and BlockPlatinumCompressor. *Removed old machine recipe classes. *Removed sound system, will come at a later date. *Set up a new ore handling system. *Updated configuration for new IDs (3000-3003). *Set up new GUI IDs to replace old random ones. *Updated javadocs. *Updated machine facing system. *Implemented IWrenchable in TileEntityMachine, IC2 wrenches can change facing of machines now. *Added macerator recipes for more OI items. *Added IC2 mass fabricator boost with Enriched Alloy (100,000 ticks). *Updated IC2 hooks system. *Removed unnecessary imports. *Updated a bunch of recipes, check them out on PMC. *Updated metadata IDs in MultiBlock. *Updated machine overall code.
This commit is contained in:
parent
a398fb9631
commit
232bef3db6
40 changed files with 984 additions and 1320 deletions
|
@ -1,72 +0,0 @@
|
|||
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.*;
|
||||
|
||||
public class BlockCombiner extends BlockMachine
|
||||
{
|
||||
public BlockCombiner(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 48 : 15;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int side)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityCombiner tileEntity = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 23, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityCombiner();
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
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.*;
|
||||
|
||||
public class BlockCrusher extends BlockMachine
|
||||
{
|
||||
public BlockCrusher(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 12 : 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int side)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityCrusher tileEntity = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 24, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityCrusher();
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
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.*;
|
||||
|
||||
public class BlockEnrichmentChamber extends BlockMachine
|
||||
{
|
||||
public BlockEnrichmentChamber(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 8 : 9;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int side)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityEnrichmentChamber tileEntity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 21, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityEnrichmentChamber();
|
||||
}
|
||||
}
|
|
@ -1,11 +1,23 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple machine block IDs.
|
||||
* 0: Enrichment Chamber
|
||||
* 1: Platinum Compressor
|
||||
* 2: Combiner
|
||||
* 3: Crusher
|
||||
* 4: Theoretical Elementizer
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class BlockMachine extends BlockContainer
|
||||
{
|
||||
public Random machineRand = new Random();
|
||||
|
@ -18,6 +30,7 @@ public class BlockMachine extends BlockContainer
|
|||
setHardness(3.5F);
|
||||
setResistance(8F);
|
||||
setCreativeTab(CreativeTabs.tabDeco);
|
||||
setRequiresSelfNotify();
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
|
||||
|
@ -34,7 +47,7 @@ public class BlockMachine extends BlockContainer
|
|||
case 3: change = 4; break;
|
||||
}
|
||||
|
||||
tileEntity.setFacing(change);
|
||||
tileEntity.setFacing((short)change);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -72,6 +85,153 @@ public class BlockMachine extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
{
|
||||
if(meta == 0)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(meta == 1)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(meta == 2)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(meta == 3)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(meta == 4)
|
||||
{
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return 18;
|
||||
}
|
||||
else if(side == 3)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
else {
|
||||
return 19;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(metadata == 0)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 8 : 9;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(metadata == 1)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 32 : 14;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(metadata == 2)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 48 : 15;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(metadata == 3)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 12 : 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if(metadata == 4)
|
||||
{
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 20 : 18;
|
||||
}
|
||||
else {
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 64 : 16;
|
||||
}
|
||||
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 80 : 17;
|
||||
}
|
||||
else {
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 96 : 19;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
list.add(new ItemStack(i, 1, 1));
|
||||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a machine is in it's active state.
|
||||
* @param world
|
||||
|
@ -137,13 +297,90 @@ public class BlockMachine extends BlockContainer
|
|||
super.breakBlock(world, par2, par3, par4, i1, i2);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
int id = 0;
|
||||
|
||||
if(metadata == 0) id = 3;
|
||||
else if(metadata == 1) id = 4;
|
||||
else if(metadata == 2) id = 5;
|
||||
else if(metadata == 3) id = 6;
|
||||
else if(metadata == 4) id = 7;
|
||||
|
||||
entityplayer.openGui(ObsidianIngots.instance, id, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return "/obsidian/terrain.png";
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
if(metadata == MachineType.ENRICHMENT_CHAMBER.index)
|
||||
{
|
||||
return new TileEntityEnrichmentChamber();
|
||||
}
|
||||
else if(metadata == MachineType.PLATINUM_COMPRESSOR.index)
|
||||
{
|
||||
return new TileEntityPlatinumCompressor();
|
||||
}
|
||||
else if(metadata == MachineType.COMBINER.index)
|
||||
{
|
||||
return new TileEntityCombiner();
|
||||
}
|
||||
else if(metadata == MachineType.CRUSHER.index)
|
||||
{
|
||||
return new TileEntityCrusher();
|
||||
}
|
||||
else if(metadata == MachineType.THEORETICAL_ELEMENTIZER.index)
|
||||
{
|
||||
return new TileEntityTheoreticalElementizer();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//This method is not used, metadata manipulation is required to create a Tile Entity.
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static enum MachineType
|
||||
{
|
||||
ENRICHMENT_CHAMBER(0),
|
||||
PLATINUM_COMPRESSOR(1),
|
||||
COMBINER(2),
|
||||
CRUSHER(3),
|
||||
THEORETICAL_ELEMENTIZER(4);
|
||||
|
||||
private int index;
|
||||
|
||||
private MachineType(int i)
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,12 @@ import cpw.mods.fml.common.asm.SideOnly;
|
|||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Block object for handling multiple IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Platinum Block
|
||||
* 2: Redstone Block
|
||||
* 3: Refined Obsidian
|
||||
* 4: Coal Block
|
||||
* 5: Refined Glowstone
|
||||
* Block class for handling multiple metal block IDs.
|
||||
* 0: Platinum Block
|
||||
* 1: Redstone Block
|
||||
* 2: Refined Obsidian
|
||||
* 3: Coal Block
|
||||
* 4: Refined Glowstone
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -33,16 +32,14 @@ public class BlockMulti extends Block
|
|||
switch(meta)
|
||||
{
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
case 1:
|
||||
return 1;
|
||||
case 3:
|
||||
case 2:
|
||||
return 0;
|
||||
case 4:
|
||||
case 3:
|
||||
return 10;
|
||||
case 5:
|
||||
case 4:
|
||||
return 11;
|
||||
}
|
||||
return 0;
|
||||
|
@ -61,7 +58,6 @@ public class BlockMulti extends Block
|
|||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
list.add(new ItemStack(i, 1, 5));
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
|
@ -94,32 +90,10 @@ public class BlockMulti extends Block
|
|||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
switch(metadata)
|
||||
{
|
||||
case 0:
|
||||
setResistance(5F);
|
||||
break;
|
||||
default:
|
||||
setResistance(10F);
|
||||
break;
|
||||
}
|
||||
world.markBlockAsNeedsUpdate(x, y, z);
|
||||
world.updateAllLightTypes(x, y, z);
|
||||
}
|
||||
|
||||
public float getBlockHardness(World world, int x, int y, int z)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
switch(metadata)
|
||||
{
|
||||
case 0:
|
||||
return 3F;
|
||||
default:
|
||||
return 5F;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return "/obsidian/terrain.png";
|
||||
|
|
49
src/common/net/uberkat/obsidian/common/BlockOre.java
Normal file
49
src/common/net/uberkat/obsidian/common/BlockOre.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple ore block IDs.
|
||||
* 0: Platinum Ore
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class BlockOre extends Block
|
||||
{
|
||||
public BlockOre(int i)
|
||||
{
|
||||
super(i, Material.rock);
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setRequiresSelfNotify();
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
case 0:
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return "/obsidian/terrain.png";
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
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.*;
|
||||
|
||||
public class BlockPlatinumCompressor extends BlockMachine
|
||||
{
|
||||
public BlockPlatinumCompressor(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 32 : 14;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int side)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityPlatinumCompressor tileEntity = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 22, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityPlatinumCompressor();
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
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.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BlockTheoreticalElementizer extends BlockMachine
|
||||
{
|
||||
public BlockTheoreticalElementizer(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return isActive(world, x, y, z) ? 20 : 18;
|
||||
}
|
||||
else {
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 64 : 16;
|
||||
}
|
||||
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
|
||||
{
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 80 : 17;
|
||||
}
|
||||
else {
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 96 : 19;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int side)
|
||||
{
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return 18;
|
||||
}
|
||||
else if(side == 3)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
else {
|
||||
return 19;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityTheoreticalElementizer tileEntity = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 25, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityTheoreticalElementizer();
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class CombinerRecipes
|
||||
{
|
||||
private static final CombinerRecipes smeltingBase = new CombinerRecipes();
|
||||
|
||||
/** The list of smelting results. */
|
||||
private Map smeltingList = new HashMap();
|
||||
private Map metaSmeltingList = new HashMap();
|
||||
|
||||
/**
|
||||
* Used to call methods addSmelting and getSmeltingResult.
|
||||
*/
|
||||
public static final CombinerRecipes smelting()
|
||||
{
|
||||
return smeltingBase;
|
||||
}
|
||||
|
||||
private CombinerRecipes()
|
||||
{
|
||||
addSmelting(Item.redstone.shiftedIndex, new ItemStack(Block.oreRedstone, 1));
|
||||
addSmelting(ObsidianIngots.ObsidianDust.shiftedIndex, new ItemStack(Block.obsidian, 1));
|
||||
addSmelting(ObsidianIngots.IronDust.shiftedIndex, new ItemStack(Block.oreIron, 1));
|
||||
addSmelting(ObsidianIngots.GoldDust.shiftedIndex, new ItemStack(Block.oreGold, 1));
|
||||
addSmelting(ObsidianIngots.PlatinumDust.shiftedIndex, new ItemStack(ObsidianIngots.MultiBlock, 1, 0));
|
||||
addSmelting(Item.diamond.shiftedIndex, new ItemStack(Block.oreDiamond, 1));
|
||||
addSmelting(new ItemStack(Item.dyePowder, 1, 4).getItem().shiftedIndex, new ItemStack(Block.oreLapis, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe.
|
||||
*/
|
||||
public void addSmelting(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.smeltingList.put(Integer.valueOf(par1), par2ItemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smelting result of an item.
|
||||
* Deprecated in favor of a metadata sensitive version
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack getSmeltingResult(int par1)
|
||||
{
|
||||
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
public Map getSmeltingList()
|
||||
{
|
||||
return this.smeltingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a metadata-sensitive furnace recipe
|
||||
* @param itemID The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @param itemstack The ItemStack for the result
|
||||
*/
|
||||
public void addSmelting(int itemID, int metadata, ItemStack itemstack)
|
||||
{
|
||||
metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the resulting ItemStack form a source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public ItemStack getSmeltingResult(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
|
||||
}
|
||||
}
|
|
@ -50,13 +50,10 @@ public class CommonProxy
|
|||
public void loadConfiguration()
|
||||
{
|
||||
ObsidianIngots.configuration.load();
|
||||
ObsidianIngots.multiBlockID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("MultiBlock", 200).getInt();
|
||||
ObsidianIngots.obsidianTNTID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("ObsidianTNT", 201).getInt();
|
||||
ObsidianIngots.elementizerID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("TheoreticalElementizer", 202).getInt();
|
||||
ObsidianIngots.enrichmentChamberID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("EnrichmentChamber", 203).getInt();
|
||||
ObsidianIngots.platinumCompressorID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("PlatinumCompressor", 204).getInt();
|
||||
ObsidianIngots.combinerID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("Combiner", 205).getInt();
|
||||
ObsidianIngots.crusherID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("Crusher", 206).getInt();
|
||||
ObsidianIngots.multiBlockID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("MultiBlock", 3000).getInt();
|
||||
ObsidianIngots.machineBlockID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("MachineBlock", 3001).getInt();
|
||||
ObsidianIngots.oreBlockID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("OreBlock", 3002).getInt();
|
||||
ObsidianIngots.obsidianTNTID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("ObsidianTNT", 3003).getInt();
|
||||
ObsidianIngots.extrasEnabled = ObsidianIngots.configuration.getOrCreateBooleanProperty("ExtrasEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
ObsidianIngots.oreGenerationEnabled = ObsidianIngots.configuration.getOrCreateBooleanProperty("OreGenerationEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
ObsidianIngots.configuration.save();
|
||||
|
@ -101,19 +98,19 @@ public class CommonProxy
|
|||
{
|
||||
switch(ID)
|
||||
{
|
||||
case 21:
|
||||
case 3:
|
||||
TileEntityEnrichmentChamber tileentity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerEnrichmentChamber(player.inventory, tileentity);
|
||||
case 22:
|
||||
case 4:
|
||||
TileEntityPlatinumCompressor tileentity1 = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerPlatinumCompressor(player.inventory, tileentity1);
|
||||
case 23:
|
||||
case 5:
|
||||
TileEntityCombiner tileentity2 = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerCombiner(player.inventory, tileentity2);
|
||||
case 24:
|
||||
case 6:
|
||||
TileEntityCrusher tileentity3 = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerCrusher(player.inventory, tileentity3);
|
||||
case 25:
|
||||
case 7:
|
||||
TileEntityTheoreticalElementizer tileentity4 = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerTheoreticalElementizer(player.inventory, tileentity4);
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.src.*;
|
|||
|
||||
public class ContainerCombiner extends Container
|
||||
{
|
||||
private TileEntityCombiner combiner;
|
||||
private TileEntityCombiner machine;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerCombiner(InventoryPlayer par1InventoryPlayer, TileEntityCombiner par2TileEntityCombiner)
|
||||
{
|
||||
this.combiner = par2TileEntityCombiner;
|
||||
this.machine = par2TileEntityCombiner;
|
||||
this.addSlotToContainer(new Slot(par2TileEntityCombiner, 0, 56, 17));
|
||||
this.addSlotToContainer(new Slot(par2TileEntityCombiner, 1, 56, 53));
|
||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityCombiner, 2, 116, 35));
|
||||
|
@ -42,48 +42,48 @@ public class ContainerCombiner extends Container
|
|||
{
|
||||
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
||||
|
||||
if (this.lastCookTime != this.combiner.machineCookTime)
|
||||
if (this.lastCookTime != this.machine.machineCookTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.combiner.machineCookTime);
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
||||
}
|
||||
|
||||
if (this.lastBurnTime != this.combiner.machineBurnTime)
|
||||
if (this.lastBurnTime != this.machine.machineBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.combiner.machineBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
||||
}
|
||||
|
||||
if (this.lastItemBurnTime != this.combiner.currentItemBurnTime)
|
||||
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.combiner.currentItemBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastCookTime = this.combiner.machineCookTime;
|
||||
this.lastBurnTime = this.combiner.machineBurnTime;
|
||||
this.lastItemBurnTime = this.combiner.currentItemBurnTime;
|
||||
this.lastCookTime = this.machine.machineCookTime;
|
||||
this.lastBurnTime = this.machine.machineBurnTime;
|
||||
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void updateProgressBar(int par1, int par2)
|
||||
{
|
||||
if (par1 == 0)
|
||||
{
|
||||
this.combiner.machineCookTime = par2;
|
||||
this.machine.machineCookTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 1)
|
||||
{
|
||||
this.combiner.machineBurnTime = par2;
|
||||
this.machine.machineBurnTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
this.combiner.currentItemBurnTime = par2;
|
||||
this.machine.currentItemBurnTime = par2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.combiner.isUseableByPlayer(par1EntityPlayer);
|
||||
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class ContainerCombiner extends Container
|
|||
}
|
||||
else if (par1 != 1 && par1 != 0)
|
||||
{
|
||||
if (CombinerRecipes.smelting().getSmeltingResult(var4) != null)
|
||||
if (MachineRecipes.getOutput(var4, false, machine.recipes) != null)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 0, 1, false))
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.src.*;
|
|||
|
||||
public class ContainerCrusher extends Container
|
||||
{
|
||||
private TileEntityCrusher crusher;
|
||||
private TileEntityCrusher machine;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerCrusher(InventoryPlayer par1InventoryPlayer, TileEntityCrusher par2TileEntityCrusher)
|
||||
{
|
||||
this.crusher = par2TileEntityCrusher;
|
||||
this.machine = par2TileEntityCrusher;
|
||||
this.addSlotToContainer(new Slot(par2TileEntityCrusher, 0, 56, 17));
|
||||
this.addSlotToContainer(new Slot(par2TileEntityCrusher, 1, 56, 53));
|
||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityCrusher, 2, 116, 35));
|
||||
|
@ -42,48 +42,48 @@ public class ContainerCrusher extends Container
|
|||
{
|
||||
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
||||
|
||||
if (this.lastCookTime != this.crusher.machineCookTime)
|
||||
if (this.lastCookTime != this.machine.machineCookTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.crusher.machineCookTime);
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
||||
}
|
||||
|
||||
if (this.lastBurnTime != this.crusher.machineBurnTime)
|
||||
if (this.lastBurnTime != this.machine.machineBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.crusher.machineBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
||||
}
|
||||
|
||||
if (this.lastItemBurnTime != this.crusher.currentItemBurnTime)
|
||||
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.crusher.currentItemBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastCookTime = this.crusher.machineCookTime;
|
||||
this.lastBurnTime = this.crusher.machineBurnTime;
|
||||
this.lastItemBurnTime = this.crusher.currentItemBurnTime;
|
||||
this.lastCookTime = this.machine.machineCookTime;
|
||||
this.lastBurnTime = this.machine.machineBurnTime;
|
||||
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void updateProgressBar(int par1, int par2)
|
||||
{
|
||||
if (par1 == 0)
|
||||
{
|
||||
this.crusher.machineCookTime = par2;
|
||||
this.machine.machineCookTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 1)
|
||||
{
|
||||
this.crusher.machineBurnTime = par2;
|
||||
this.machine.machineBurnTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
this.crusher.currentItemBurnTime = par2;
|
||||
this.machine.currentItemBurnTime = par2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.crusher.isUseableByPlayer(par1EntityPlayer);
|
||||
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class ContainerCrusher extends Container
|
|||
}
|
||||
else if (par1 != 1 && par1 != 0)
|
||||
{
|
||||
if (CrusherRecipes.smelting().getSmeltingResult(var4) != null)
|
||||
if (MachineRecipes.getOutput(var4, false, machine.recipes) != null)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 0, 1, false))
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.src.*;
|
|||
|
||||
public class ContainerEnrichmentChamber extends Container
|
||||
{
|
||||
private TileEntityEnrichmentChamber chamber;
|
||||
private TileEntityEnrichmentChamber machine;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerEnrichmentChamber(InventoryPlayer par1InventoryPlayer, TileEntityEnrichmentChamber par2TileEntityEnrichmentChamber)
|
||||
{
|
||||
this.chamber = par2TileEntityEnrichmentChamber;
|
||||
this.machine = par2TileEntityEnrichmentChamber;
|
||||
this.addSlotToContainer(new Slot(par2TileEntityEnrichmentChamber, 0, 56, 17));
|
||||
this.addSlotToContainer(new Slot(par2TileEntityEnrichmentChamber, 1, 56, 53));
|
||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityEnrichmentChamber, 2, 116, 35));
|
||||
|
@ -42,48 +42,48 @@ public class ContainerEnrichmentChamber extends Container
|
|||
{
|
||||
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
||||
|
||||
if (this.lastCookTime != this.chamber.machineCookTime)
|
||||
if (this.lastCookTime != this.machine.machineCookTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.chamber.machineCookTime);
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
||||
}
|
||||
|
||||
if (this.lastBurnTime != this.chamber.machineBurnTime)
|
||||
if (this.lastBurnTime != this.machine.machineBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.chamber.machineBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
||||
}
|
||||
|
||||
if (this.lastItemBurnTime != this.chamber.currentItemBurnTime)
|
||||
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.chamber.currentItemBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastCookTime = this.chamber.machineCookTime;
|
||||
this.lastBurnTime = this.chamber.machineBurnTime;
|
||||
this.lastItemBurnTime = this.chamber.currentItemBurnTime;
|
||||
this.lastCookTime = this.machine.machineCookTime;
|
||||
this.lastBurnTime = this.machine.machineBurnTime;
|
||||
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void updateProgressBar(int par1, int par2)
|
||||
{
|
||||
if (par1 == 0)
|
||||
{
|
||||
this.chamber.machineCookTime = par2;
|
||||
this.machine.machineCookTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 1)
|
||||
{
|
||||
this.chamber.machineBurnTime = par2;
|
||||
this.machine.machineBurnTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
this.chamber.currentItemBurnTime = par2;
|
||||
this.machine.currentItemBurnTime = par2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.chamber.isUseableByPlayer(par1EntityPlayer);
|
||||
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class ContainerEnrichmentChamber extends Container
|
|||
}
|
||||
else if (par1 != 1 && par1 != 0)
|
||||
{
|
||||
if (EnrichmentChamberRecipes.smelting().getSmeltingResult(var4) != null)
|
||||
if (MachineRecipes.getOutput(var4, false, machine.recipes) != null)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 0, 1, false))
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.src.*;
|
|||
|
||||
public class ContainerPlatinumCompressor extends Container
|
||||
{
|
||||
private TileEntityPlatinumCompressor compressor;
|
||||
private TileEntityPlatinumCompressor machine;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerPlatinumCompressor(InventoryPlayer par1InventoryPlayer, TileEntityPlatinumCompressor par2TileEntityPlatinumCompressor)
|
||||
{
|
||||
this.compressor = par2TileEntityPlatinumCompressor;
|
||||
this.machine = par2TileEntityPlatinumCompressor;
|
||||
this.addSlotToContainer(new Slot(par2TileEntityPlatinumCompressor, 0, 56, 17));
|
||||
this.addSlotToContainer(new Slot(par2TileEntityPlatinumCompressor, 1, 56, 53));
|
||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityPlatinumCompressor, 2, 116, 35));
|
||||
|
@ -42,48 +42,48 @@ public class ContainerPlatinumCompressor extends Container
|
|||
{
|
||||
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
||||
|
||||
if (this.lastCookTime != this.compressor.machineCookTime)
|
||||
if (this.lastCookTime != this.machine.machineCookTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.compressor.machineCookTime);
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
||||
}
|
||||
|
||||
if (this.lastBurnTime != this.compressor.machineBurnTime)
|
||||
if (this.lastBurnTime != this.machine.machineBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.compressor.machineBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
||||
}
|
||||
|
||||
if (this.lastItemBurnTime != this.compressor.currentItemBurnTime)
|
||||
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.compressor.currentItemBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastCookTime = this.compressor.machineCookTime;
|
||||
this.lastBurnTime = this.compressor.machineBurnTime;
|
||||
this.lastItemBurnTime = this.compressor.currentItemBurnTime;
|
||||
this.lastCookTime = this.machine.machineCookTime;
|
||||
this.lastBurnTime = this.machine.machineBurnTime;
|
||||
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void updateProgressBar(int par1, int par2)
|
||||
{
|
||||
if (par1 == 0)
|
||||
{
|
||||
this.compressor.machineCookTime = par2;
|
||||
this.machine.machineCookTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 1)
|
||||
{
|
||||
this.compressor.machineBurnTime = par2;
|
||||
this.machine.machineBurnTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
this.compressor.currentItemBurnTime = par2;
|
||||
this.machine.currentItemBurnTime = par2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.compressor.isUseableByPlayer(par1EntityPlayer);
|
||||
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class ContainerPlatinumCompressor extends Container
|
|||
}
|
||||
else if (par1 != 1 && par1 != 0)
|
||||
{
|
||||
if (PlatinumCompressorRecipes.smelting().getSmeltingResult(var4) != null)
|
||||
if (MachineRecipes.getOutput(var4, false, machine.recipes) != null)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 0, 1, false))
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.src.*;
|
|||
|
||||
public class ContainerTheoreticalElementizer extends Container
|
||||
{
|
||||
private TileEntityTheoreticalElementizer elementizer;
|
||||
private TileEntityTheoreticalElementizer machine;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerTheoreticalElementizer(InventoryPlayer par1InventoryPlayer, TileEntityTheoreticalElementizer par2TileEntityTheoreticalElementizer)
|
||||
{
|
||||
this.elementizer = par2TileEntityTheoreticalElementizer;
|
||||
this.machine = par2TileEntityTheoreticalElementizer;
|
||||
this.addSlotToContainer(new Slot(par2TileEntityTheoreticalElementizer, 0, 56, 17));
|
||||
this.addSlotToContainer(new Slot(par2TileEntityTheoreticalElementizer, 1, 56, 53));
|
||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityTheoreticalElementizer, 2, 116, 35));
|
||||
|
@ -42,48 +42,48 @@ public class ContainerTheoreticalElementizer extends Container
|
|||
{
|
||||
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
||||
|
||||
if (this.lastCookTime != this.elementizer.machineCookTime)
|
||||
if (this.lastCookTime != this.machine.machineCookTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.elementizer.machineCookTime);
|
||||
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
||||
}
|
||||
|
||||
if (this.lastBurnTime != this.elementizer.machineBurnTime)
|
||||
if (this.lastBurnTime != this.machine.machineBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.elementizer.machineBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
||||
}
|
||||
|
||||
if (this.lastItemBurnTime != this.elementizer.currentItemBurnTime)
|
||||
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
||||
{
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.elementizer.currentItemBurnTime);
|
||||
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastCookTime = this.elementizer.machineCookTime;
|
||||
this.lastBurnTime = this.elementizer.machineBurnTime;
|
||||
this.lastItemBurnTime = this.elementizer.currentItemBurnTime;
|
||||
this.lastCookTime = this.machine.machineCookTime;
|
||||
this.lastBurnTime = this.machine.machineBurnTime;
|
||||
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void updateProgressBar(int par1, int par2)
|
||||
{
|
||||
if (par1 == 0)
|
||||
{
|
||||
this.elementizer.machineCookTime = par2;
|
||||
this.machine.machineCookTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 1)
|
||||
{
|
||||
this.elementizer.machineBurnTime = par2;
|
||||
this.machine.machineBurnTime = par2;
|
||||
}
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
this.elementizer.currentItemBurnTime = par2;
|
||||
this.machine.currentItemBurnTime = par2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.elementizer.isUseableByPlayer(par1EntityPlayer);
|
||||
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class CrusherRecipes
|
||||
{
|
||||
private static final CrusherRecipes smeltingBase = new CrusherRecipes();
|
||||
|
||||
/** The list of smelting results. */
|
||||
private Map smeltingList = new HashMap();
|
||||
private Map metaSmeltingList = new HashMap();
|
||||
|
||||
/**
|
||||
* Used to call methods addSmelting and getSmeltingResult.
|
||||
*/
|
||||
public static final CrusherRecipes smelting()
|
||||
{
|
||||
return smeltingBase;
|
||||
}
|
||||
|
||||
private CrusherRecipes()
|
||||
{
|
||||
addSmelting(ObsidianIngots.RedstoneIngot.shiftedIndex, new ItemStack(Item.redstone, 1));
|
||||
addSmelting(Item.ingotIron.shiftedIndex, new ItemStack(ObsidianIngots.IronDust, 1));
|
||||
addSmelting(Item.ingotGold.shiftedIndex, new ItemStack(ObsidianIngots.GoldDust, 1));
|
||||
addSmelting(ObsidianIngots.PlatinumIngot.shiftedIndex, new ItemStack(ObsidianIngots.PlatinumDust, 1));
|
||||
addSmelting(ObsidianIngots.GlowstoneIngot.shiftedIndex, new ItemStack(Item.lightStoneDust));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe.
|
||||
*/
|
||||
public void addSmelting(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.smeltingList.put(Integer.valueOf(par1), par2ItemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smelting result of an item.
|
||||
* Deprecated in favor of a metadata sensitive version
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack getSmeltingResult(int par1)
|
||||
{
|
||||
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
public Map getSmeltingList()
|
||||
{
|
||||
return this.smeltingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a metadata-sensitive furnace recipe
|
||||
* @param itemID The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @param itemstack The ItemStack for the result
|
||||
*/
|
||||
public void addSmelting(int itemID, int metadata, ItemStack itemstack)
|
||||
{
|
||||
metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the resulting ItemStack form a source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public ItemStack getSmeltingResult(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class EnrichmentChamberRecipes
|
||||
{
|
||||
private static final EnrichmentChamberRecipes smeltingBase = new EnrichmentChamberRecipes();
|
||||
|
||||
/** The list of smelting results. */
|
||||
private Map smeltingList = new HashMap();
|
||||
private Map metaSmeltingList = new HashMap();
|
||||
|
||||
/**
|
||||
* Used to call methods addSmelting and getSmeltingResult.
|
||||
*/
|
||||
public static final EnrichmentChamberRecipes smelting()
|
||||
{
|
||||
return smeltingBase;
|
||||
}
|
||||
|
||||
private EnrichmentChamberRecipes()
|
||||
{
|
||||
addSmelting(Block.obsidian.blockID, new ItemStack(ObsidianIngots.ObsidianDust, 1));
|
||||
addSmelting(Block.oreIron.blockID, new ItemStack(ObsidianIngots.IronDust, 1));
|
||||
addSmelting(Block.oreGold.blockID, new ItemStack(ObsidianIngots.GoldDust, 1));
|
||||
addSmelting(new ItemStack(ObsidianIngots.MultiBlock, 1, 0).itemID, new ItemStack(ObsidianIngots.PlatinumDust, 1));
|
||||
addSmelting(Block.oreRedstone.blockID, new ItemStack(Item.redstone));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe.
|
||||
*/
|
||||
public void addSmelting(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.smeltingList.put(Integer.valueOf(par1), par2ItemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smelting result of an item.
|
||||
* Deprecated in favor of a metadata sensitive version
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack getSmeltingResult(int par1)
|
||||
{
|
||||
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
public Map getSmeltingList()
|
||||
{
|
||||
return this.smeltingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a metadata-sensitive furnace recipe
|
||||
* @param itemID The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @param itemstack The ItemStack for the result
|
||||
*/
|
||||
public void addSmelting(int itemID, int metadata, ItemStack itemstack)
|
||||
{
|
||||
metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the resulting ItemStack form a source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public ItemStack getSmeltingResult(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
|
||||
}
|
||||
}
|
64
src/common/net/uberkat/obsidian/common/ItemMachine.java
Normal file
64
src/common/net/uberkat/obsidian/common/ItemMachine.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple machine block IDs.
|
||||
* 0: Enrichment Chamber
|
||||
* 1: Platinum Compressor
|
||||
* 2: Combiner
|
||||
* 3: Crusher
|
||||
* 4: Theoretical Elementizer
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ItemMachine extends ItemBlock
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
public ItemMachine(int id, Block block)
|
||||
{
|
||||
super(id);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getBlockTextureFromSideAndMetadata(2, i);
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "EnrichmentChamber";
|
||||
break;
|
||||
case 1:
|
||||
name = "PlatinumCompressor";
|
||||
break;
|
||||
case 2:
|
||||
name = "Combiner";
|
||||
break;
|
||||
case 3:
|
||||
name = "Crusher";
|
||||
break;
|
||||
case 4:
|
||||
name = "TheoreticalElementizer";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
return getItemName() + "." + name;
|
||||
}
|
||||
}
|
|
@ -3,13 +3,12 @@ package net.uberkat.obsidian.common;
|
|||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Platinum Block
|
||||
* 2: Redstone Block
|
||||
* 3: Refined Obsidian
|
||||
* 4: Coal Block
|
||||
* 5: Refined Glowstone
|
||||
* Item class for handling multiple metal block IDs.
|
||||
* 0: Platinum Block
|
||||
* 1: Redstone Block
|
||||
* 2: Refined Obsidian
|
||||
* 3: Coal Block
|
||||
* 4: Refined Glowstone
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -40,21 +39,18 @@ public class ItemMulti extends ItemBlock
|
|||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "PlatinumOre";
|
||||
break;
|
||||
case 1:
|
||||
name = "PlatinumBlock";
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
name = "RedstoneBlock";
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
name = "RefinedObsidian";
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
name = "CoalBlock";
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
name = "RefinedGlowstone";
|
||||
break;
|
||||
default:
|
||||
|
|
46
src/common/net/uberkat/obsidian/common/ItemOre.java
Normal file
46
src/common/net/uberkat/obsidian/common/ItemOre.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple ore block IDs.
|
||||
* 0: Platinum Ore
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ItemOre extends ItemBlock
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
public ItemOre(int id, Block block)
|
||||
{
|
||||
super(id);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getBlockTextureFromSideAndMetadata(2, i);
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "PlatinumOre";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
return getItemName() + "." + name;
|
||||
}
|
||||
}
|
78
src/common/net/uberkat/obsidian/common/MachineRecipes.java
Normal file
78
src/common/net/uberkat/obsidian/common/MachineRecipes.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Class used to handle machine recipes. This is used for both adding recipes and checking outputs.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public final class MachineRecipes
|
||||
{
|
||||
/**
|
||||
* Add an Enrichment Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
public static void addEnrichmentChamberRecipe(ItemStack input, ItemStack output)
|
||||
{
|
||||
TileEntityEnrichmentChamber.recipes.add(new AbstractMap.SimpleEntry(input, output));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Platinum Compressor recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
public static void addPlatinumCompressorRecipe(ItemStack input, ItemStack output)
|
||||
{
|
||||
TileEntityPlatinumCompressor.recipes.add(new AbstractMap.SimpleEntry(input, output));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Combiner recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
public static void addCombinerRecipe(ItemStack input, ItemStack output)
|
||||
{
|
||||
TileEntityCombiner.recipes.add(new AbstractMap.SimpleEntry(input, output));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Crusher recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
public static void addCrusherRecipe(ItemStack input, ItemStack output)
|
||||
{
|
||||
TileEntityCrusher.recipes.add(new AbstractMap.SimpleEntry(input, output));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the output ItemStack of the ItemStack in the parameters.
|
||||
* @param itemstack - input ItemStack
|
||||
* @param flag - whether or not to decrease stack size
|
||||
* @param recipes - List object of recipes
|
||||
* @return output ItemStack
|
||||
*/
|
||||
public static ItemStack getOutput(ItemStack itemstack, boolean flag, List recipes)
|
||||
{
|
||||
for(Iterator iterator = recipes.iterator(); iterator.hasNext();)
|
||||
{
|
||||
Map.Entry entry = (Map.Entry)iterator.next();
|
||||
|
||||
if(((ItemStack)entry.getKey()).isItemEqual(itemstack) && itemstack.stackSize >= ((ItemStack)entry.getKey()).stackSize)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
itemstack.stackSize -= ((ItemStack)entry.getKey()).stackSize;
|
||||
}
|
||||
|
||||
return ((ItemStack)entry.getValue()).copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -11,22 +11,27 @@ import net.minecraft.src.*;
|
|||
public class ObsidianHooks
|
||||
{
|
||||
private Class Ic2Items;
|
||||
private Class IC2;
|
||||
|
||||
public ItemStack IC2IronDust;
|
||||
public ItemStack IC2GoldDust;
|
||||
|
||||
public boolean IC2Loaded;
|
||||
public boolean IC2Loaded = false;
|
||||
|
||||
public void hook()
|
||||
{
|
||||
if(getIC2Item("uraniumOre", true) != null) IC2Loaded = true;
|
||||
if(isIC2Installed()) IC2Loaded = true;
|
||||
|
||||
if(IC2Loaded)
|
||||
{
|
||||
IC2IronDust = getIC2Item("ironDust", false);
|
||||
IC2GoldDust = getIC2Item("goldDust", false);
|
||||
IC2IronDust = getIC2Item("ironDust");
|
||||
IC2GoldDust = getIC2Item("goldDust");
|
||||
|
||||
Ic2Recipes.addMaceratorRecipe(new ItemStack(ObsidianIngots.MultiBlock, 1, 0), new ItemStack(ObsidianIngots.PlatinumDust, 2));
|
||||
Ic2Recipes.addMaceratorRecipe(new ItemStack(Block.obsidian), new ItemStack(ObsidianIngots.ObsidianDust));
|
||||
Ic2Recipes.addMatterAmplifier(ObsidianIngots.EnrichedAlloy, 100000);
|
||||
|
||||
System.out.println("[ObsidianIngots] Hooked into IC2 successfully.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +41,7 @@ public class ObsidianHooks
|
|||
* @param test - whether or not this is a test
|
||||
* @return the object
|
||||
*/
|
||||
public ItemStack getIC2Item(String name, boolean test)
|
||||
public ItemStack getIC2Item(String name)
|
||||
{
|
||||
try {
|
||||
if(Ic2Items == null) Ic2Items = Class.forName("ic2.common.Ic2Items");
|
||||
|
@ -51,14 +56,26 @@ public class ObsidianHooks
|
|||
return null;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
if(!test)
|
||||
{
|
||||
System.out.println("[ObsidianIngots] Unable to retrieve IC2 item " + name + ".");
|
||||
}
|
||||
else {
|
||||
System.out.println("[ObsidianIngots] Unable to hook into IC2.");
|
||||
}
|
||||
System.out.println("[ObsidianIngots] Unable to retrieve IC2 item " + name + ".");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIC2Installed()
|
||||
{
|
||||
try {
|
||||
if(IC2 == null) IC2 = Class.forName("ic2.common.IC2");
|
||||
if(IC2 == null) IC2 = Class.forName("net.minecraft.src.ic2.common.IC2");
|
||||
Object ret = IC2.getField("platform").get(null);
|
||||
|
||||
if(ret != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch(Exception e) {
|
||||
System.out.println("[ObsidianIngots] Unable to hook into IC2.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
|
|||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.0.9")
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.1.0")
|
||||
@NetworkMod(channels = { "ObsidianIngots" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class ObsidianIngots
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ public class ObsidianIngots
|
|||
public static Configuration configuration;
|
||||
|
||||
/** Obsidian Ingots version number */
|
||||
public static Version versionNumber = new Version(4, 0, 9);
|
||||
public static Version versionNumber = new Version(4, 1, 0);
|
||||
|
||||
/** The latest version number which is received from the Obsidian Ingots server */
|
||||
public static String latestVersionNumber;
|
||||
|
@ -92,12 +92,9 @@ public class ObsidianIngots
|
|||
|
||||
//Block IDs
|
||||
public static int multiBlockID = 3000;
|
||||
public static int obsidianTNTID = 3001;
|
||||
public static int elementizerID = 3002;
|
||||
public static int enrichmentChamberID = 3003;
|
||||
public static int platinumCompressorID = 3004;
|
||||
public static int combinerID = 3005;
|
||||
public static int crusherID = 3006;
|
||||
public static int machineBlockID = 3001;
|
||||
public static int oreBlockID = 3002;
|
||||
public static int obsidianTNTID = 3003;
|
||||
|
||||
//Base Items
|
||||
public static Item WoodPaxel;
|
||||
|
@ -194,12 +191,9 @@ public class ObsidianIngots
|
|||
|
||||
//Extra Blocks
|
||||
public static Block MultiBlock;
|
||||
public static Block MachineBlock;
|
||||
public static Block OreBlock;
|
||||
public static Block ObsidianTNT;
|
||||
public static Block TheoreticalElementizer;
|
||||
public static Block EnrichmentChamber;
|
||||
public static Block PlatinumCompressor;
|
||||
public static Block Combiner;
|
||||
public static Block Crusher;
|
||||
|
||||
//Boolean Values
|
||||
public static boolean extrasEnabled = true;
|
||||
|
@ -250,18 +244,18 @@ public class ObsidianIngots
|
|||
" ^", "I ", Character.valueOf('^'), Item.ingotGold, Character.valueOf('I'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Item.coal, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 4)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 3)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 4), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 3), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), Item.coal
|
||||
});
|
||||
|
||||
//Obsidian
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 3), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 2), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), ObsidianIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 3)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 2)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianHelmet, 1), new Object[] {
|
||||
"***", "* *", Character.valueOf('*'), ObsidianIngot
|
||||
|
@ -298,11 +292,11 @@ public class ObsidianIngots
|
|||
});
|
||||
|
||||
//Glowstone
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 5), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 4), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), GlowstoneIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 5)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 4)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstonePaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), GlowstoneAxe, Character.valueOf('Y'), GlowstonePickaxe, Character.valueOf('Z'), GlowstoneSpade, Character.valueOf('T'), Item.stick
|
||||
|
@ -374,7 +368,7 @@ public class ObsidianIngots
|
|||
});
|
||||
|
||||
//Platinum
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 0), new Object[] {
|
||||
"XXX", "XXX", "XXX", Character.valueOf('X'), PlatinumIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumPaxel, 1), new Object[] {
|
||||
|
@ -408,18 +402,18 @@ public class ObsidianIngots
|
|||
"* *", "* *", Character.valueOf('*'), PlatinumIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 1)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 0)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumKnife, 1), new Object[] {
|
||||
" ^", "I ", Character.valueOf('^'), PlatinumIngot, Character.valueOf('I'), Item.stick
|
||||
});
|
||||
|
||||
//Redstone
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 2), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 1), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), RedstoneIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 2)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstonePaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), RedstoneAxe, Character.valueOf('Y'), RedstonePickaxe, Character.valueOf('Z'), RedstoneSpade, Character.valueOf('T'), Item.stick
|
||||
|
@ -465,28 +459,52 @@ public class ObsidianIngots
|
|||
GameRegistry.addRecipe(new ItemStack(ObsidianBow, 1), new Object[] {
|
||||
" AB", "A B", " AB", Character.valueOf('A'), ObsidianIngot, Character.valueOf('B'), Item.silk
|
||||
});
|
||||
if(extrasEnabled)
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(TheoreticalElementizer, 1), new Object[] {
|
||||
"SGS", "GDG", "SGS", Character.valueOf('S'), Block.stone, Character.valueOf('G'), Block.glass, Character.valueOf('D'), Block.blockDiamond
|
||||
});
|
||||
}
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumCompressor, 1), new Object[] {
|
||||
"***", "*P*", "***", Character.valueOf('*'), Item.redstone, Character.valueOf('P'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(EnrichmentChamber, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MachineBlock, 1, 0), new Object[] {
|
||||
"***", "*R*", "***", Character.valueOf('*'), PlatinumIngot, Character.valueOf('R'), Item.redstone
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Combiner, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MachineBlock, 1, 1), new Object[] {
|
||||
"***", "*P*", "***", Character.valueOf('*'), Item.redstone, Character.valueOf('P'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(MachineBlock, 1, 2), new Object[] {
|
||||
"***", "*P*", "***", Character.valueOf('*'), Block.cobblestone, Character.valueOf('P'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Crusher, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MachineBlock, 1, 3), new Object[] {
|
||||
"***", "*L*", "***", Character.valueOf('*'), PlatinumIngot, Character.valueOf('L'), Item.bucketLava
|
||||
});
|
||||
|
||||
//Smelting
|
||||
GameRegistry.addSmelting(new ItemStack(MultiBlock, 1, 0).itemID, new ItemStack(PlatinumIngot), 1.0F);
|
||||
if(extrasEnabled)
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(MachineBlock, 1, 4), new Object[] {
|
||||
"SGS", "GDG", "SGS", Character.valueOf('S'), Block.stone, Character.valueOf('G'), Block.glass, Character.valueOf('D'), Block.blockDiamond
|
||||
});
|
||||
}
|
||||
|
||||
//Furnace Recipes
|
||||
GameRegistry.addSmelting(new ItemStack(OreBlock, 1, 0).itemID, new ItemStack(PlatinumIngot, 2), 1.0F);
|
||||
GameRegistry.addSmelting(PlatinumDust.shiftedIndex, new ItemStack(PlatinumIngot, 1), 1.0F);
|
||||
|
||||
//Enrichment Chamber Recipes
|
||||
MachineRecipes.addEnrichmentChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(ObsidianDust));
|
||||
MachineRecipes.addEnrichmentChamberRecipe(new ItemStack(OreBlock, 1, 0), new ItemStack(PlatinumDust, 2));
|
||||
MachineRecipes.addEnrichmentChamberRecipe(new ItemStack(Block.oreRedstone), new ItemStack(Item.redstone, 2));
|
||||
|
||||
//Platinum Compressor Recipes
|
||||
MachineRecipes.addPlatinumCompressorRecipe(new ItemStack(Item.redstone), new ItemStack(RedstoneIngot));
|
||||
MachineRecipes.addPlatinumCompressorRecipe(new ItemStack(ObsidianDust), new ItemStack(ObsidianIngot));
|
||||
MachineRecipes.addPlatinumCompressorRecipe(new ItemStack(Item.lightStoneDust), new ItemStack(GlowstoneIngot));
|
||||
|
||||
//Combiner Recipes
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(Item.redstone, 4), new ItemStack(Block.oreRedstone));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(ObsidianDust), new ItemStack(Block.obsidian));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(Item.redstone), new ItemStack(RedstoneIngot));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(PlatinumDust, 2), new ItemStack(OreBlock, 1, 0));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(Item.diamond), new ItemStack(Block.oreDiamond));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(Item.dyePowder, 4, 4), new ItemStack(Block.oreLapis));
|
||||
|
||||
//Crusher Recipes
|
||||
MachineRecipes.addCrusherRecipe(new ItemStack(RedstoneIngot), new ItemStack(Item.redstone));
|
||||
MachineRecipes.addCrusherRecipe(new ItemStack(PlatinumIngot), new ItemStack(PlatinumDust));
|
||||
MachineRecipes.addCrusherRecipe(new ItemStack(GlowstoneIngot), new ItemStack(Item.lightStoneDust));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -581,26 +599,35 @@ public class ObsidianIngots
|
|||
LanguageRegistry.addName(ObsidianArrow, "Obsidian Arrow");
|
||||
LanguageRegistry.addName(ObsidianBow, "Obsidian Bow");
|
||||
LanguageRegistry.addName(ObsidianTNT, "Obsidian TNT");
|
||||
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LanguageRegistry.addName(LightningRod, "Lightning Rod");
|
||||
LanguageRegistry.addName(Stopwatch, "Steve's Stopwatch");
|
||||
LanguageRegistry.addName(TheoreticalElementizer, "Theoretical Elementizer");
|
||||
LanguageRegistry.addName(WeatherOrb, "Weather Orb");
|
||||
LanguageRegistry.addName(EnrichedAlloy, "Enriched Alloy");
|
||||
}
|
||||
LanguageRegistry.addName(EnrichmentChamber, "Enrichment Chamber");
|
||||
LanguageRegistry.addName(PlatinumCompressor, "Platinum Compressor");
|
||||
LanguageRegistry.addName(Combiner, "Combiner");
|
||||
LanguageRegistry.addName(Crusher, "Crusher");
|
||||
|
||||
//Localization for MultiBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.PlatinumOre.name", "Platinum Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.PlatinumBlock.name", "Platinum Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RedstoneBlock.name", "Redstone Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RefinedObsidian.name", "Refined Obsidian");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.CoalBlock.name", "Coal Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RefinedGlowstone.name", "Refined Glowstone Block");
|
||||
|
||||
//Localization for MachineBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.EnrichmentChamber.name", "Enrichment Chamber");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.PlatinumCompressor.name", "Platinum Compressor");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Combiner.name", "Combiner");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Crusher.name", "Crusher");
|
||||
|
||||
//Localization for OreBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.PlatinumOre.name", "Platinum Ore");
|
||||
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.TheoreticalElementizer.name", "Theoretical Elementizer");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -695,6 +722,7 @@ public class ObsidianIngots
|
|||
//Extras
|
||||
ObsidianArrow.setIconIndex(193);
|
||||
ObsidianBow.setIconIndex(177);
|
||||
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LightningRod.setIconIndex(225);
|
||||
|
@ -798,29 +826,17 @@ public class ObsidianIngots
|
|||
{
|
||||
//Declarations
|
||||
MultiBlock = new BlockMulti(multiBlockID).setBlockName("MultiBlock");
|
||||
ObsidianTNT = new BlockObsidianTNT(obsidianTNTID).setBlockName("ObsidianTNT").setCreativeTab(CreativeTabs.tabBlock);
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
TheoreticalElementizer = new BlockTheoreticalElementizer(elementizerID).setBlockName("TheoreticalElementizer");
|
||||
}
|
||||
EnrichmentChamber = new BlockEnrichmentChamber(enrichmentChamberID).setBlockName("EnrichmentChamber");
|
||||
PlatinumCompressor = new BlockPlatinumCompressor(platinumCompressorID).setBlockName("PlatinumCompressor");
|
||||
Combiner = new BlockCombiner(combinerID).setBlockName("Combiner");
|
||||
Crusher = new BlockCrusher(crusherID).setBlockName("Crusher");
|
||||
MachineBlock = new BlockMachine(machineBlockID).setBlockName("MachineBlock");
|
||||
OreBlock = new BlockOre(oreBlockID).setBlockName("OreBlock");
|
||||
ObsidianTNT = new BlockObsidianTNT(obsidianTNTID).setBlockName("ObsidianTNT").setCreativeTab(CreativeTabs.tabRedstone);
|
||||
|
||||
//Registrations
|
||||
GameRegistry.registerBlock(ObsidianTNT);
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
GameRegistry.registerBlock(TheoreticalElementizer);
|
||||
}
|
||||
GameRegistry.registerBlock(EnrichmentChamber);
|
||||
GameRegistry.registerBlock(PlatinumCompressor);
|
||||
GameRegistry.registerBlock(Combiner);
|
||||
GameRegistry.registerBlock(Crusher);
|
||||
|
||||
//Add ItemMulti into the itemsList array for BlockMulti
|
||||
//Add block items into itemsList for blocks with multiple IDs.
|
||||
Item.itemsList[multiBlockID] = new ItemMulti(multiBlockID - 256, MultiBlock).setItemName("MultiBlock");
|
||||
Item.itemsList[machineBlockID] = new ItemMachine(machineBlockID - 256, MachineBlock).setItemName("MachineBlock");
|
||||
Item.itemsList[oreBlockID] = new ItemOre(oreBlockID - 256, OreBlock).setItemName("OreBlock");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -845,6 +861,13 @@ public class ObsidianIngots
|
|||
GameRegistry.addShapelessRecipe(new ItemStack(EnrichedAlloy, 1), new Object[] {
|
||||
Item.redstone, Item.lightStoneDust, IronDust, GoldDust, ObsidianDust, PlatinumDust
|
||||
});
|
||||
|
||||
MachineRecipes.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(IronDust, 2));
|
||||
MachineRecipes.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(GoldDust, 2));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(IronDust, 2), new ItemStack(Block.oreIron));
|
||||
MachineRecipes.addCombinerRecipe(new ItemStack(GoldDust, 2), new ItemStack(Block.oreGold));
|
||||
MachineRecipes.addCrusherRecipe(new ItemStack(Item.ingotIron), new ItemStack(IronDust));
|
||||
MachineRecipes.addCrusherRecipe(new ItemStack(Item.ingotGold), new ItemStack(GoldDust));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -882,6 +905,7 @@ public class ObsidianIngots
|
|||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
//Set the mod's configuration
|
||||
configuration = new Configuration(event.getSuggestedConfigurationFile());
|
||||
//Register the mod's ore handler
|
||||
GameRegistry.registerWorldGenerator(new OreHandler());
|
||||
|
|
|
@ -35,7 +35,7 @@ public class OreHandler implements IWorldGenerator
|
|||
int randPosX = chunkX + random.nextInt(16);
|
||||
int randPosY = random.nextInt(60);
|
||||
int randPosZ = chunkZ + random.nextInt(16);
|
||||
(new WorldGenMinable(new ItemStack(ObsidianIngots.MultiBlock, 1, 0).itemID, 8)).generate(world, random, randPosX, randPosY, randPosZ);
|
||||
(new WorldGenMinable(new ItemStack(ObsidianIngots.OreBlock, 1, 0).itemID, 8)).generate(world, random, randPosX, randPosY, randPosZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class PlatinumCompressorRecipes
|
||||
{
|
||||
private static final PlatinumCompressorRecipes smeltingBase = new PlatinumCompressorRecipes();
|
||||
|
||||
/** The list of smelting results. */
|
||||
private Map smeltingList = new HashMap();
|
||||
private Map metaSmeltingList = new HashMap();
|
||||
|
||||
/**
|
||||
* Used to call methods addSmelting and getSmeltingResult.
|
||||
*/
|
||||
public static final PlatinumCompressorRecipes smelting()
|
||||
{
|
||||
return smeltingBase;
|
||||
}
|
||||
|
||||
private PlatinumCompressorRecipes()
|
||||
{
|
||||
addSmelting(Item.redstone.shiftedIndex, new ItemStack(ObsidianIngots.RedstoneIngot, 1));
|
||||
addSmelting(ObsidianIngots.ObsidianDust.shiftedIndex, new ItemStack(ObsidianIngots.ObsidianIngot, 1));
|
||||
addSmelting(ObsidianIngots.PlatinumDust.shiftedIndex, new ItemStack(ObsidianIngots.PlatinumIngot, 1));
|
||||
addSmelting(ObsidianIngots.IronDust.shiftedIndex, new ItemStack(Item.ingotIron, 1));
|
||||
addSmelting(ObsidianIngots.GoldDust.shiftedIndex, new ItemStack(Item.ingotGold, 1));
|
||||
addSmelting(Item.lightStoneDust.shiftedIndex, new ItemStack(ObsidianIngots.GlowstoneIngot, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe.
|
||||
*/
|
||||
public void addSmelting(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.smeltingList.put(Integer.valueOf(par1), par2ItemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smelting result of an item.
|
||||
* Deprecated in favor of a metadata sensitive version
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack getSmeltingResult(int par1)
|
||||
{
|
||||
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
public Map getSmeltingList()
|
||||
{
|
||||
return this.smeltingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a metadata-sensitive furnace recipe
|
||||
* @param itemID The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @param itemstack The ItemStack for the result
|
||||
*/
|
||||
public void addSmelting(int itemID, int metadata, ItemStack itemstack)
|
||||
{
|
||||
metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the resulting ItemStack form a source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public ItemStack getSmeltingResult(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
|
||||
}
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class TileEntityCombiner extends TileEntityMachine
|
||||
{
|
||||
public static List recipes = new Vector();
|
||||
|
||||
public TileEntityCombiner()
|
||||
{
|
||||
super(200, "Combiner");
|
||||
|
@ -25,19 +30,19 @@ public class TileEntityCombiner extends TileEntityMachine
|
|||
{
|
||||
if (machineBurnTime == 0 && canSmelt())
|
||||
{
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(inventory[1]);
|
||||
|
||||
if (machineBurnTime > 0)
|
||||
{
|
||||
var2 = true;
|
||||
|
||||
if (machineItemStacks[1] != null)
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
--machineItemStacks[1].stackSize;
|
||||
--inventory[1].stackSize;
|
||||
|
||||
if (machineItemStacks[1].stackSize == 0)
|
||||
if (inventory[1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[1] = null;
|
||||
inventory[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,42 +79,64 @@ public class TileEntityCombiner extends TileEntityMachine
|
|||
|
||||
public boolean canSmelt()
|
||||
{
|
||||
if (machineItemStacks[0] == null)
|
||||
if (inventory[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemstack = MachineRecipes.getOutput(inventory[0], false, recipes);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!inventory[2].isItemEqual(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
if (var1 == null) return false;
|
||||
if (machineItemStacks[2] == null) return true;
|
||||
if (!machineItemStacks[2].isItemEqual(var1)) return false;
|
||||
int result = machineItemStacks[2].stackSize + var1.stackSize;
|
||||
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
|
||||
return inventory[2].stackSize + itemstack.stackSize <= inventory[2].getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void smeltItem()
|
||||
{
|
||||
if (canSmelt())
|
||||
if (!canSmelt())
|
||||
{
|
||||
ItemStack var1 = CombinerRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (machineItemStacks[2] == null)
|
||||
{
|
||||
machineItemStacks[2] = var1.copy();
|
||||
}
|
||||
else if (machineItemStacks[2].isItemEqual(var1))
|
||||
{
|
||||
machineItemStacks[2].stackSize += var1.stackSize;
|
||||
}
|
||||
ItemStack itemstack;
|
||||
|
||||
--machineItemStacks[0].stackSize;
|
||||
if (inventory[0].getItem().hasContainerItem())
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], false, recipes).copy();
|
||||
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], true, recipes).copy();
|
||||
}
|
||||
|
||||
if (machineItemStacks[0].stackSize <= 0)
|
||||
{
|
||||
machineItemStacks[0] = null;
|
||||
}
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
inventory[2] = itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory[2].stackSize += itemstack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class TileEntityCrusher extends TileEntityMachine
|
||||
{
|
||||
public static List recipes = new Vector();
|
||||
|
||||
public TileEntityCrusher()
|
||||
{
|
||||
super(200, "Crusher");
|
||||
|
@ -25,19 +30,19 @@ public class TileEntityCrusher extends TileEntityMachine
|
|||
{
|
||||
if (machineBurnTime == 0 && canSmelt())
|
||||
{
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(inventory[1]);
|
||||
|
||||
if (machineBurnTime > 0)
|
||||
{
|
||||
var2 = true;
|
||||
|
||||
if (machineItemStacks[1] != null)
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
--machineItemStacks[1].stackSize;
|
||||
--inventory[1].stackSize;
|
||||
|
||||
if (machineItemStacks[1].stackSize == 0)
|
||||
if (inventory[1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[1] = null;
|
||||
inventory[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,42 +79,64 @@ public class TileEntityCrusher extends TileEntityMachine
|
|||
|
||||
public boolean canSmelt()
|
||||
{
|
||||
if (machineItemStacks[0] == null)
|
||||
if (inventory[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemstack = MachineRecipes.getOutput(inventory[0], false, recipes);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!inventory[2].isItemEqual(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
if (var1 == null) return false;
|
||||
if (machineItemStacks[2] == null) return true;
|
||||
if (!machineItemStacks[2].isItemEqual(var1)) return false;
|
||||
int result = machineItemStacks[2].stackSize + var1.stackSize;
|
||||
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
|
||||
return inventory[2].stackSize + itemstack.stackSize <= inventory[2].getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void smeltItem()
|
||||
{
|
||||
if (canSmelt())
|
||||
if (!canSmelt())
|
||||
{
|
||||
ItemStack var1 = CrusherRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (machineItemStacks[2] == null)
|
||||
{
|
||||
machineItemStacks[2] = var1.copy();
|
||||
}
|
||||
else if (machineItemStacks[2].isItemEqual(var1))
|
||||
{
|
||||
machineItemStacks[2].stackSize += var1.stackSize;
|
||||
}
|
||||
ItemStack itemstack;
|
||||
|
||||
--machineItemStacks[0].stackSize;
|
||||
if (inventory[0].getItem().hasContainerItem())
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], false, recipes).copy();
|
||||
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], true, recipes).copy();
|
||||
}
|
||||
|
||||
if (machineItemStacks[0].stackSize <= 0)
|
||||
{
|
||||
machineItemStacks[0] = null;
|
||||
}
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
inventory[2] = itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory[2].stackSize += itemstack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
@ -8,6 +11,8 @@ import net.minecraft.src.*;
|
|||
|
||||
public class TileEntityEnrichmentChamber extends TileEntityMachine
|
||||
{
|
||||
public static List recipes = new Vector();
|
||||
|
||||
public TileEntityEnrichmentChamber()
|
||||
{
|
||||
super(200, "Enrichment Chamber");
|
||||
|
@ -27,19 +32,19 @@ public class TileEntityEnrichmentChamber extends TileEntityMachine
|
|||
{
|
||||
if (machineBurnTime == 0 && canSmelt())
|
||||
{
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(inventory[1]);
|
||||
|
||||
if (machineBurnTime > 0)
|
||||
{
|
||||
var2 = true;
|
||||
|
||||
if (machineItemStacks[1] != null)
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
--machineItemStacks[1].stackSize;
|
||||
--inventory[1].stackSize;
|
||||
|
||||
if (machineItemStacks[1].stackSize == 0)
|
||||
if (inventory[1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[1] = null;
|
||||
inventory[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,42 +81,64 @@ public class TileEntityEnrichmentChamber extends TileEntityMachine
|
|||
|
||||
public boolean canSmelt()
|
||||
{
|
||||
if (machineItemStacks[0] == null)
|
||||
if (inventory[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemstack = MachineRecipes.getOutput(inventory[0], false, recipes);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!inventory[2].isItemEqual(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
if (var1 == null) return false;
|
||||
if (machineItemStacks[2] == null) return true;
|
||||
if (!machineItemStacks[2].isItemEqual(var1)) return false;
|
||||
int result = machineItemStacks[2].stackSize + var1.stackSize;
|
||||
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
|
||||
return inventory[2].stackSize + itemstack.stackSize <= inventory[2].getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void smeltItem()
|
||||
{
|
||||
if (canSmelt())
|
||||
if (!canSmelt())
|
||||
{
|
||||
ItemStack var1 = EnrichmentChamberRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (machineItemStacks[2] == null)
|
||||
{
|
||||
machineItemStacks[2] = var1.copy();
|
||||
}
|
||||
else if (machineItemStacks[2].isItemEqual(var1))
|
||||
{
|
||||
machineItemStacks[2].stackSize += var1.stackSize;
|
||||
}
|
||||
ItemStack itemstack;
|
||||
|
||||
--machineItemStacks[0].stackSize;
|
||||
if (inventory[0].getItem().hasContainerItem())
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], false, recipes).copy();
|
||||
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], true, recipes).copy();
|
||||
}
|
||||
|
||||
if (machineItemStacks[0].stackSize <= 0)
|
||||
{
|
||||
machineItemStacks[0] = null;
|
||||
}
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
inventory[2] = itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory[2].stackSize += itemstack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import ic2.api.IWrenchable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
@ -10,13 +12,11 @@ import cpw.mods.fml.server.FMLServerHandler;
|
|||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.uberkat.obsidian.client.AudioManager;
|
||||
import net.uberkat.obsidian.client.AudioSource;
|
||||
|
||||
public abstract class TileEntityMachine extends TileEntity implements IInventory, ISidedInventory, INetworkedMachine
|
||||
public abstract class TileEntityMachine extends TileEntity implements IInventory, ISidedInventory, INetworkedMachine, IWrenchable
|
||||
{
|
||||
/** The ItemStacks that hold the items currently being used in the furnace */
|
||||
protected ItemStack[] machineItemStacks = new ItemStack[3];
|
||||
protected ItemStack[] inventory = new ItemStack[3];
|
||||
|
||||
/** The number of ticks that the furnace will keep burning */
|
||||
public int machineBurnTime = 0;
|
||||
|
@ -80,12 +80,12 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return machineItemStacks.length;
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int var1)
|
||||
{
|
||||
return machineItemStacks[var1];
|
||||
return inventory[var1];
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
|
@ -150,23 +150,23 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
{
|
||||
if (machineItemStacks[par1] != null)
|
||||
if (inventory[par1] != null)
|
||||
{
|
||||
ItemStack var3;
|
||||
|
||||
if (machineItemStacks[par1].stackSize <= par2)
|
||||
if (inventory[par1].stackSize <= par2)
|
||||
{
|
||||
var3 = machineItemStacks[par1];
|
||||
machineItemStacks[par1] = null;
|
||||
var3 = inventory[par1];
|
||||
inventory[par1] = null;
|
||||
return var3;
|
||||
}
|
||||
else
|
||||
{
|
||||
var3 = machineItemStacks[par1].splitStack(par2);
|
||||
var3 = inventory[par1].splitStack(par2);
|
||||
|
||||
if (machineItemStacks[par1].stackSize == 0)
|
||||
if (inventory[par1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[par1] = null;
|
||||
inventory[par1] = null;
|
||||
}
|
||||
|
||||
return var3;
|
||||
|
@ -180,10 +180,10 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
|
||||
public ItemStack getStackInSlotOnClosing(int par1)
|
||||
{
|
||||
if (machineItemStacks[par1] != null)
|
||||
if (inventory[par1] != null)
|
||||
{
|
||||
ItemStack var2 = machineItemStacks[par1];
|
||||
machineItemStacks[par1] = null;
|
||||
ItemStack var2 = inventory[par1];
|
||||
inventory[par1] = null;
|
||||
return var2;
|
||||
}
|
||||
else
|
||||
|
@ -194,7 +194,7 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
machineItemStacks[par1] = par2ItemStack;
|
||||
inventory[par1] = par2ItemStack;
|
||||
|
||||
if (par2ItemStack != null && par2ItemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
prevActive = active;
|
||||
}
|
||||
|
||||
public void setFacing(int direction)
|
||||
public void setFacing(short direction)
|
||||
{
|
||||
facing = direction;
|
||||
|
||||
|
@ -270,16 +270,16 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
if (var5 >= 0 && var5 < inventory.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
inventory[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,13 +300,13 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
par1NBTTagCompound.setInteger("facing", facing);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
for (int var3 = 0; var3 < inventory.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
if (inventory[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
inventory[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
@ -335,4 +335,24 @@ public abstract class TileEntityMachine extends TileEntity implements IInventory
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean wrenchCanRemove(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public short getFacing()
|
||||
{
|
||||
return (short)facing;
|
||||
}
|
||||
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityplayer, int i)
|
||||
{
|
||||
return facing != i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
@ -10,6 +13,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
public class TileEntityPlatinumCompressor extends TileEntityMachine
|
||||
{
|
||||
public static List recipes = new Vector();
|
||||
|
||||
public TileEntityPlatinumCompressor()
|
||||
{
|
||||
super(200, "Platinum Compressor");
|
||||
|
@ -29,19 +34,19 @@ public class TileEntityPlatinumCompressor extends TileEntityMachine
|
|||
{
|
||||
if (machineBurnTime == 0 && canSmelt())
|
||||
{
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(inventory[1]);
|
||||
|
||||
if (machineBurnTime > 0)
|
||||
{
|
||||
var2 = true;
|
||||
|
||||
if (machineItemStacks[1] != null)
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
--machineItemStacks[1].stackSize;
|
||||
--inventory[1].stackSize;
|
||||
|
||||
if (machineItemStacks[1].stackSize == 0)
|
||||
if (inventory[1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[1] = null;
|
||||
inventory[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,42 +83,64 @@ public class TileEntityPlatinumCompressor extends TileEntityMachine
|
|||
|
||||
public boolean canSmelt()
|
||||
{
|
||||
if (machineItemStacks[0] == null)
|
||||
if (inventory[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemstack = MachineRecipes.getOutput(inventory[0], false, recipes);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!inventory[2].isItemEqual(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
if (var1 == null) return false;
|
||||
if (machineItemStacks[2] == null) return true;
|
||||
if (!machineItemStacks[2].isItemEqual(var1)) return false;
|
||||
int result = machineItemStacks[2].stackSize + var1.stackSize;
|
||||
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
|
||||
return inventory[2].stackSize + itemstack.stackSize <= inventory[2].getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void smeltItem()
|
||||
{
|
||||
if (canSmelt())
|
||||
if (!canSmelt())
|
||||
{
|
||||
ItemStack var1 = PlatinumCompressorRecipes.smelting().getSmeltingResult(machineItemStacks[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (machineItemStacks[2] == null)
|
||||
{
|
||||
machineItemStacks[2] = var1.copy();
|
||||
}
|
||||
else if (machineItemStacks[2].isItemEqual(var1))
|
||||
{
|
||||
machineItemStacks[2].stackSize += var1.stackSize;
|
||||
}
|
||||
ItemStack itemstack;
|
||||
|
||||
--machineItemStacks[0].stackSize;
|
||||
if (inventory[0].getItem().hasContainerItem())
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], false, recipes).copy();
|
||||
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = MachineRecipes.getOutput(inventory[0], true, recipes).copy();
|
||||
}
|
||||
|
||||
if (machineItemStacks[0].stackSize <= 0)
|
||||
{
|
||||
machineItemStacks[0] = null;
|
||||
}
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
inventory[2] = itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory[2].stackSize += itemstack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +161,7 @@ public class TileEntityPlatinumCompressor extends TileEntityMachine
|
|||
|
||||
public void getBurnTime()
|
||||
{
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = getItemBurnTime(inventory[1]);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -30,19 +32,19 @@ public class TileEntityTheoreticalElementizer extends TileEntityMachine
|
|||
{
|
||||
if (machineBurnTime == 0 && canSmelt())
|
||||
{
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
currentItemBurnTime = machineBurnTime = getItemBurnTime(inventory[1]);
|
||||
|
||||
if (machineBurnTime > 0)
|
||||
{
|
||||
var2 = true;
|
||||
|
||||
if (machineItemStacks[1] != null)
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
--machineItemStacks[1].stackSize;
|
||||
--inventory[1].stackSize;
|
||||
|
||||
if (machineItemStacks[1].stackSize == 0)
|
||||
if (inventory[1].stackSize == 0)
|
||||
{
|
||||
machineItemStacks[1] = null;
|
||||
inventory[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,18 +81,18 @@ public class TileEntityTheoreticalElementizer extends TileEntityMachine
|
|||
|
||||
public boolean canSmelt()
|
||||
{
|
||||
if (machineItemStacks[0] == null)
|
||||
if (inventory[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(machineItemStacks[2] != null)
|
||||
else if(inventory[2] != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (machineItemStacks[0].getItem().shiftedIndex != ObsidianIngots.EnrichedAlloy.shiftedIndex) return false;
|
||||
if (machineItemStacks[2] == null) return true;
|
||||
if (inventory[0].getItem().shiftedIndex != ObsidianIngots.EnrichedAlloy.shiftedIndex) return false;
|
||||
if (inventory[2] == null) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -101,16 +103,16 @@ public class TileEntityTheoreticalElementizer extends TileEntityMachine
|
|||
{
|
||||
ItemStack itemstack = new ItemStack(getRandomMagicItem(), 1);
|
||||
|
||||
if (machineItemStacks[2] == null)
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
machineItemStacks[2] = itemstack.copy();
|
||||
inventory[2] = itemstack.copy();
|
||||
}
|
||||
|
||||
--machineItemStacks[0].stackSize;
|
||||
--inventory[0].stackSize;
|
||||
|
||||
if (machineItemStacks[0].stackSize <= 0)
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
machineItemStacks[0] = null;
|
||||
inventory[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraft.src.SoundManager;
|
||||
import net.uberkat.obsidian.common.Sound;
|
||||
|
||||
import paulscode.sound.SoundSystem;
|
||||
|
||||
public class AudioManager
|
||||
{
|
||||
public static SoundSystem system;
|
||||
public static float defaultVolume = 1.2F;
|
||||
public static float fadingDistance = 16F;
|
||||
public static float masterVolume = 0.5F;
|
||||
public static int nextId = 0;
|
||||
|
||||
public static void getSoundSystem()
|
||||
{
|
||||
Field afield[] = (SoundManager.class).getDeclaredFields();
|
||||
int i = afield.length;
|
||||
int j = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (j >= i)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Field field = afield[j];
|
||||
|
||||
if (field.getType() == (paulscode.sound.SoundSystem.class))
|
||||
{
|
||||
field.setAccessible(true);
|
||||
|
||||
try
|
||||
{
|
||||
Object obj = field.get(null);
|
||||
|
||||
if (obj instanceof SoundSystem)
|
||||
{
|
||||
system = (SoundSystem)obj;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
system = null;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
public static AudioSource getSource(Sound sound)
|
||||
{
|
||||
if (system == null)
|
||||
{
|
||||
getSoundSystem();
|
||||
}
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String id = getSourceName(nextId);
|
||||
nextId++;
|
||||
AudioSource audiosource = new AudioSource(system, sound, id);
|
||||
|
||||
return audiosource;
|
||||
}
|
||||
|
||||
private static String getSourceName(int i)
|
||||
{
|
||||
return (new StringBuilder()).append("asm_snd").append(i).toString();
|
||||
}
|
||||
|
||||
public static void playSoundOnce(Sound sound)
|
||||
{
|
||||
URL url = (SoundHandler.class).getClassLoader().getResource((new StringBuilder()).append("sounds/").append(sound.name).toString());
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
getSoundSystem();
|
||||
}
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String audio = system.quickPlay(false, url, sound.name, false, sound.x, sound.y, sound.z, 2, fadingDistance * Math.max(defaultVolume, 1.0F));
|
||||
system.setVolume(audio, masterVolume * defaultVolume);
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
|
||||
import paulscode.sound.SoundSystem;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.Sound;
|
||||
|
||||
public class AudioSource
|
||||
{
|
||||
public boolean isPlaying;
|
||||
public int xPos;
|
||||
public int yPos;
|
||||
public int zPos;
|
||||
public int soundTicks;
|
||||
public SoundSystem system;
|
||||
public String sourceName;
|
||||
public boolean valid;
|
||||
|
||||
public AudioSource(SoundSystem sys, Sound sound, String id)
|
||||
{
|
||||
valid = false;
|
||||
sourceName = sound.name;
|
||||
system = sys;
|
||||
xPos = sound.x;
|
||||
yPos = sound.y;
|
||||
zPos = sound.z;
|
||||
isPlaying = false;
|
||||
URL url = (AudioSource.class).getClassLoader().getResource((new StringBuilder()).append("sounds/").append(sound.name).toString());
|
||||
if(url != null)
|
||||
{
|
||||
sys.newSource(false, sound.name, url, id, false, sound.x, sound.y, sound.z, 0, AudioManager.fadingDistance * Math.max(AudioManager.defaultVolume, 1.0F));
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void activate()
|
||||
{
|
||||
if(valid)
|
||||
{
|
||||
system.activate(sourceName);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove()
|
||||
{
|
||||
if(valid)
|
||||
{
|
||||
stopSound();
|
||||
system.removeSource(sourceName);
|
||||
sourceName = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void playSound()
|
||||
{
|
||||
if(!isPlaying)
|
||||
{
|
||||
system.play(sourceName);
|
||||
isPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.pause(sourceName);
|
||||
isPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.stop(sourceName);
|
||||
isPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void flushSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.flush(sourceName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,25 +79,25 @@ public class ClientProxy extends CommonProxy
|
|||
{
|
||||
switch(ID)
|
||||
{
|
||||
case 18:
|
||||
case 0:
|
||||
return new GuiStopwatch(player);
|
||||
case 19:
|
||||
case 1:
|
||||
return new GuiCredits();
|
||||
case 20:
|
||||
case 2:
|
||||
return new GuiWeatherOrb(player);
|
||||
case 21:
|
||||
case 3:
|
||||
TileEntityEnrichmentChamber tileentity = (TileEntityEnrichmentChamber)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiEnrichmentChamber(player.inventory, tileentity);
|
||||
case 22:
|
||||
case 4:
|
||||
TileEntityPlatinumCompressor tileentity1 = (TileEntityPlatinumCompressor)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiPlatinumCompressor(player.inventory, tileentity1);
|
||||
case 23:
|
||||
case 5:
|
||||
TileEntityCombiner tileentity2 = (TileEntityCombiner)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiCombiner(player.inventory, tileentity2);
|
||||
case 24:
|
||||
case 6:
|
||||
TileEntityCrusher tileentity3 = (TileEntityCrusher)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiCrusher(player.inventory, tileentity3);
|
||||
case 25:
|
||||
case 7:
|
||||
TileEntityTheoreticalElementizer tileentity4 = (TileEntityTheoreticalElementizer)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiTheoreticalElementizer(player.inventory, tileentity4);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.uberkat.obsidian.client;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.BlockCombiner;
|
||||
import net.uberkat.obsidian.common.ContainerCombiner;
|
||||
import net.uberkat.obsidian.common.TileEntityCombiner;
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package net.uberkat.obsidian.client;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.BlockCrusher;
|
||||
import net.uberkat.obsidian.common.BlockTheoreticalElementizer;
|
||||
import net.uberkat.obsidian.common.ContainerCrusher;
|
||||
import net.uberkat.obsidian.common.TileEntityCrusher;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.uberkat.obsidian.client;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.BlockEnrichmentChamber;
|
||||
import net.uberkat.obsidian.common.ContainerEnrichmentChamber;
|
||||
import net.uberkat.obsidian.common.TileEntityEnrichmentChamber;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.uberkat.obsidian.client;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.BlockPlatinumCompressor;
|
||||
import net.uberkat.obsidian.common.ContainerPlatinumCompressor;
|
||||
import net.uberkat.obsidian.common.TileEntityPlatinumCompressor;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.uberkat.obsidian.client;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.BlockTheoreticalElementizer;
|
||||
import net.uberkat.obsidian.common.ContainerTheoreticalElementizer;
|
||||
import net.uberkat.obsidian.common.TileEntityTheoreticalElementizer;
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
public class SoundHandler
|
||||
{
|
||||
public static final SoundHandler instance = new SoundHandler();
|
||||
|
||||
public final URL[] sounds = { getURL("chamber.ogg"), getURL("combiner.ogg"), getURL("compressor.ogg"), getURL("crusher.ogg"), getURL("elementizer.ogg") };
|
||||
|
||||
@ForgeSubscribe
|
||||
public void loadSoundEvents(SoundLoadEvent event)
|
||||
{
|
||||
for(int i = 0; i < sounds.length; i++)
|
||||
{
|
||||
URL url = getClass().getResource("/obsidian/" + sounds[i]);
|
||||
event.manager.soundPoolSounds.addSound("obsidian/" + sounds[i], url);
|
||||
|
||||
if(url != null)
|
||||
continue;
|
||||
System.err.println("[ObsidianIngots] Error loading sound file '" + sounds[i] + ".'");
|
||||
}
|
||||
}
|
||||
|
||||
public URL getURL(String url)
|
||||
{
|
||||
return getClass().getResource("/obsidian/" + url);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue