Major Refactors

This commit is contained in:
oitsjustjose 2016-01-13 22:13:42 -05:00
commit f293f55c6b
67 changed files with 431 additions and 937 deletions

View file

@ -5,23 +5,20 @@ import com.oitsjustjose.criss_cross.lib.CreativeTab;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.lib.LibBlocks; import com.oitsjustjose.criss_cross.lib.LibBlocks;
import com.oitsjustjose.criss_cross.lib.LibItems; import com.oitsjustjose.criss_cross.lib.LibItems;
import com.oitsjustjose.criss_cross.recipes.MachineRecipes;
import com.oitsjustjose.criss_cross.recipes.CraftingRecipes; import com.oitsjustjose.criss_cross.recipes.CraftingRecipes;
import com.oitsjustjose.criss_cross.recipes.MachineRecipes;
import com.oitsjustjose.criss_cross.util.ClientProxy; import com.oitsjustjose.criss_cross.util.ClientProxy;
import com.oitsjustjose.criss_cross.util.CommonProxy; import com.oitsjustjose.criss_cross.util.CommonProxy;
import com.oitsjustjose.criss_cross.util.LogHelper; import com.oitsjustjose.criss_cross.util.LogHelper;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.oredict.OreDictionary;
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, acceptedMinecraftVersions = "1.8.8, 1.8.9") @Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, acceptedMinecraftVersions = "1.8.8, 1.8.9")
public class CrissCross public class CrissCross
@ -39,21 +36,21 @@ public class CrissCross
{ {
Config.init(event.getSuggestedConfigurationFile()); Config.init(event.getSuggestedConfigurationFile());
MinecraftForge.EVENT_BUS.register(new Config()); MinecraftForge.EVENT_BUS.register(new Config());
proxy.preInit(); CommonProxy.preInit();
LibBlocks.init(); LibBlocks.init();
LibItems.init(); LibItems.init();
CraftingRecipes.init(); CraftingRecipes.init();
} }
@EventHandler @EventHandler
public void postInit(FMLPostInitializationEvent event) public void postInit(FMLPostInitializationEvent event)
{ {
MachineRecipes.init(); MachineRecipes.init();
if (event.getSide().isClient()) if (event.getSide().isClient())
ClientProxy.init(); ClientProxy.init();
LogHelper.info("Successfully loaded!"); LogHelper.info("Successfully loaded!");
} }
} }

View file

@ -16,30 +16,29 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class BlockAtmosManipulator extends BlockMachineBase public class BlockAtmosManipulator extends BlockMachineBase
{ {
private static String unlocName = "AtmosManipulator"; private static String unlocName = "AtmosManipulator";
public BlockAtmosManipulator() public BlockAtmosManipulator()
{ {
super(unlocName, Material.iron); super(unlocName, Material.iron);
GameRegistry.registerTileEntity(TileAtmosManipulator.class, unlocName); GameRegistry.registerTileEntity(TileAtmosManipulator.class, unlocName);
GameRegistry.registerBlock(this, unlocName.toLowerCase()); GameRegistry.registerBlock(this, unlocName.toLowerCase());
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TileAtmosManipulator(); return new TileAtmosManipulator();
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if(world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileAtmosManipulator tile = (TileAtmosManipulator) world.getTileEntity(pos); TileAtmosManipulator tile = (TileAtmosManipulator) world.getTileEntity(pos);
if(tile != null) if (tile != null)
player.openGui(CrissCross.instance, GUIHandler.AtmosManipulator, world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(CrissCross.instance, GUIHandler.AtmosManipulator, world, pos.getX(), pos.getY(), pos.getZ());
return true; return true;
} }

View file

@ -1,28 +1,18 @@
package com.oitsjustjose.criss_cross.blocks; package com.oitsjustjose.criss_cross.blocks;
import java.util.Random;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.gui.GUIHandler; import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen; import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCobblegen extends BlockMachineBase public class BlockCobblegen extends BlockMachineBase
{ {
@ -60,9 +50,7 @@ public class BlockCobblegen extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileCobblegen tile = (TileCobblegen) world.getTileEntity(pos); TileCobblegen tile = (TileCobblegen) world.getTileEntity(pos);

View file

@ -1,29 +1,18 @@
package com.oitsjustjose.criss_cross.blocks; package com.oitsjustjose.criss_cross.blocks;
import java.util.Random;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.gui.GUIHandler; import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.tileentity.TileCropomator; import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCropomator extends BlockMachineBase public class BlockCropomator extends BlockMachineBase
{ {
@ -61,9 +50,7 @@ public class BlockCropomator extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileCropomator tile = (TileCropomator) world.getTileEntity(pos); TileCropomator tile = (TileCropomator) world.getTileEntity(pos);

View file

@ -1,28 +1,18 @@
package com.oitsjustjose.criss_cross.blocks; package com.oitsjustjose.criss_cross.blocks;
import java.util.Random;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.gui.GUIHandler; import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor; import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockElectroextractor extends BlockMachineBase public class BlockElectroextractor extends BlockMachineBase
{ {
@ -60,9 +50,7 @@ public class BlockElectroextractor extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileElectroextractor tile = (TileElectroextractor) world.getTileEntity(pos); TileElectroextractor tile = (TileElectroextractor) world.getTileEntity(pos);

View file

@ -11,7 +11,6 @@ import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
@ -36,7 +35,7 @@ public class BlockMachineBase extends BlockContainer
this.setStepSound(soundTypeMetal); this.setStepSound(soundTypeMetal);
this.setUnlocalizedName(Lib.MODID + "." + unlocName); this.setUnlocalizedName(Lib.MODID + "." + unlocName);
this.setCreativeTab(CrissCross.CCTab); this.setCreativeTab(CrissCross.CCTab);
this.unlocalizedName = unlocName; BlockMachineBase.unlocalizedName = unlocName;
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
Lib.add(this); Lib.add(this);
} }
@ -46,12 +45,12 @@ public class BlockMachineBase extends BlockContainer
{ {
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
return false; return false;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
@ -78,6 +77,7 @@ public class BlockMachineBase extends BlockContainer
return 3; return 3;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IBlockState getStateForEntityRender(IBlockState state) public IBlockState getStateForEntityRender(IBlockState state)
{ {
@ -90,9 +90,7 @@ public class BlockMachineBase extends BlockContainer
EnumFacing enumfacing = EnumFacing.getFront(meta); EnumFacing enumfacing = EnumFacing.getFront(meta);
if (enumfacing.getAxis() == EnumFacing.Axis.Y) if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
enumfacing = EnumFacing.NORTH; enumfacing = EnumFacing.NORTH;
}
return this.getDefaultState().withProperty(FACING, enumfacing); return this.getDefaultState().withProperty(FACING, enumfacing);
} }
@ -100,7 +98,7 @@ public class BlockMachineBase extends BlockContainer
@Override @Override
public int getMetaFromState(IBlockState state) public int getMetaFromState(IBlockState state)
{ {
return ((EnumFacing) state.getValue(FACING)).getIndex(); return state.getValue(FACING).getIndex();
} }
@Override @Override
@ -114,27 +112,19 @@ public class BlockMachineBase extends BlockContainer
{ {
world.setBlockState(pos, state.withProperty(FACING, entity.getHorizontalFacing().getOpposite()), 2); world.setBlockState(pos, state.withProperty(FACING, entity.getHorizontalFacing().getOpposite()), 2);
int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int l = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (l == 0) if (l == 0)
{
world.setBlockState(pos, state.getBlock().getStateFromMeta(2), 2); world.setBlockState(pos, state.getBlock().getStateFromMeta(2), 2);
}
if (l == 1) if (l == 1)
{
world.setBlockState(pos, state.getBlock().getStateFromMeta(5), 2); world.setBlockState(pos, state.getBlock().getStateFromMeta(5), 2);
}
if (l == 2) if (l == 2)
{
world.setBlockState(pos, state.getBlock().getStateFromMeta(3), 2); world.setBlockState(pos, state.getBlock().getStateFromMeta(3), 2);
}
if (l == 3) if (l == 3)
{
world.setBlockState(pos, state.getBlock().getStateFromMeta(4), 2); world.setBlockState(pos, state.getBlock().getStateFromMeta(4), 2);
}
} }
private void setDefaultFacing(World world, BlockPos pos, IBlockState state) private void setDefaultFacing(World world, BlockPos pos, IBlockState state)
@ -145,23 +135,15 @@ public class BlockMachineBase extends BlockContainer
Block block1 = world.getBlockState(pos.south()).getBlock(); Block block1 = world.getBlockState(pos.south()).getBlock();
Block block2 = world.getBlockState(pos.west()).getBlock(); Block block2 = world.getBlockState(pos.west()).getBlock();
Block block3 = world.getBlockState(pos.east()).getBlock(); Block block3 = world.getBlockState(pos.east()).getBlock();
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING); EnumFacing enumfacing = state.getValue(FACING);
if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock())
{
enumfacing = EnumFacing.SOUTH; enumfacing = EnumFacing.SOUTH;
}
else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock())
{
enumfacing = EnumFacing.NORTH; enumfacing = EnumFacing.NORTH;
}
else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock())
{
enumfacing = EnumFacing.EAST; enumfacing = EnumFacing.EAST;
}
else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock())
{
enumfacing = EnumFacing.WEST; enumfacing = EnumFacing.WEST;
}
world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
} }

View file

@ -9,7 +9,6 @@ import com.oitsjustjose.criss_cross.tileentity.TileScribe;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
@ -31,31 +30,26 @@ public class BlockScribe extends BlockMachineBase
GameRegistry.registerBlock(this, unlocName.toLowerCase()); GameRegistry.registerBlock(this, unlocName.toLowerCase());
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{ {
super.randomDisplayTick(worldIn, pos, state, rand); super.randomDisplayTick(worldIn, pos, state, rand);
for (int i = -2; i <= 2; ++i) for (int i = -2; i <= 2; ++i)
{
for (int j = -2; j <= 2; ++j) for (int j = -2; j <= 2; ++j)
{ {
if (i > -2 && i < 2 && j == -1) if (i > -2 && i < 2 && j == -1)
j = 2; j = 2;
if (rand.nextInt(16) == 0) if (rand.nextInt(16) == 0)
{
for (int k = 0; k <= 1; ++k) for (int k = 0; k <= 1; ++k)
{ {
BlockPos blockpos = pos.add(i, k, j);
if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2))) if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2)))
break; break;
worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double) pos.getX() + 0.5D, (double) pos.getY() + 2.0D, (double) pos.getZ() + 0.5D, (double) ((float) i + rand.nextFloat()) - 0.5D, (double) ((float) k - rand.nextFloat() - 1.0F), (double) ((float) j + rand.nextFloat()) - 0.5D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, pos.getX() + 0.5D, pos.getY() + 2.0D, pos.getZ() + 0.5D, i + rand.nextFloat() - 0.5D, k - rand.nextFloat() - 1.0F, j + rand.nextFloat() - 0.5D, new int[0]);
} }
}
} }
}
} }
@Override @Override
@ -83,9 +77,7 @@ public class BlockScribe extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileScribe tile = (TileScribe) world.getTileEntity(pos); TileScribe tile = (TileScribe) world.getTileEntity(pos);

View file

@ -3,7 +3,6 @@ package com.oitsjustjose.criss_cross.blocks;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.gui.GUIHandler; import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.tileentity.TileStonegen; import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -51,9 +50,7 @@ public class BlockStonegen extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileStonegen tile = (TileStonegen) world.getTileEntity(pos); TileStonegen tile = (TileStonegen) world.getTileEntity(pos);

View file

@ -1,28 +1,19 @@
package com.oitsjustjose.criss_cross.blocks; package com.oitsjustjose.criss_cross.blocks;
import java.util.Random;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.gui.GUIHandler; import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper; import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockWoodchipper extends BlockMachineBase public class BlockWoodchipper extends BlockMachineBase
{ {
@ -61,9 +52,7 @@ public class BlockWoodchipper extends BlockMachineBase
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.isRemote) if (world.isRemote)
{
return true; return true;
}
else else
{ {
TileWoodchipper tile = (TileWoodchipper) world.getTileEntity(pos); TileWoodchipper tile = (TileWoodchipper) world.getTileEntity(pos);

View file

@ -1,14 +1,10 @@
package com.oitsjustjose.criss_cross.container; package com.oitsjustjose.criss_cross.container;
import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator; import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator;
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerAtmosManipulator extends Container public class ContainerAtmosManipulator extends Container
{ {
@ -22,7 +18,7 @@ public class ContainerAtmosManipulator extends Container
this.player = player; this.player = player;
} }
@Override
public void onCraftGuiOpened(ICrafting crafting) public void onCraftGuiOpened(ICrafting crafting)
{ {
super.onCraftGuiOpened(crafting); super.onCraftGuiOpened(crafting);

View file

@ -35,6 +35,7 @@ public class ContainerCobblegen extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
@ -67,7 +68,7 @@ public class ContainerCobblegen extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.cobblegen.processTime) if (this.lastUseTime != this.cobblegen.processTime)
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime); crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
@ -85,7 +86,7 @@ public class ContainerCobblegen extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -95,9 +96,7 @@ public class ContainerCobblegen extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -106,47 +105,31 @@ public class ContainerCobblegen extends Container
if (TileCobblegen.isValid(itemstack1)) if (TileCobblegen.isValid(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileCobblegen.isItemFuel(itemstack1)) else if (TileCobblegen.isItemFuel(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -35,23 +35,18 @@ public class ContainerCropomator extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
if (timeType1 == 0) if (timeType1 == 0)
{
this.cropomator.processTime = timeType2; this.cropomator.processTime = timeType2;
}
if (timeType1 == 1) if (timeType1 == 1)
{
this.cropomator.catalystTime = timeType2; this.cropomator.catalystTime = timeType2;
}
if (timeType1 == 2) if (timeType1 == 2)
{
this.cropomator.catalystInUseTime = timeType2; this.cropomator.catalystInUseTime = timeType2;
}
} }
@Override @Override
@ -69,7 +64,7 @@ public class ContainerCropomator extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.cropomator.processTime) if (this.lastUseTime != this.cropomator.processTime)
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime); crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
@ -87,7 +82,7 @@ public class ContainerCropomator extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -97,9 +92,7 @@ public class ContainerCropomator extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -108,47 +101,31 @@ public class ContainerCropomator extends Container
if (TileCropomator.isValid(itemstack1)) if (TileCropomator.isValid(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileCropomator.isItemCatalyst(itemstack1)) else if (TileCropomator.isItemCatalyst(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -35,23 +35,18 @@ public class ContainerElectroextractor extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
if (timeType1 == 0) if (timeType1 == 0)
{
this.electroextractor.crushTime = timeType2; this.electroextractor.crushTime = timeType2;
}
if (timeType1 == 1) if (timeType1 == 1)
{
this.electroextractor.fuelTime = timeType2; this.electroextractor.fuelTime = timeType2;
}
if (timeType1 == 2) if (timeType1 == 2)
{
this.electroextractor.fuelInUseTime = timeType2; this.electroextractor.fuelInUseTime = timeType2;
}
} }
@Override @Override
@ -69,7 +64,7 @@ public class ContainerElectroextractor extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.electroextractor.crushTime) if (this.lastUseTime != this.electroextractor.crushTime)
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime); crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
@ -87,7 +82,7 @@ public class ContainerElectroextractor extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -97,9 +92,7 @@ public class ContainerElectroextractor extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -108,47 +101,31 @@ public class ContainerElectroextractor extends Container
if (TileElectroextractor.isValid(itemstack1)) if (TileElectroextractor.isValid(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileElectroextractor.isItemEnergetic(itemstack1)) else if (TileElectroextractor.isItemEnergetic(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -22,54 +22,39 @@ public class ContainerPouch extends Container
int i = 36; int i = 36;
for (int j = 0; j < 6; j++) for (int j = 0; j < 6; j++)
{
for (int k = 0; k < 9; k++) for (int k = 0; k < 9; k++)
{
addSlotToContainer(new PouchSlot(player.inventory, k + j * 9, 8 + k * 18, 18 + j * 18, this.currentFilter)); addSlotToContainer(new PouchSlot(player.inventory, k + j * 9, 8 + k * 18, 18 + j * 18, this.currentFilter));
}
}
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 9; k++) for (int k = 0; k < 9; k++)
{
addSlotToContainer(new Slot(player.inventory, k + j * 9 + 9, 8 + k * 18, 104 + j * 18 + i)); addSlotToContainer(new Slot(player.inventory, k + j * 9 + 9, 8 + k * 18, 104 + j * 18 + i));
}
}
for (int j = 0; j < 9; j++) for (int j = 0; j < 9; j++)
{
if (j == this.currentFilter) if (j == this.currentFilter)
{
addSlotToContainer(new PouchLockedSlot(player.inventory, j, 8 + j * 18, 162 + i)); addSlotToContainer(new PouchLockedSlot(player.inventory, j, 8 + j * 18, 162 + i));
}
else else
{
addSlotToContainer(new Slot(player.inventory, j, 8 + j * 18, 162 + i)); addSlotToContainer(new Slot(player.inventory, j, 8 + j * 18, 162 + i));
}
}
} }
@Override
protected void retrySlotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer) protected void retrySlotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer)
{ {
} }
@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer)
{ {
if ((par3 == 2) && (par2 == this.currentFilter)) if ((par3 == 2) && (par2 == this.currentFilter))
{
return null; return null;
}
ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter); ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter);
if ((filter == null) || (filter.getItem() != LibItems.pouch)) if ((filter == null) || (filter.getItem() != LibItems.pouch))
{
return null; return null;
}
return super.slotClick(par1, par2, par3, par4EntityPlayer); return super.slotClick(par1, par2, par3, par4EntityPlayer);
} }
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2); Slot slot = this.inventorySlots.get(par2);
if ((slot != null) && (slot.getHasStack())) if ((slot != null) && (slot.getHasStack()))
{ {
ItemStack itemstack1 = slot.getStack(); ItemStack itemstack1 = slot.getStack();
@ -77,14 +62,10 @@ public class ContainerPouch extends Container
if (par2 < 54) if (par2 < 54)
{ {
if (!mergeItemStack(itemstack1, 54, this.inventorySlots.size(), true)) if (!mergeItemStack(itemstack1, 54, this.inventorySlots.size(), true))
{
return null; return null;
}
} }
else if (!mergeItemStack(itemstack1, 0, 54, false)) else if (!mergeItemStack(itemstack1, 0, 54, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{ {
slot.putStack(null); slot.putStack(null);
@ -95,6 +76,7 @@ public class ContainerPouch extends Container
return itemstack; return itemstack;
} }
@Override
public boolean canInteractWith(EntityPlayer entityplayer) public boolean canInteractWith(EntityPlayer entityplayer)
{ {
ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter); ItemStack filter = this.player.inventory.getStackInSlot(this.currentFilter);

View file

@ -35,6 +35,7 @@ public class ContainerScribe extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
@ -67,7 +68,7 @@ public class ContainerScribe extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.scribe.writingTime) if (this.lastUseTime != this.scribe.writingTime)
crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime); crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime);
@ -85,7 +86,7 @@ public class ContainerScribe extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -95,9 +96,7 @@ public class ContainerScribe extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -106,47 +105,31 @@ public class ContainerScribe extends Container
if (TileScribe.isValidForScribe(itemstack1)) if (TileScribe.isValidForScribe(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileScribe.isBook(itemstack1)) else if (TileScribe.isBook(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -35,6 +35,7 @@ public class ContainerStonegen extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
@ -67,7 +68,7 @@ public class ContainerStonegen extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.Stonegen.processTime) if (this.lastUseTime != this.Stonegen.processTime)
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime); crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
@ -85,7 +86,7 @@ public class ContainerStonegen extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -95,9 +96,7 @@ public class ContainerStonegen extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -106,47 +105,31 @@ public class ContainerStonegen extends Container
if (TileStonegen.isValid(itemstack1)) if (TileStonegen.isValid(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileStonegen.isItemFuel(itemstack1)) else if (TileStonegen.isItemFuel(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -35,6 +35,7 @@ public class ContainerWoodchipper extends Container
this.addInventorySlots(); this.addInventorySlots();
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
@ -67,7 +68,7 @@ public class ContainerWoodchipper extends Container
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i)
{ {
ICrafting crafting = (ICrafting) this.crafters.get(i); ICrafting crafting = this.crafters.get(i);
if (this.lastUseTime != this.woodchipper.processTime) if (this.lastUseTime != this.woodchipper.processTime)
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime); crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
@ -85,7 +86,7 @@ public class ContainerWoodchipper extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -95,9 +96,7 @@ public class ContainerWoodchipper extends Container
if (slotID == 2) if (slotID == 2)
{ {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null; return null;
}
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
@ -106,47 +105,31 @@ public class ContainerWoodchipper extends Container
if (TileWoodchipper.isValidForWoodchipper(itemstack1)) if (TileWoodchipper.isValidForWoodchipper(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null; return null;
}
} }
else if (TileWoodchipper.isItemFuel(itemstack1)) else if (TileWoodchipper.isItemFuel(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null; return null;
}
} }
else if (slotID >= 3 && slotID < 30) else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null; return null;
}
} }
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null; return null;
}
} }
else if (!this.mergeItemStack(itemstack1, 3, 39, false)) else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null; return null;
}
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
}
else else
{
slot.onSlotChanged(); slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) if (itemstack1.stackSize == itemstack.stackSize)
{
return null; return null;
}
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }

View file

@ -27,9 +27,7 @@ public class MachineOutputSlot extends Slot
public ItemStack decrStackSize(int slot) public ItemStack decrStackSize(int slot)
{ {
if (this.getHasStack()) if (this.getHasStack())
{
this.temp += Math.min(slot, this.getStack().stackSize); this.temp += Math.min(slot, this.getStack().stackSize);
}
return super.decrStackSize(slot); return super.decrStackSize(slot);
} }

View file

@ -12,11 +12,13 @@ public class PouchLockedSlot extends Slot
super(par1iInventory, par2, par3, par4); super(par1iInventory, par2, par3, par4);
} }
@Override
public boolean isItemValid(ItemStack par1ItemStack) public boolean isItemValid(ItemStack par1ItemStack)
{ {
return false; return false;
} }
@Override
public boolean canTakeStack(EntityPlayer par1EntityPlayer) public boolean canTakeStack(EntityPlayer par1EntityPlayer)
{ {
return false; return false;

View file

@ -22,6 +22,7 @@ public class PouchSlot extends Slot
this.filterIndex = filterIndex; this.filterIndex = filterIndex;
} }
@Override
public ItemStack getStack() public ItemStack getStack()
{ {
ItemStack filter = this.filterInv.getStackInSlot(this.filterIndex); ItemStack filter = this.filterInv.getStackInSlot(this.filterIndex);
@ -42,6 +43,7 @@ public class PouchSlot extends Slot
return null; return null;
} }
@Override
public ItemStack decrStackSize(int par1) public ItemStack decrStackSize(int par1)
{ {
ItemStack curItem = getStack(); ItemStack curItem = getStack();
@ -55,37 +57,31 @@ public class PouchSlot extends Slot
} }
ItemStack itemstack = curItem.splitStack(par1); ItemStack itemstack = curItem.splitStack(par1);
if (curItem.stackSize == 0) if (curItem.stackSize == 0)
{
putStack(null); putStack(null);
}
return itemstack; return itemstack;
} }
return null; return null;
} }
@Override
public boolean getHasStack() public boolean getHasStack()
{ {
return getStack() != null; return getStack() != null;
} }
@Override
public void putStack(ItemStack par1ItemStack) public void putStack(ItemStack par1ItemStack)
{ {
ItemStack filter = this.filterInv.getStackInSlot(this.filterIndex); ItemStack filter = this.filterInv.getStackInSlot(this.filterIndex);
if (filter == null) if (filter == null)
{
return; return;
}
NBTTagCompound tags = filter.getTagCompound(); NBTTagCompound tags = filter.getTagCompound();
if (par1ItemStack != null) if (par1ItemStack != null)
{ {
if (tags == null) if (tags == null)
{
tags = new NBTTagCompound(); tags = new NBTTagCompound();
}
if (tags.hasKey("items_" + getSlotIndex())) if (tags.hasKey("items_" + getSlotIndex()))
{
tags.removeTag("items_" + getSlotIndex()); tags.removeTag("items_" + getSlotIndex());
}
NBTTagCompound itemTags = new NBTTagCompound(); NBTTagCompound itemTags = new NBTTagCompound();
par1ItemStack.writeToNBT(itemTags); par1ItemStack.writeToNBT(itemTags);
tags.setTag("items_" + getSlotIndex(), itemTags); tags.setTag("items_" + getSlotIndex(), itemTags);
@ -95,34 +91,24 @@ public class PouchSlot extends Slot
{ {
tags.removeTag("items_" + getSlotIndex()); tags.removeTag("items_" + getSlotIndex());
if (tags.hasNoTags()) if (tags.hasNoTags())
{
filter.setTagCompound(null); filter.setTagCompound(null);
}
else else
{
filter.setTagCompound(tags); filter.setTagCompound(tags);
}
} }
if (par1ItemStack != null) if (par1ItemStack != null)
{
this.curStack = par1ItemStack; this.curStack = par1ItemStack;
}
else else
{
this.curStack = null; this.curStack = null;
}
if (!iterating) if (!iterating)
{
onSlotChanged(); onSlotChanged();
}
} }
@Override
public void onSlotChanged() public void onSlotChanged()
{ {
checking = true; checking = true;
ItemStack oldItem = getStack(); ItemStack oldItem = getStack();
checking = false; checking = false;
boolean flag = false;
if (!ItemStack.areItemStacksEqual(oldItem, this.curStack)) if (!ItemStack.areItemStacksEqual(oldItem, this.curStack))
{ {
iterating = true; iterating = true;

View file

@ -3,8 +3,6 @@ package com.oitsjustjose.criss_cross.event;
import com.oitsjustjose.criss_cross.lib.LibItems; import com.oitsjustjose.criss_cross.lib.LibItems;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.util.FoodStats;
import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -18,12 +16,10 @@ public class InfiniAppleEvent
EntityPlayer player = event.entityPlayer; EntityPlayer player = event.entityPlayer;
if (player.inventory.hasItem(LibItems.infiniApple)) if (player.inventory.hasItem(LibItems.infiniApple))
{
if (player.getFoodStats() != null) if (player.getFoodStats() != null)
{ {
player.getFoodStats().setFoodLevel(20); player.getFoodStats().setFoodLevel(20);
player.getFoodStats().setFoodSaturationLevel(5.0F); player.getFoodStats().setFoodSaturationLevel(5.0F);
} }
}
} }
} }

View file

@ -1,13 +1,12 @@
package com.oitsjustjose.criss_cross.event; package com.oitsjustjose.criss_cross.event;
import java.util.Random;
import com.oitsjustjose.criss_cross.items.ItemPouch; import com.oitsjustjose.criss_cross.items.ItemPouch;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class PouchCleanEvent public class PouchCleanEvent
@ -15,7 +14,7 @@ public class PouchCleanEvent
@SubscribeEvent @SubscribeEvent
public void registerEvent(PlayerInteractEvent event) public void registerEvent(PlayerInteractEvent event)
{ {
if (event.action != event.action.RIGHT_CLICK_BLOCK || event.world.getBlockState(event.pos) == null) if (event.action != Action.RIGHT_CLICK_BLOCK || event.world.getBlockState(event.pos) == null)
return; return;
if (event.entityPlayer.getHeldItem() == null || !(event.entityPlayer.getHeldItem().getItem() instanceof ItemPouch)) if (event.entityPlayer.getHeldItem() == null || !(event.entityPlayer.getHeldItem().getItem() instanceof ItemPouch))
return; return;
@ -23,17 +22,13 @@ public class PouchCleanEvent
EntityPlayer player = event.entityPlayer; EntityPlayer player = event.entityPlayer;
ItemPouch pouch = (ItemPouch) player.getHeldItem().getItem(); ItemPouch pouch = (ItemPouch) player.getHeldItem().getItem();
World world = event.world; World world = event.world;
Random rand = world.rand;
if (world.getBlockState(event.pos).getBlock() != Blocks.cauldron || event.world.getBlockState(event.pos) == Blocks.cauldron.getStateFromMeta(0)) if (world.getBlockState(event.pos).getBlock() != Blocks.cauldron || event.world.getBlockState(event.pos) == Blocks.cauldron.getStateFromMeta(0))
return; return;
else else if (pouch.hasColor(player.getHeldItem()))
{ {
if (pouch.hasColor(player.getHeldItem())) pouch.removeColor(player.getHeldItem());
{ world.setBlockState(event.pos, Blocks.cauldron.getStateFromMeta(Blocks.cauldron.getMetaFromState(world.getBlockState(event.pos)) - 1));
pouch.removeColor(player.getHeldItem());
world.setBlockState(event.pos, Blocks.cauldron.getStateFromMeta(Blocks.cauldron.getMetaFromState(world.getBlockState(event.pos)) - 1));
}
} }
} }

View file

@ -5,7 +5,6 @@ import com.oitsjustjose.criss_cross.items.ItemMantleSmasher;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Blocks;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

View file

@ -24,13 +24,12 @@ public class ConfigGUI extends GuiConfig
private static List<IConfigElement> getConfigElements() private static List<IConfigElement> getConfigElements()
{ {
List<IConfigElement> list = Lists.newArrayList(); List<IConfigElement> list = Lists.newArrayList();
list.add(new ConfigElement(Config.Cropomator)); list.add(new ConfigElement(Config.Cropomator));
list.add(new ConfigElement(Config.Electroextractor)); list.add(new ConfigElement(Config.Electroextractor));
list.add(new ConfigElement(Config.Woodchipper)); list.add(new ConfigElement(Config.Woodchipper));
list.add(new ConfigElement(Config.OtherMachines)); list.add(new ConfigElement(Config.OtherMachines));
return list; return list;
} }

View file

@ -5,12 +5,10 @@ import java.io.IOException;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.ibm.icu.impl.ICUService.Key;
import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator; import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
@ -55,17 +53,13 @@ public class GUIAtmosManipulator extends GuiScreen
protected void keyTyped(char typedChar, int keyCode) throws IOException protected void keyTyped(char typedChar, int keyCode) throws IOException
{ {
if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode()) if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode())
{
this.mc.displayGuiScreen(null); this.mc.displayGuiScreen(null);
}
if (keyCode == 1) if (keyCode == 1)
{ {
this.mc.displayGuiScreen((GuiScreen) null); this.mc.displayGuiScreen((GuiScreen) null);
if (this.mc.currentScreen == null) if (this.mc.currentScreen == null)
{
this.mc.setIngameFocus(); this.mc.setIngameFocus();
}
} }
} }

View file

@ -22,12 +22,14 @@ public class GUICobblegen extends GuiContainer
this.cobblegen = cobblegen; this.cobblegen = cobblegen;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cobblegen"), 30, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cobblegen"), 30, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -3,11 +3,9 @@ package com.oitsjustjose.criss_cross.gui;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.oitsjustjose.criss_cross.container.ContainerCropomator; import com.oitsjustjose.criss_cross.container.ContainerCropomator;
import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.tileentity.TileCropomator; import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
@ -24,12 +22,14 @@ public class GUICropomator extends GuiContainer
this.cropomator = cropomator; this.cropomator = cropomator;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -22,12 +22,14 @@ public class GUIElectroextractor extends GuiContainer
this.electroextractor = electroextractor; this.electroextractor = electroextractor;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -34,12 +34,12 @@ public class GUIHandler implements IGuiHandler
public static final int Scribe = 6; public static final int Scribe = 6;
public static final int AtmosManipulator = 7; public static final int AtmosManipulator = 7;
@Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{ {
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (tile != null) if (tile != null)
{
switch (ID) switch (ID)
{ {
case 0: // Cropomator case 0: // Cropomator
@ -57,7 +57,6 @@ public class GUIHandler implements IGuiHandler
case 7: // AtmosManipulator case 7: // AtmosManipulator
return new ContainerAtmosManipulator(player, ((TileAtmosManipulator) tile)); return new ContainerAtmosManipulator(player, ((TileAtmosManipulator) tile));
} }
}
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch) if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch)
return new ContainerPouch(player, player.inventory.currentItem); return new ContainerPouch(player, player.inventory.currentItem);
@ -71,7 +70,6 @@ public class GUIHandler implements IGuiHandler
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (tile != null) if (tile != null)
{
switch (ID) switch (ID)
{ {
case 0: // Cropomator case 0: // Cropomator
@ -89,7 +87,6 @@ public class GUIHandler implements IGuiHandler
case 7: // AtmosManipulator case 7: // AtmosManipulator
return new GUIAtmosManipulator(player, ((TileAtmosManipulator) tile)); return new GUIAtmosManipulator(player, ((TileAtmosManipulator) tile));
} }
}
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch) if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch)
return new GUIPouch(player, player.inventory.currentItem); return new GUIPouch(player, player.inventory.currentItem);

View file

@ -29,12 +29,14 @@ public class GUIPouch extends GuiContainer
this.ySize = 222; this.ySize = 222;
} }
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) protected void drawGuiContainerForegroundLayer(int par1, int par2)
{ {
this.fontRendererObj.drawString(name, 7, 8, 4210752); this.fontRendererObj.drawString(name, 7, 8, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -22,12 +22,14 @@ public class GUIScribe extends GuiContainer
this.scribe = scribe; this.scribe = scribe;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.scribe"), 68, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.scribe"), 68, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -22,12 +22,14 @@ public class GUIStonegen extends GuiContainer
this.stonegen = stonegen; this.stonegen = stonegen;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.stonegen"), 30, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.stonegen"), 30, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -22,12 +22,14 @@ public class GUIWoodchipper extends GuiContainer
this.woodchipper = woodchipper; this.woodchipper = woodchipper;
} }
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
} }
@Override
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -5,7 +5,6 @@ import java.util.List;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;

View file

@ -15,10 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemMantleSmasher extends ItemPickaxe public class ItemMantleSmasher extends ItemPickaxe
@ -54,7 +51,6 @@ public class ItemMantleSmasher extends ItemPickaxe
return super.onBlockStartBreak(itemstack, pos, player); return super.onBlockStartBreak(itemstack, pos, player);
if (itemstack.getItem() instanceof ItemMantleSmasher) if (itemstack.getItem() instanceof ItemMantleSmasher)
{
if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH) if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH)
{ {
breakBlock(world, player, pos.up().west()); breakBlock(world, player, pos.up().west());
@ -88,7 +84,6 @@ public class ItemMantleSmasher extends ItemPickaxe
breakBlock(world, player, pos.south()); breakBlock(world, player, pos.south());
breakBlock(world, player, pos.south().west()); breakBlock(world, player, pos.south().west());
} }
}
} }
return super.onBlockStartBreak(itemstack, pos, player); return super.onBlockStartBreak(itemstack, pos, player);
} }
@ -104,7 +99,6 @@ public class ItemMantleSmasher extends ItemPickaxe
Material m = block.getMaterial(); Material m = block.getMaterial();
if (m == Material.ground || m == Material.grass || m == Material.sand || m == Material.rock) if (m == Material.ground || m == Material.grass || m == Material.sand || m == Material.rock)
{
if (block.getBlockHardness(world, pos) != -1.0F) if (block.getBlockHardness(world, pos) != -1.0F)
{ {
block.onBlockHarvested(world, pos, state, player); block.onBlockHarvested(world, pos, state, player);
@ -118,7 +112,6 @@ public class ItemMantleSmasher extends ItemPickaxe
} }
world.setBlockToAir(pos); world.setBlockToAir(pos);
} }
}
} }
} }

View file

@ -4,7 +4,6 @@ import java.util.List;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.util.ClientProxy;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -51,65 +50,60 @@ public class ItemModBuckets extends Item
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
if (movingobjectposition == null) if (movingobjectposition == null)
{
return itemstack; return itemstack;
} else if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
else
{ {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) BlockPos blockpos = movingobjectposition.getBlockPos();
{ IBlockState state = world.getBlockState(blockpos);
BlockPos blockpos = movingobjectposition.getBlockPos();
IBlockState state = world.getBlockState(blockpos);
if (!world.isBlockModifiable(player, blockpos)) if (!world.isBlockModifiable(player, blockpos))
return itemstack;
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, itemstack))
return itemstack;
if (itemstack.getItemDamage() == 1)
{
Material material = state.getBlock().getMaterial();
int meta = state.getBlock().getMetaFromState(state);
if (material.isLiquid() && meta == 0)
world.setBlockToAir(blockpos);
}
else
{
if (world.getBlockState(blockpos).getBlock().getMaterial() == Material.lava || world.getBlockState(blockpos).getBlock().getMaterial() == Material.water)
return itemstack; return itemstack;
int x = blockpos.getX();
int y = blockpos.getY();
int z = blockpos.getZ();
if (movingobjectposition.sideHit == EnumFacing.DOWN)
--y;
if (movingobjectposition.sideHit == EnumFacing.UP)
++y;
if (movingobjectposition.sideHit == EnumFacing.WEST)
--x;
if (movingobjectposition.sideHit == EnumFacing.EAST)
++x;
if (movingobjectposition.sideHit == EnumFacing.NORTH)
--z;
if (movingobjectposition.sideHit == EnumFacing.SOUTH)
++z;
blockpos = new BlockPos(x, y, z);
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, itemstack)) if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, itemstack))
return itemstack; return itemstack;
if (itemstack.getItemDamage() == 1) if (itemstack.getItemDamage() == 0)
{ world.setBlockState(blockpos, Blocks.flowing_water.getDefaultState(), 3);
Material material = state.getBlock().getMaterial();
int meta = state.getBlock().getMetaFromState(state);
if (material.isLiquid() && meta == 0)
world.setBlockToAir(blockpos);
}
else
{
if (world.getBlockState(blockpos).getBlock().getMaterial() == Material.lava || world.getBlockState(blockpos).getBlock().getMaterial() == Material.water)
return itemstack;
int x = blockpos.getX();
int y = blockpos.getY();
int z = blockpos.getZ();
if (movingobjectposition.sideHit == EnumFacing.DOWN)
--y;
if (movingobjectposition.sideHit == EnumFacing.UP)
++y;
if (movingobjectposition.sideHit == EnumFacing.WEST)
--x;
if (movingobjectposition.sideHit == EnumFacing.EAST)
++x;
if (movingobjectposition.sideHit == EnumFacing.NORTH)
--z;
if (movingobjectposition.sideHit == EnumFacing.SOUTH)
++z;
blockpos = new BlockPos(x, y, z);
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, itemstack))
return itemstack;
if (itemstack.getItemDamage() == 0)
world.setBlockState(blockpos, Blocks.flowing_water.getDefaultState(), 3);
}
} }
} }

View file

@ -6,7 +6,6 @@ import com.oitsjustjose.criss_cross.gui.GUIHandler;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;

View file

@ -21,7 +21,7 @@ public class CropomatorCategory implements IRecipeCategory
private static final int INPUT_SLOT = 0; private static final int INPUT_SLOT = 0;
private static final int OUTPUT_SLOT = 1; private static final int OUTPUT_SLOT = 1;
private static final int FUEL_SLOT = 2; private static final int FUEL_SLOT = 2;
IDrawableStatic fuelDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUICropomator.backgroundTexture, 176, 0, 14, 14); IDrawableStatic fuelDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUICropomator.backgroundTexture, 176, 0, 14, 14);
IDrawableStatic progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUICropomator.backgroundTexture, 177, 14, 23, 16); IDrawableStatic progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUICropomator.backgroundTexture, 177, 14, 23, 16);
@ -33,7 +33,7 @@ public class CropomatorCategory implements IRecipeCategory
protected final IDrawableAnimated progress = JEIPluginManager.jeiHelper.getGuiHelper().createAnimatedDrawable(progressDrawable, Config.cropomatorProcessTime, IDrawableAnimated.StartDirection.LEFT, false); protected final IDrawableAnimated progress = JEIPluginManager.jeiHelper.getGuiHelper().createAnimatedDrawable(progressDrawable, Config.cropomatorProcessTime, IDrawableAnimated.StartDirection.LEFT, false);
@Nonnull @Nonnull
private final String localizedName = StatCollector.translateToLocal("recipe.cropomator"); private final String localizedName = StatCollector.translateToLocal("recipe.cropomator");
@Nonnull @Nonnull
@Override @Override
public String getUid() public String getUid()

View file

@ -10,30 +10,30 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class CropomatorRecipeHandler implements IRecipeHandler<CropomatorRecipeJEI> public class CropomatorRecipeHandler implements IRecipeHandler<CropomatorRecipeJEI>
{ {
@Nonnull @Nonnull
@Override @Override
public Class<CropomatorRecipeJEI> getRecipeClass() public Class<CropomatorRecipeJEI> getRecipeClass()
{ {
return CropomatorRecipeJEI.class; return CropomatorRecipeJEI.class;
} }
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid() public String getRecipeCategoryUid()
{ {
return Lib.CROPOMATOR_UID; return Lib.CROPOMATOR_UID;
} }
@Nonnull @Nonnull
@Override @Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CropomatorRecipeJEI recipe) public IRecipeWrapper getRecipeWrapper(@Nonnull CropomatorRecipeJEI recipe)
{ {
return recipe; return recipe;
} }
@Override @Override
public boolean isRecipeValid(@Nonnull CropomatorRecipeJEI recipe) public boolean isRecipeValid(@Nonnull CropomatorRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
} }
} }

View file

@ -12,34 +12,33 @@ import net.minecraft.item.ItemStack;
public class CropomatorRecipeJEI extends BlankRecipeWrapper public class CropomatorRecipeJEI extends BlankRecipeWrapper
{ {
@Nonnull @Nonnull
private final ItemStack input; private final ItemStack input;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
public CropomatorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output) public CropomatorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
{ {
this.input = input; this.input = input;
this.output = output; this.output = output;
} }
@Override @Override
public List getInputs() public List getInputs()
{ {
return Collections.singletonList(input); return Collections.singletonList(input);
} }
@Override @Override
public List getOutputs() public List getOutputs()
{ {
return Collections.singletonList(output); return Collections.singletonList(output);
} }
@Override @Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{ {
} }
} }

View file

@ -21,10 +21,10 @@ public class ElectroextractorCategory implements IRecipeCategory
private static final int INPUT_SLOT = 0; private static final int INPUT_SLOT = 0;
private static final int OUTPUT_SLOT = 1; private static final int OUTPUT_SLOT = 1;
private static final int FUEL_SLOT = 2; private static final int FUEL_SLOT = 2;
IDrawableStatic fuelDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIElectroextractor.backgroundTexture, 176, 0, 14, 14); IDrawableStatic fuelDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIElectroextractor.backgroundTexture, 176, 0, 14, 14);
IDrawableStatic progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIElectroextractor.backgroundTexture, 177, 14, 23, 16); IDrawableStatic progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIElectroextractor.backgroundTexture, 177, 14, 23, 16);
@Nonnull @Nonnull
protected final IDrawableAnimated fuel = JEIPluginManager.jeiHelper.getGuiHelper().createAnimatedDrawable(fuelDrawable, Config.electroextractorProcessTime, IDrawableAnimated.StartDirection.TOP, true); protected final IDrawableAnimated fuel = JEIPluginManager.jeiHelper.getGuiHelper().createAnimatedDrawable(fuelDrawable, Config.electroextractorProcessTime, IDrawableAnimated.StartDirection.TOP, true);
@Nonnull @Nonnull

View file

@ -10,30 +10,30 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class ElectroextractorRecipeHandler implements IRecipeHandler<ElectroextractorRecipeJEI> public class ElectroextractorRecipeHandler implements IRecipeHandler<ElectroextractorRecipeJEI>
{ {
@Nonnull @Nonnull
@Override @Override
public Class<ElectroextractorRecipeJEI> getRecipeClass() public Class<ElectroextractorRecipeJEI> getRecipeClass()
{ {
return ElectroextractorRecipeJEI.class; return ElectroextractorRecipeJEI.class;
} }
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid() public String getRecipeCategoryUid()
{ {
return Lib.ELECTROEXTRACTOR_UID; return Lib.ELECTROEXTRACTOR_UID;
} }
@Nonnull @Nonnull
@Override @Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ElectroextractorRecipeJEI recipe) public IRecipeWrapper getRecipeWrapper(@Nonnull ElectroextractorRecipeJEI recipe)
{ {
return recipe; return recipe;
} }
@Override @Override
public boolean isRecipeValid(@Nonnull ElectroextractorRecipeJEI recipe) public boolean isRecipeValid(@Nonnull ElectroextractorRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
} }
} }

View file

@ -12,34 +12,33 @@ import net.minecraft.item.ItemStack;
public class ElectroextractorRecipeJEI extends BlankRecipeWrapper public class ElectroextractorRecipeJEI extends BlankRecipeWrapper
{ {
@Nonnull @Nonnull
private final ItemStack input; private final ItemStack input;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
public ElectroextractorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output) public ElectroextractorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
{ {
this.input = input; this.input = input;
this.output = output; this.output = output;
} }
@Override @Override
public List getInputs() public List getInputs()
{ {
return Collections.singletonList(input); return Collections.singletonList(input);
} }
@Override @Override
public List getOutputs() public List getOutputs()
{ {
return Collections.singletonList(output); return Collections.singletonList(output);
} }
@Override @Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{ {
} }
} }

View file

@ -6,49 +6,48 @@ import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry; import mezz.jei.api.IModRegistry;
import mezz.jei.api.IRecipeRegistry; import mezz.jei.api.IRecipeRegistry;
import mezz.jei.api.JEIPlugin; import mezz.jei.api.JEIPlugin;
import net.minecraft.item.ItemStack;
@JEIPlugin @JEIPlugin
public class JEIPluginManager implements IModPlugin public class JEIPluginManager implements IModPlugin
{ {
public static IJeiHelpers jeiHelper; public static IJeiHelpers jeiHelper;
@Override @Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers)
{ {
jeiHelper = jeiHelpers; jeiHelper = jeiHelpers;
} }
@Override
public void register(IModRegistry registry)
{
registry.addRecipeCategories(new CropomatorCategory());
registry.addRecipeHandlers(new CropomatorRecipeHandler());
registry.addRecipes(CropomatorRecipeMaker.getRecipes());
registry.addRecipeCategories(new ElectroextractorCategory());
registry.addRecipeHandlers(new ElectroextractorRecipeHandler());
registry.addRecipes(ElectroextractorRecipeMaker.getRecipes());
registry.addRecipeCategories(new WoodchipperCategory()); @Override
registry.addRecipeHandlers(new WoodchipperRecipeHandler()); public void register(IModRegistry registry)
registry.addRecipes(WoodchipperRecipeMaker.getRecipes()); {
registry.addRecipeCategories(new CropomatorCategory());
registry.addRecipeCategories(new ScribeCategory()); registry.addRecipeHandlers(new CropomatorRecipeHandler());
registry.addRecipeHandlers(new ScribeRecipeHandler()); registry.addRecipes(CropomatorRecipeMaker.getRecipes());
registry.addRecipes(ScribeRecipeMaker.getRecipes());
}
@Override registry.addRecipeCategories(new ElectroextractorCategory());
public void onItemRegistryAvailable(IItemRegistry itemRegistry) registry.addRecipeHandlers(new ElectroextractorRecipeHandler());
{ registry.addRecipes(ElectroextractorRecipeMaker.getRecipes());
} registry.addRecipeCategories(new WoodchipperCategory());
registry.addRecipeHandlers(new WoodchipperRecipeHandler());
registry.addRecipes(WoodchipperRecipeMaker.getRecipes());
@Override registry.addRecipeCategories(new ScribeCategory());
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) registry.addRecipeHandlers(new ScribeRecipeHandler());
{ registry.addRecipes(ScribeRecipeMaker.getRecipes());
}
} @Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry)
{
}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry)
{
}
} }

View file

@ -1,12 +1,9 @@
package com.oitsjustjose.criss_cross.jei; package com.oitsjustjose.criss_cross.jei;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.oitsjustjose.criss_cross.gui.GUIScribe; import com.oitsjustjose.criss_cross.gui.GUIScribe;
import com.oitsjustjose.criss_cross.gui.GUIWoodchipper; import com.oitsjustjose.criss_cross.gui.GUIWoodchipper;
import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
@ -28,11 +25,11 @@ public class ScribeCategory implements IRecipeCategory
private static final int FUEL_SLOT = 2; private static final int FUEL_SLOT = 2;
private final IDrawableStatic progressDrawable; private final IDrawableStatic progressDrawable;
private final IDrawableAnimated progress; private final IDrawableAnimated progress;
private final IDrawable background; private final IDrawable background;
private final String localizedName; private final String localizedName;
public ScribeCategory() public ScribeCategory()
{ {
super(); super();

View file

@ -9,30 +9,30 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class ScribeRecipeHandler implements IRecipeHandler<ScribeRecipeJEI> public class ScribeRecipeHandler implements IRecipeHandler<ScribeRecipeJEI>
{ {
@Nonnull @Nonnull
@Override @Override
public Class<ScribeRecipeJEI> getRecipeClass() public Class<ScribeRecipeJEI> getRecipeClass()
{ {
return ScribeRecipeJEI.class; return ScribeRecipeJEI.class;
} }
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid() public String getRecipeCategoryUid()
{ {
return Lib.SCRIBE_UID; return Lib.SCRIBE_UID;
} }
@Nonnull @Nonnull
@Override @Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ScribeRecipeJEI recipe) public IRecipeWrapper getRecipeWrapper(@Nonnull ScribeRecipeJEI recipe)
{ {
return recipe; return recipe;
} }
@Override @Override
public boolean isRecipeValid(@Nonnull ScribeRecipeJEI recipe) public boolean isRecipeValid(@Nonnull ScribeRecipeJEI recipe)
{ {
return recipe.getInputs().size() != 0 && recipe.getOutputs().size() > 0; return recipe.getInputs().size() != 0 && recipe.getOutputs().size() > 0;
} }
} }

View file

@ -10,30 +10,30 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class WoodchipperRecipeHandler implements IRecipeHandler<WoodchipperRecipeJEI> public class WoodchipperRecipeHandler implements IRecipeHandler<WoodchipperRecipeJEI>
{ {
@Nonnull @Nonnull
@Override @Override
public Class<WoodchipperRecipeJEI> getRecipeClass() public Class<WoodchipperRecipeJEI> getRecipeClass()
{ {
return WoodchipperRecipeJEI.class; return WoodchipperRecipeJEI.class;
} }
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid() public String getRecipeCategoryUid()
{ {
return Lib.WOODCHIPPER_UID; return Lib.WOODCHIPPER_UID;
} }
@Nonnull @Nonnull
@Override @Override
public IRecipeWrapper getRecipeWrapper(@Nonnull WoodchipperRecipeJEI recipe) public IRecipeWrapper getRecipeWrapper(@Nonnull WoodchipperRecipeJEI recipe)
{ {
return recipe; return recipe;
} }
@Override @Override
public boolean isRecipeValid(@Nonnull WoodchipperRecipeJEI recipe) public boolean isRecipeValid(@Nonnull WoodchipperRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
} }
} }

View file

@ -12,34 +12,33 @@ import net.minecraft.item.ItemStack;
public class WoodchipperRecipeJEI extends BlankRecipeWrapper public class WoodchipperRecipeJEI extends BlankRecipeWrapper
{ {
@Nonnull @Nonnull
private final ItemStack input; private final ItemStack input;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
public WoodchipperRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output) public WoodchipperRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
{ {
this.input = input; this.input = input;
this.output = output; this.output = output;
} }
@Override @Override
public List getInputs() public List getInputs()
{ {
return Collections.singletonList(input); return Collections.singletonList(input);
} }
@Override @Override
public List getOutputs() public List getOutputs()
{ {
return Collections.singletonList(output); return Collections.singletonList(output);
} }
@Override @Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{ {
} }
} }

View file

@ -106,28 +106,28 @@ public class Config
property = config.get(category, "Electroextractor OreDictionary Entries", defaultEEOreDictInputs, "Formatted as <OreDictName>:<DecimalColorYouWant>." + "\n" + " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')" + "\n" + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal."); property = config.get(category, "Electroextractor OreDictionary Entries", defaultEEOreDictInputs, "Formatted as <OreDictName>:<DecimalColorYouWant>." + "\n" + " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')" + "\n" + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.");
eeOreDictInputs = property.getStringList(); eeOreDictInputs = property.getStringList();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Electroextractor's Fuel Items", defaultEEFuels, "Items considered as fuel for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); property = config.get(category, "Electroextractor's Fuel Items", defaultEEFuels, "Items considered as fuel for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
eeFuels = property.getStringList(); eeFuels = property.getStringList();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Electroextractor Output Quantity", 2); property = config.get(category, "Electroextractor Output Quantity", 2);
property.comment = "Quantity output by the Electroextractor"; property.comment = "Quantity output by the Electroextractor";
eeOutput = property.getInt(); eeOutput = property.getInt();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Electroextractor Crafting Item", "minecraft:diamond_block"); property = config.get(category, "Electroextractor Crafting Item", "minecraft:diamond_block");
property.comment = "Key crafting ingredient in Electroextractor's Recipe. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."; property.comment = "Key crafting ingredient in Electroextractor's Recipe. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.";
eeRecipeItem = property.getString(); eeRecipeItem = property.getString();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
Electroextractor.setPropertyOrder(propertyOrder); Electroextractor.setPropertyOrder(propertyOrder);
category = "woodchipper"; category = "woodchipper";
propertyOrder = Lists.newArrayList(); propertyOrder = Lists.newArrayList();
Woodchipper = config.getCategory(category); Woodchipper = config.getCategory(category);
config.setCategoryRequiresMcRestart(category, true); config.setCategoryRequiresMcRestart(category, true);
property = config.get(category, "Woodchipper Process Time", 400, "Amount of time for the Woodchipper to complete a process", 20, Short.MAX_VALUE); property = config.get(category, "Woodchipper Process Time", 400, "Amount of time for the Woodchipper to complete a process", 20, Short.MAX_VALUE);
woodchipperProcessTime = property.getInt(); woodchipperProcessTime = property.getInt();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
@ -135,35 +135,33 @@ public class Config
property = config.get(category, "Woodchipper Fuel Items", defaultWoodchipperFuels, "Items considered as fuel for the Woodchipper. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); property = config.get(category, "Woodchipper Fuel Items", defaultWoodchipperFuels, "Items considered as fuel for the Woodchipper. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
woodchipperFuels = property.getStringList(); woodchipperFuels = property.getStringList();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Woodchipper Output Quantity", 6, "Amount of planks yielded from a log", 0, 64); property = config.get(category, "Woodchipper Output Quantity", 6, "Amount of planks yielded from a log", 0, 64);
woodchipperOutput = property.getInt(); woodchipperOutput = property.getInt();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Woodchipper Crafting Item", "minecraft:diamond_block"); property = config.get(category, "Woodchipper Crafting Item", "minecraft:diamond_block");
property.comment = "Key crafting ingredient in Woodchipper's Recipe. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."; property.comment = "Key crafting ingredient in Woodchipper's Recipe. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.";
woodchipperRecipeItem = property.getString(); woodchipperRecipeItem = property.getString();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
Woodchipper.setPropertyOrder(propertyOrder); Woodchipper.setPropertyOrder(propertyOrder);
//Everything Else // Everything Else
category = "other machines"; category = "other machines";
propertyOrder = Lists.newArrayList(); propertyOrder = Lists.newArrayList();
OtherMachines = config.getCategory(category); OtherMachines = config.getCategory(category);
config.setCategoryRequiresMcRestart(category, true); config.setCategoryRequiresMcRestart(category, true);
property = config.get(category, "Scribe Recipes", defaultScribeRecipes, "Formatted as <modid>:<item>:<metadata>*<qty>=<enchantment ID>" + "\n" + "Also can be <oreDict>*qty=<enchantment ID>"); property = config.get(category, "Scribe Recipes", defaultScribeRecipes, "Formatted as <modid>:<item>:<metadata>*<qty>=<enchantment ID>" + "\n" + "Also can be <oreDict>*qty=<enchantment ID>");
scribeRecipes = property.getStringList(); scribeRecipes = property.getStringList();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
property = config.get(category, "Block Generators' Process Times", 20, "Amount of time for Stone and Cobble Generators to produce a block", 20, Short.MAX_VALUE); property = config.get(category, "Block Generators' Process Times", 20, "Amount of time for Stone and Cobble Generators to produce a block", 20, Short.MAX_VALUE);
blockGeneratorProcessTimes = property.getInt(); blockGeneratorProcessTimes = property.getInt();
propertyOrder.add(property.getName()); propertyOrder.add(property.getName());
OtherMachines.setPropertyOrder(propertyOrder); OtherMachines.setPropertyOrder(propertyOrder);
if (config.hasChanged()) if (config.hasChanged())
config.save(); config.save();

View file

@ -13,12 +13,12 @@ public class Lib
public static final String GUI_FACTORY = "com.oitsjustjose.criss_cross.gui.ConfigGUI$GUIFactory"; public static final String GUI_FACTORY = "com.oitsjustjose.criss_cross.gui.ConfigGUI$GUIFactory";
public static final String CLIENT_PROXY = "com.oitsjustjose.criss_cross.util.ClientProxy"; public static final String CLIENT_PROXY = "com.oitsjustjose.criss_cross.util.ClientProxy";
public static final String COMMON_PROXY = "com.oitsjustjose.criss_cross.util.CommonProxy"; public static final String COMMON_PROXY = "com.oitsjustjose.criss_cross.util.CommonProxy";
public static final String CROPOMATOR_UID = MODID + ":Cropomator"; public static final String CROPOMATOR_UID = MODID + ":Cropomator";
public static final String ELECTROEXTRACTOR_UID = MODID + ":Electroextractor"; public static final String ELECTROEXTRACTOR_UID = MODID + ":Electroextractor";
public static final String WOODCHIPPER_UID = MODID + ":Woodchipper"; public static final String WOODCHIPPER_UID = MODID + ":Woodchipper";
public static final String SCRIBE_UID = MODID + ":Scribe"; public static final String SCRIBE_UID = MODID + ":Scribe";
private static final ArrayList<Item> allItems = new ArrayList<Item>(); private static final ArrayList<Item> allItems = new ArrayList<Item>();
private static final ArrayList<Block> allBlocks = new ArrayList<Block>(); private static final ArrayList<Block> allBlocks = new ArrayList<Block>();

View file

@ -1,7 +1,6 @@
package com.oitsjustjose.criss_cross.lib; package com.oitsjustjose.criss_cross.lib;
import com.oitsjustjose.criss_cross.CrissCross; import com.oitsjustjose.criss_cross.CrissCross;
import com.oitsjustjose.criss_cross.blocks.BlockAtmosManipulator;
import com.oitsjustjose.criss_cross.blocks.BlockCobblegen; import com.oitsjustjose.criss_cross.blocks.BlockCobblegen;
import com.oitsjustjose.criss_cross.blocks.BlockCropomator; import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor; import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
@ -31,7 +30,7 @@ public class LibBlocks
cobblegen = new BlockCobblegen(); cobblegen = new BlockCobblegen();
stonegen = new BlockStonegen(); stonegen = new BlockStonegen();
scribe = new BlockScribe(); scribe = new BlockScribe();
//TODO: atmosManipulator = new BlockAtmosManipulator(); // TODO: atmosManipulator = new BlockAtmosManipulator();
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
} }
} }

View file

@ -20,7 +20,7 @@ public class LibItems
public static Item pouch; public static Item pouch;
public static Item mantleSmasherMkI; public static Item mantleSmasherMkI;
public static Item mantleSmasherMkII; public static Item mantleSmasherMkII;
public static ToolMaterial mkI; public static ToolMaterial mkI;
public static ToolMaterial mkII; public static ToolMaterial mkII;

View file

@ -22,7 +22,7 @@ public class CraftingRecipes
initUserRecipes(); initUserRecipes();
CraftingManager.getInstance().getRecipeList().add(new PouchColorRecipes()); CraftingManager.getInstance().getRecipeList().add(new PouchColorRecipes());
CraftingManager.getInstance().getRecipeList().add(new PouchRollbackRecipes()); CraftingManager.getInstance().getRecipeList().add(new PouchRollbackRecipes());
//Am I doing this correctly? I hope so, hard to tell w/o NEI :| // Am I doing this correctly? I hope so, hard to tell w/o NEI :|
RecipeSorter.register("CrissCross:PouchColorRecipes", PouchColorRecipes.class, Category.SHAPELESS, ""); RecipeSorter.register("CrissCross:PouchColorRecipes", PouchColorRecipes.class, Category.SHAPELESS, "");
RecipeSorter.register("CrissCross:PouchRollbackRecipes", PouchRollbackRecipes.class, Category.SHAPELESS, ""); RecipeSorter.register("CrissCross:PouchRollbackRecipes", PouchRollbackRecipes.class, Category.SHAPELESS, "");
} }
@ -39,10 +39,10 @@ public class CraftingRecipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.mantleSmasherMkII), "## ", "#PI", " IN", '#', "blockDiamond", 'I', "blockGold", 'P', LibItems.mantleSmasherMkI, 'N', Items.nether_star)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.mantleSmasherMkII), "## ", "#PI", " IN", '#', "blockDiamond", 'I', "blockGold", 'P', LibItems.mantleSmasherMkI, 'N', Items.nether_star));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.pouch), "SDS", "LCL", "LLL", 'S', Items.string, 'D', "gemDiamond", 'L', Items.leather, 'C', Blocks.chest)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.pouch), "SDS", "LCL", "LLL", 'S', Items.string, 'D', "gemDiamond", 'L', Items.leather, 'C', Blocks.chest));
} }
static void initUserRecipes() static void initUserRecipes()
{ {
//Woodchipper Recipe // Woodchipper Recipe
String[] unlocItem = Config.woodchipperRecipeItem.split(":"); String[] unlocItem = Config.woodchipperRecipeItem.split(":");
ItemStack centerItem = new ItemStack(Blocks.diamond_block); ItemStack centerItem = new ItemStack(Blocks.diamond_block);
@ -63,8 +63,8 @@ public class CraftingRecipes
} }
GameRegistry.addRecipe(new ItemStack(LibBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem }); GameRegistry.addRecipe(new ItemStack(LibBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
//Electroextractor Recipe // Electroextractor Recipe
unlocItem = Config.eeRecipeItem.split(":"); unlocItem = Config.eeRecipeItem.split(":");
centerItem = new ItemStack(Blocks.diamond_block); centerItem = new ItemStack(Blocks.diamond_block);
@ -85,8 +85,8 @@ public class CraftingRecipes
} }
GameRegistry.addRecipe(new ItemStack(LibBlocks.electroextractor), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem }); GameRegistry.addRecipe(new ItemStack(LibBlocks.electroextractor), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem });
//Cropomator Recipe // Cropomator Recipe
unlocItem = Config.cropomatorRecipeItem.split(":"); unlocItem = Config.cropomatorRecipeItem.split(":");
centerItem = new ItemStack(Blocks.diamond_block); centerItem = new ItemStack(Blocks.diamond_block);

View file

@ -68,7 +68,6 @@ public class MachineRecipes
public static void initScribeRecipes() public static void initScribeRecipes()
{ {
for (int i = 0; i < Config.scribeRecipes.length; i++) for (int i = 0; i < Config.scribeRecipes.length; i++)
{
try try
{ {
String[] parts = Config.scribeRecipes[i].split("[\\W]"); String[] parts = Config.scribeRecipes[i].split("[\\W]");
@ -91,9 +90,7 @@ public class MachineRecipes
LogHelper.warn("Enchantment ID " + enchID + " does not appear to be valid. Skipping Scribe recipe addition."); LogHelper.warn("Enchantment ID " + enchID + " does not appear to be valid. Skipping Scribe recipe addition.");
} }
else else
{
LogHelper.warn("Item " + (modid + " " + object) + " does not appear to be valid. Skipping Scribe recipe addition."); LogHelper.warn("Item " + (modid + " " + object) + " does not appear to be valid. Skipping Scribe recipe addition.");
}
} }
else if (parts.length == 3) else if (parts.length == 3)
{ {
@ -120,18 +117,15 @@ public class MachineRecipes
{ {
LogHelper.warn("Error reading itemstack for Scribe from input file at item: " + (i + 1)); LogHelper.warn("Error reading itemstack for Scribe from input file at item: " + (i + 1));
} }
}
} }
public static void initCropomatorRecipes() public static void initCropomatorRecipes()
{ {
for (int i = 0; i < Config.cropomatorInputs.length; i++) for (int i = 0; i < Config.cropomatorInputs.length; i++)
{
try try
{ {
String[] parts = Config.cropomatorInputs[i].split(":"); String[] parts = Config.cropomatorInputs[i].split(":");
if (parts.length == 2) if (parts.length == 2)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
{ {
ItemStack newStack = Config.findItemStack(parts[0], parts[1]); ItemStack newStack = Config.findItemStack(parts[0], parts[1]);
@ -143,9 +137,7 @@ public class MachineRecipes
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
if (parts.length == 3) if (parts.length == 3)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
{ {
ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2]));
@ -157,25 +149,20 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
} }
catch (Exception e) catch (Exception e)
{ {
LogHelper.warn("Error reading itemstack for Cropomator from input file at item: " + (i + 1)); LogHelper.warn("Error reading itemstack for Cropomator from input file at item: " + (i + 1));
} }
}
} }
public static void initCropomatorFuels() public static void initCropomatorFuels()
{ {
for (int i = 0; i < Config.cropomatorCatalysts.length; i++) for (int i = 0; i < Config.cropomatorCatalysts.length; i++)
{
try try
{ {
String[] parts = Config.cropomatorCatalysts[i].split(":"); String[] parts = Config.cropomatorCatalysts[i].split(":");
if (parts.length == 2) if (parts.length == 2)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
TileCropomator.addFuel(Config.findItemStack(parts[0], parts[1])); TileCropomator.addFuel(Config.findItemStack(parts[0], parts[1]));
else else
@ -183,10 +170,8 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
if (parts.length == 3) if (parts.length == 3)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
{ {
ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2]));
@ -197,13 +182,11 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
} }
catch (Exception e) catch (Exception e)
{ {
LogHelper.warn("Error reading itemstack for Cropomator Cataylsts from input file at item: " + (i + 1)); LogHelper.warn("Error reading itemstack for Cropomator Cataylsts from input file at item: " + (i + 1));
} }
}
} }
// All Credit goes to TeamCoFH for the code. After so many algorithms // All Credit goes to TeamCoFH for the code. After so many algorithms
@ -213,6 +196,7 @@ public class MachineRecipes
{ {
Container local1 = new Container() Container local1 = new Container()
{ {
@Override
public boolean canInteractWith(EntityPlayer p) public boolean canInteractWith(EntityPlayer p)
{ {
return false; return false;
@ -220,17 +204,14 @@ public class MachineRecipes
}; };
InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3); InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3);
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
{
localInventoryCrafting.setInventorySlotContents(i, null); localInventoryCrafting.setInventorySlotContents(i, null);
}
List<ItemStack> localArrayList = OreDictionary.getOres("logWood"); List<ItemStack> localArrayList = OreDictionary.getOres("logWood");
for (int j = 0; j < localArrayList.size(); j++) for (int j = 0; j < localArrayList.size(); j++)
{ {
ItemStack localItemStack1 = (ItemStack) localArrayList.get(j); ItemStack localItemStack1 = localArrayList.get(j);
ItemStack localItemStack3; ItemStack localItemStack3;
ItemStack localItemStack4; ItemStack localItemStack4;
if (ItemHelper.getItemDamage(localItemStack1) == 32767) if (ItemHelper.getItemDamage(localItemStack1) == 32767)
{
for (int k = 0; k < 16; k++) for (int k = 0; k < 16; k++)
{ {
localItemStack3 = ItemHelper.cloneStack(localItemStack1, 1); localItemStack3 = ItemHelper.cloneStack(localItemStack1, 1);
@ -245,7 +226,6 @@ public class MachineRecipes
WoodchipperRecipes.getInstance().addRecipe(localItemStack3, localItemStack5); WoodchipperRecipes.getInstance().addRecipe(localItemStack3, localItemStack5);
} }
} }
}
else else
{ {
ItemStack localItemStack2 = localItemStack1.copy(); ItemStack localItemStack2 = localItemStack1.copy();
@ -265,12 +245,10 @@ public class MachineRecipes
public static void initWoodchipperFuels() public static void initWoodchipperFuels()
{ {
for (int i = 0; i < Config.woodchipperFuels.length; i++) for (int i = 0; i < Config.woodchipperFuels.length; i++)
{
try try
{ {
String[] parts = Config.woodchipperFuels[i].split(":"); String[] parts = Config.woodchipperFuels[i].split(":");
if (parts.length == 2) if (parts.length == 2)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
TileWoodchipper.addFuel(Config.findItemStack(parts[0], parts[1])); TileWoodchipper.addFuel(Config.findItemStack(parts[0], parts[1]));
else else
@ -278,10 +256,8 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
if (parts.length == 3) if (parts.length == 3)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
{ {
ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2]));
@ -292,24 +268,20 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
} }
catch (Exception e) catch (Exception e)
{ {
LogHelper.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1)); LogHelper.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1));
} }
}
} }
static void initElectroextractorFuels() static void initElectroextractorFuels()
{ {
for (int i = 0; i < Config.eeFuels.length; i++) for (int i = 0; i < Config.eeFuels.length; i++)
{
try try
{ {
String[] parts = Config.eeFuels[i].split(":"); String[] parts = Config.eeFuels[i].split(":");
if (parts.length == 2) if (parts.length == 2)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
TileElectroextractor.addFuel(Config.findItemStack(parts[0], parts[1])); TileElectroextractor.addFuel(Config.findItemStack(parts[0], parts[1]));
else else
@ -317,10 +289,8 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list."); LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
if (parts.length == 3) if (parts.length == 3)
{
if (Config.findItemStack(parts[0], parts[1]) != null) if (Config.findItemStack(parts[0], parts[1]) != null)
{ {
ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2]));
@ -331,13 +301,11 @@ public class MachineRecipes
LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list."); LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list.");
LogHelper.warn("Please confirm you have the name and formatting correct."); LogHelper.warn("Please confirm you have the name and formatting correct.");
} }
}
} }
catch (Exception e) catch (Exception e)
{ {
LogHelper.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1)); LogHelper.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1));
} }
}
} }
static void initElectroextractorOreDictionary() static void initElectroextractorOreDictionary()

View file

@ -46,7 +46,6 @@ public class PouchColorRecipes implements IRecipe
ItemStack itemstack1 = invCraft.getStackInSlot(k); ItemStack itemstack1 = invCraft.getStackInSlot(k);
if (itemstack1 != null) if (itemstack1 != null)
{
if (itemstack1.getItem() instanceof ItemPouch) if (itemstack1.getItem() instanceof ItemPouch)
{ {
pouch = (ItemPouch) itemstack1.getItem(); pouch = (ItemPouch) itemstack1.getItem();
@ -60,13 +59,13 @@ public class PouchColorRecipes implements IRecipe
if (pouch.hasColor(itemstack1)) if (pouch.hasColor(itemstack1))
{ {
int l = pouch.getColor(itemstack); int l = pouch.getColor(itemstack);
float f = (float) (l >> 16 & 255) / 255.0F; float f = (l >> 16 & 255) / 255.0F;
float f1 = (float) (l >> 8 & 255) / 255.0F; float f1 = (l >> 8 & 255) / 255.0F;
float f2 = (float) (l & 255) / 255.0F; float f2 = (l & 255) / 255.0F;
i = (int) ((float) i + Math.max(f, Math.max(f1, f2)) * 255.0F); i = (int) (i + Math.max(f, Math.max(f1, f2)) * 255.0F);
aint[0] = (int) ((float) aint[0] + f * 255.0F); aint[0] = (int) (aint[0] + f * 255.0F);
aint[1] = (int) ((float) aint[1] + f1 * 255.0F); aint[1] = (int) (aint[1] + f1 * 255.0F);
aint[2] = (int) ((float) aint[2] + f2 * 255.0F); aint[2] = (int) (aint[2] + f2 * 255.0F);
++j; ++j;
} }
} }
@ -85,7 +84,6 @@ public class PouchColorRecipes implements IRecipe
aint[2] += j2; aint[2] += j2;
++j; ++j;
} }
}
} }
if (pouch == null) if (pouch == null)
@ -97,10 +95,10 @@ public class PouchColorRecipes implements IRecipe
int j1 = aint[1] / j; int j1 = aint[1] / j;
int k1 = aint[2] / j; int k1 = aint[2] / j;
float f3 = (float) i / (float) j; float f3 = (float) i / (float) j;
float f4 = (float) Math.max(i1, Math.max(j1, k1)); float f4 = Math.max(i1, Math.max(j1, k1));
i1 = (int) ((float) i1 * f3 / f4); i1 = (int) (i1 * f3 / f4);
j1 = (int) ((float) j1 * f3 / f4); j1 = (int) (j1 * f3 / f4);
k1 = (int) ((float) k1 * f3 / f4); k1 = (int) (k1 * f3 / f4);
int lvt_12_3_ = (i1 << 8) + j1; int lvt_12_3_ = (i1 << 8) + j1;
lvt_12_3_ = (lvt_12_3_ << 8) + k1; lvt_12_3_ = (lvt_12_3_ << 8) + k1;
pouch.setColor(itemstack, lvt_12_3_); pouch.setColor(itemstack, lvt_12_3_);
@ -124,7 +122,6 @@ public class PouchColorRecipes implements IRecipe
public ItemStack[] getRemainingItems(InventoryCrafting invCraft) public ItemStack[] getRemainingItems(InventoryCrafting invCraft)
{ {
ItemStack[] ret = new ItemStack[9]; ItemStack[] ret = new ItemStack[9];
ItemStack stackToClear = null;
for (int i = 0; i < invCraft.getSizeInventory(); i++) for (int i = 0; i < invCraft.getSizeInventory(); i++)
if (invCraft.getStackInSlot(i) != null) if (invCraft.getStackInSlot(i) != null)

View file

@ -32,20 +32,16 @@ public class PouchRollbackRecipes implements IRecipe
ItemStack pouch = null; ItemStack pouch = null;
ItemStack newPouch = null; ItemStack newPouch = null;
for (int i = 0; i < invCraft.getSizeInventory(); i++) for (int i = 0; i < invCraft.getSizeInventory(); i++)
{
if (invCraft.getStackInSlot(i) != null) if (invCraft.getStackInSlot(i) != null)
{
if (invCraft.getStackInSlot(i).getItem() instanceof ItemPouch) if (invCraft.getStackInSlot(i).getItem() instanceof ItemPouch)
pouch = invCraft.getStackInSlot(i); pouch = invCraft.getStackInSlot(i);
}
}
if (pouch == null || pouch.getItemDamage() == 0) if (pouch == null || pouch.getItemDamage() == 0)
return null; return null;
newPouch = pouch.copy(); newPouch = pouch.copy();
newPouch.setItemDamage(0); newPouch.setItemDamage(0);
return newPouch; return newPouch;
} }
@ -65,7 +61,6 @@ public class PouchRollbackRecipes implements IRecipe
public ItemStack[] getRemainingItems(InventoryCrafting invCraft) public ItemStack[] getRemainingItems(InventoryCrafting invCraft)
{ {
ItemStack[] ret = new ItemStack[9]; ItemStack[] ret = new ItemStack[9];
ItemStack stackToClear = null;
for (int i = 0; i < invCraft.getSizeInventory(); i++) for (int i = 0; i < invCraft.getSizeInventory(); i++)
if (invCraft.getStackInSlot(i) != null) if (invCraft.getStackInSlot(i) != null)

View file

@ -1,16 +1,12 @@
package com.oitsjustjose.criss_cross.recipes.machine; package com.oitsjustjose.criss_cross.recipes.machine;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class ElectroextractorRecipes public class ElectroextractorRecipes
{ {

View file

@ -1,16 +1,12 @@
package com.oitsjustjose.criss_cross.recipes.machine; package com.oitsjustjose.criss_cross.recipes.machine;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class WoodchipperRecipes public class WoodchipperRecipes
{ {

View file

@ -3,13 +3,12 @@ package com.oitsjustjose.criss_cross.tileentity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.world.storage.WorldInfo;
public class TileAtmosManipulator extends TileEntity implements ITickable public class TileAtmosManipulator extends TileEntity implements ITickable
{ {
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -20,7 +19,6 @@ public class TileAtmosManipulator extends TileEntity implements ITickable
public void setRain() public void setRain()
{ {
EntityPlayer player = worldObj.getClosestPlayer(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 3);
worldObj.getWorldInfo().setRaining(true); worldObj.getWorldInfo().setRaining(true);
if (worldObj.isRemote) if (worldObj.isRemote)

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import java.util.ArrayList;
import com.oitsjustjose.criss_cross.blocks.BlockStonegen; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.container.ContainerCobblegen; import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
@ -43,9 +43,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if (this.fuelTime > 0)
{
--this.fuelTime; --this.fuelTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -60,12 +58,8 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
flag1 = true; flag1 = true;
if (this.ItemStacks[1] != null) if (this.ItemStacks[1] != null)
{
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
}
} }
} }
@ -81,22 +75,18 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
} }
} }
else else
{
this.processTime = 0; this.processTime = 0;
}
} }
if (flag != this.fuelTime > 0) if (flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
@ -134,17 +124,13 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -157,9 +143,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -168,9 +152,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -182,12 +164,12 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileCobblegen.customName != null && TileCobblegen.customName.length() > 0;
} }
public void setCustomInventoryName(String newName) public void setCustomInventoryName(String newName)
{ {
this.customName = newName; TileCobblegen.customName = newName;
} }
@Override @Override
@ -203,9 +185,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.fuelTime = tag.getShort("FuelTime"); this.fuelTime = tag.getShort("FuelTime");
@ -225,7 +205,6 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -233,7 +212,6 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -254,9 +232,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelUsetime == 0) if (this.fuelUsetime == 0)
{
this.fuelUsetime = proTicks; this.fuelUsetime = proTicks;
}
return this.fuelTime * par1 / this.fuelUsetime; return this.fuelTime * par1 / this.fuelUsetime;
} }
@ -291,13 +267,11 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
public static boolean removeFuel(ItemStack itemstack) public static boolean removeFuel(ItemStack itemstack)
{ {
for (int i = 0; i < fuelItems.size(); i++) for (int i = 0; i < fuelItems.size(); i++)
{
if (fuelItems.get(i) == itemstack) if (fuelItems.get(i) == itemstack)
{ {
fuelItems.remove(i); fuelItems.remove(i);
return true; return true;
} }
}
return false; return false;
} }
@ -317,18 +291,12 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
ItemStack output = new ItemStack(Blocks.cobblestone); ItemStack output = new ItemStack(Blocks.cobblestone);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
if (input.stackSize <= 0) if (input.stackSize <= 0)
{
ItemStacks[0] = null; ItemStacks[0] = null;
}
} }
} }
@ -348,9 +316,10 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -417,7 +386,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.cobblegen"; return this.hasCustomName() ? TileCobblegen.customName : "container.cobblegen";
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import java.util.ArrayList;
import com.oitsjustjose.criss_cross.blocks.BlockCropomator; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.container.ContainerCropomator; import com.oitsjustjose.criss_cross.container.ContainerCropomator;
import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
@ -44,9 +44,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
boolean flag1 = false; boolean flag1 = false;
if (this.catalystTime > 0) if (this.catalystTime > 0)
{
--this.catalystTime; --this.catalystTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -65,9 +63,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
--this.ItemStacks[1].stackSize; --this.ItemStacks[1].stackSize;
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
} }
} }
} }
@ -84,22 +80,18 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
} }
} }
else else
{
this.processTime = 0; this.processTime = 0;
}
} }
if (flag != this.catalystTime > 0) if (flag != this.catalystTime > 0)
{ {
flag1 = true; flag1 = true;
BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.catalystTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
@ -137,17 +129,13 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -160,9 +148,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -171,9 +157,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -185,7 +169,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileCropomator.customName != null && TileCropomator.customName.length() > 0;
} }
@Override @Override
@ -201,9 +185,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.catalystTime = tag.getShort("BonemealTime"); this.catalystTime = tag.getShort("BonemealTime");
@ -223,7 +205,6 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -231,7 +212,6 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -252,9 +232,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.catalystInUseTime == 0) if (this.catalystInUseTime == 0)
{
this.catalystInUseTime = proTicks; this.catalystInUseTime = proTicks;
}
return this.catalystTime * par1 / this.catalystInUseTime; return this.catalystTime * par1 / this.catalystInUseTime;
} }
@ -291,13 +269,11 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
public static boolean removeFuel(ItemStack itemstack) public static boolean removeFuel(ItemStack itemstack)
{ {
for (int i = 0; i < fuelItems.size(); i++) for (int i = 0; i < fuelItems.size(); i++)
{
if (fuelItems.get(i) == itemstack) if (fuelItems.get(i) == itemstack)
{ {
fuelItems.remove(i); fuelItems.remove(i);
return true; return true;
} }
}
return false; return false;
} }
@ -317,19 +293,13 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
ItemStack output = CropomatorRecipes.getInstance().getResult(input); ItemStack output = CropomatorRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if (input.stackSize <= 0)
{
ItemStacks[0] = null; ItemStacks[0] = null;
}
} }
} }
@ -349,9 +319,10 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -413,7 +384,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.cropomator"; return this.hasCustomName() ? TileCropomator.customName : "container.cropomator";
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import java.util.ArrayList;
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor; import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
@ -43,9 +43,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if (this.fuelTime > 0)
{
--this.fuelTime; --this.fuelTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -64,9 +62,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
--this.ItemStacks[1].stackSize; --this.ItemStacks[1].stackSize;
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
} }
} }
} }
@ -83,22 +79,18 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
} }
} }
else else
{
this.crushTime = 0; this.crushTime = 0;
}
} }
if (flag != this.fuelTime > 0) if (flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
@Override @Override
@ -131,17 +123,13 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -154,9 +142,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -165,9 +151,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -183,9 +167,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.fuelTime = tag.getShort("Energy"); this.fuelTime = tag.getShort("Energy");
@ -205,7 +187,6 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -213,7 +194,6 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -234,9 +214,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelInUseTime == 0) if (this.fuelInUseTime == 0)
{
this.fuelInUseTime = proTicks; this.fuelInUseTime = proTicks;
}
return this.fuelTime * par1 / this.fuelInUseTime; return this.fuelTime * par1 / this.fuelInUseTime;
} }
@ -273,22 +251,20 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
public static boolean removeFuel(ItemStack itemstack) public static boolean removeFuel(ItemStack itemstack)
{ {
for (int i = 0; i < fuelItems.size(); i++) for (int i = 0; i < fuelItems.size(); i++)
{
if (fuelItems.get(i) == itemstack) if (fuelItems.get(i) == itemstack)
{ {
fuelItems.remove(i); fuelItems.remove(i);
return true; return true;
} }
}
return false; return false;
} }
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
{ {
return fuelItems; return fuelItems;
} }
public static boolean isValid(ItemStack itemstack) public static boolean isValid(ItemStack itemstack)
{ {
if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null) if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
@ -305,19 +281,13 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input); ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if (input.stackSize <= 0)
{
ItemStacks[0] = null; ItemStacks[0] = null;
}
} }
} }
@ -339,9 +309,10 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -408,7 +379,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.cobblegen"; return this.hasCustomName() ? TileElectroextractor.customName : "container.cobblegen";
} }
@Override @Override
@ -426,12 +397,12 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileElectroextractor.customName != null && TileElectroextractor.customName.length() > 0;
} }
public void setCustomInventoryName(String newName) public void setCustomInventoryName(String newName)
{ {
this.customName = newName; TileElectroextractor.customName = newName;
} }
@Override @Override

View file

@ -1,8 +1,6 @@
package com.oitsjustjose.criss_cross.tileentity; package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
import com.oitsjustjose.criss_cross.container.ContainerScribe; import com.oitsjustjose.criss_cross.container.ContainerScribe;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes; import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
@ -37,9 +35,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if (this.fuelTime > 0)
{
--this.fuelTime; --this.fuelTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -58,9 +54,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
--this.ItemStacks[1].stackSize; --this.ItemStacks[1].stackSize;
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
} }
} }
} }
@ -78,22 +72,18 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
} }
} }
else else
{
this.writingTime = 0; this.writingTime = 0;
}
} }
if (flag != this.fuelTime > 0) if (flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockScribe.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
@Override @Override
@ -126,17 +116,13 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -149,9 +135,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -160,9 +144,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -174,7 +156,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileScribe.customName != null && TileScribe.customName.length() > 0;
} }
@Override @Override
@ -190,9 +172,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.fuelTime = tag.getShort("FuelTime"); this.fuelTime = tag.getShort("FuelTime");
@ -212,7 +192,6 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -220,7 +199,6 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -241,9 +219,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelUsetime == 0) if (this.fuelUsetime == 0)
{
this.fuelUsetime = proTicks; this.fuelUsetime = proTicks;
}
return this.fuelTime * par1 / this.fuelUsetime; return this.fuelTime * par1 / this.fuelUsetime;
} }
@ -287,13 +263,9 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
ItemStack output = ScribeRecipes.getInstance().getResult(input); ItemStack output = ScribeRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
ItemStacks[0] = null; ItemStacks[0] = null;
} }
} }
@ -311,9 +283,10 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -380,7 +353,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.scribe"; return this.hasCustomName() ? TileScribe.customName : "container.scribe";
} }
@Override @Override
@ -398,7 +371,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
@Override @Override
public int[] getSlotsForFace(EnumFacing side) public int[] getSlotsForFace(EnumFacing side)
{ {
return new int[]{}; return new int[] {};
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import java.util.ArrayList;
import com.oitsjustjose.criss_cross.blocks.BlockStonegen; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.container.ContainerStonegen; import com.oitsjustjose.criss_cross.container.ContainerStonegen;
import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
@ -43,9 +43,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if (this.fuelTime > 0)
{
--this.fuelTime; --this.fuelTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -64,9 +62,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
--this.ItemStacks[1].stackSize; --this.ItemStacks[1].stackSize;
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
} }
} }
} }
@ -83,22 +79,18 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
} }
} }
else else
{
this.processTime = 0; this.processTime = 0;
}
} }
if (flag != this.fuelTime > 0) if (flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
@ -136,17 +128,13 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -159,9 +147,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -170,9 +156,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -184,12 +168,12 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileStonegen.customName != null && TileStonegen.customName.length() > 0;
} }
public void setCustomInventoryName(String newName) public void setCustomInventoryName(String newName)
{ {
this.customName = newName; TileStonegen.customName = newName;
} }
@Override @Override
@ -205,9 +189,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.fuelTime = tag.getShort("FuelTime"); this.fuelTime = tag.getShort("FuelTime");
@ -227,7 +209,6 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -235,7 +216,6 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -256,9 +236,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelUsetime == 0) if (this.fuelUsetime == 0)
{
this.fuelUsetime = proTicks; this.fuelUsetime = proTicks;
}
return this.fuelTime * par1 / this.fuelUsetime; return this.fuelTime * par1 / this.fuelUsetime;
} }
@ -293,13 +271,11 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
public static boolean removeFuel(ItemStack itemstack) public static boolean removeFuel(ItemStack itemstack)
{ {
for (int i = 0; i < fuelItems.size(); i++) for (int i = 0; i < fuelItems.size(); i++)
{
if (fuelItems.get(i) == itemstack) if (fuelItems.get(i) == itemstack)
{ {
fuelItems.remove(i); fuelItems.remove(i);
return true; return true;
} }
}
return false; return false;
} }
@ -319,18 +295,12 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
ItemStack output = new ItemStack(Blocks.stone); ItemStack output = new ItemStack(Blocks.stone);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
if (input.stackSize <= 0) if (input.stackSize <= 0)
{
ItemStacks[0] = null; ItemStacks[0] = null;
}
} }
} }
@ -350,9 +320,10 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -419,7 +390,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.cobblegen"; return this.hasCustomName() ? TileStonegen.customName : "container.cobblegen";
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
import java.util.ArrayList; import java.util.ArrayList;
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper; import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper; import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Config;
import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.Lib;
@ -43,9 +43,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if (this.fuelTime > 0)
{
--this.fuelTime; --this.fuelTime;
}
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
@ -64,9 +62,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
--this.ItemStacks[1].stackSize; --this.ItemStacks[1].stackSize;
if (this.ItemStacks[1].stackSize == 0) if (this.ItemStacks[1].stackSize == 0)
{
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
}
} }
} }
} }
@ -83,22 +79,18 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
} }
} }
else else
{
this.processTime = 0; this.processTime = 0;
}
} }
if (flag != this.fuelTime > 0) if (flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos); BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
} }
} }
if (flag1) if (flag1)
{
this.markDirty(); this.markDirty();
}
} }
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
@ -136,17 +128,13 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if (this.ItemStacks[slot].stackSize == 0)
{
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
}
return itemstack; return itemstack;
} }
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -159,9 +147,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
return itemstack; return itemstack;
} }
else else
{
return null; return null;
}
} }
@Override @Override
@ -170,9 +156,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
}
} }
@Override @Override
@ -184,7 +168,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return this.customName != null && this.customName.length() > 0; return TileWoodchipper.customName != null && TileWoodchipper.customName.length() > 0;
} }
@Override @Override
@ -200,9 +184,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.ItemStacks.length) if (b0 >= 0 && b0 < this.ItemStacks.length)
{
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
} }
this.fuelTime = tag.getShort("FuelTime"); this.fuelTime = tag.getShort("FuelTime");
@ -222,7 +204,6 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
{
if (this.ItemStacks[i] != null) if (this.ItemStacks[i] != null)
{ {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -230,7 +211,6 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
}
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@ -251,9 +231,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelUsetime == 0) if (this.fuelUsetime == 0)
{
this.fuelUsetime = proTicks; this.fuelUsetime = proTicks;
}
return this.fuelTime * par1 / this.fuelUsetime; return this.fuelTime * par1 / this.fuelUsetime;
} }
@ -290,13 +268,11 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
public static boolean removeFuel(ItemStack itemstack) public static boolean removeFuel(ItemStack itemstack)
{ {
for (int i = 0; i < fuelItems.size(); i++) for (int i = 0; i < fuelItems.size(); i++)
{
if (fuelItems.get(i) == itemstack) if (fuelItems.get(i) == itemstack)
{ {
fuelItems.remove(i); fuelItems.remove(i);
return true; return true;
} }
}
return false; return false;
} }
@ -316,19 +292,13 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
ItemStack output = WoodchipperRecipes.getInstance().getResult(input); ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if (outputSlot == null)
{
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
}
else if (outputSlot.isItemEqual(output)) else if (outputSlot.isItemEqual(output))
{
outputSlot.stackSize += output.stackSize; outputSlot.stackSize += output.stackSize;
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if (input.stackSize <= 0)
{
ItemStacks[0] = null; ItemStacks[0] = null;
}
} }
} }
@ -348,9 +318,10 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
return false; return false;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
} }
@Override @Override
@ -417,7 +388,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
@Override @Override
public String getName() public String getName()
{ {
return this.hasCustomName() ? this.customName : "container.woodchipper"; return this.hasCustomName() ? TileWoodchipper.customName : "container.woodchipper";
} }
@Override @Override

View file

@ -12,7 +12,7 @@ import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.model.ModelLoader; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -43,7 +43,7 @@ public class ClientProxy extends CommonProxy
for (ItemStack sub : subItems) for (ItemStack sub : subItems)
{ {
String name = item.getUnlocalizedName(sub).substring(16).toLowerCase(); String name = item.getUnlocalizedName(sub).substring(16).toLowerCase();
ModelBakery.addVariantName(item, Lib.MODID.toLowerCase() + ":" + name); ModelBakery.registerItemVariants(item, new ResourceLocation(Lib.MODID.toLowerCase(), name));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Lib.MODID.toLowerCase() + ":" + name, "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Lib.MODID.toLowerCase() + ":" + name, "inventory"));
meta++; meta++;
} }
@ -62,7 +62,7 @@ public class ClientProxy extends CommonProxy
for (ItemStack sub : subItems) for (ItemStack sub : subItems)
{ {
String name = itemBlock.getUnlocalizedName(sub).toLowerCase().replace("crisscross.", "").replace("tile.", ""); String name = itemBlock.getUnlocalizedName(sub).toLowerCase().replace("crisscross.", "").replace("tile.", "");
ModelBakery.addVariantName(itemBlock, Lib.MODID.toLowerCase() + ":" + name); ModelBakery.registerItemVariants(itemBlock, new ResourceLocation(Lib.MODID.toLowerCase(), name));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Lib.MODID.toLowerCase() + ":" + name, "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Lib.MODID.toLowerCase() + ":" + name, "inventory"));
meta++; meta++;
} }

View file

@ -18,9 +18,7 @@ public class ItemHelper
public static ItemStack cloneStack(Item item, int stackSize) public static ItemStack cloneStack(Item item, int stackSize)
{ {
if (item == null) if (item == null)
{
return null; return null;
}
ItemStack stack = new ItemStack(item, stackSize); ItemStack stack = new ItemStack(item, stackSize);
return stack; return stack;
@ -30,9 +28,7 @@ public class ItemHelper
{ {
if (item == null) if (item == null)
{
return null; return null;
}
ItemStack stack = new ItemStack(item, stackSize); ItemStack stack = new ItemStack(item, stackSize);
return stack; return stack;
@ -42,9 +38,7 @@ public class ItemHelper
{ {
if (stack == null) if (stack == null)
{
return null; return null;
}
ItemStack retStack = stack.copy(); ItemStack retStack = stack.copy();
retStack.stackSize = stackSize; retStack.stackSize = stackSize;
@ -55,9 +49,7 @@ public class ItemHelper
{ {
if (stack == null) if (stack == null)
{
return null; return null;
}
ItemStack retStack = stack.copy(); ItemStack retStack = stack.copy();
return retStack; return retStack;
@ -72,24 +64,16 @@ public class ItemHelper
{ {
ItemStack[] dmgItems = new ItemStack[2]; ItemStack[] dmgItems = new ItemStack[2];
for (int i = 0; i < inv.getSizeInventory(); i++) for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null) if (inv.getStackInSlot(i) != null)
{
if (dmgItems[0] == null) if (dmgItems[0] == null)
{
dmgItems[0] = inv.getStackInSlot(i); dmgItems[0] = inv.getStackInSlot(i);
}
else else
{ {
dmgItems[1] = inv.getStackInSlot(i); dmgItems[1] = inv.getStackInSlot(i);
break; break;
} }
}
}
if (dmgItems[0] == null || dmgItems[0].getItem() == null) if (dmgItems[0] == null || dmgItems[0].getItem() == null)
{
return null; return null;
}
else if (dmgItems[1] != null && dmgItems[0].getItem() == dmgItems[1].getItem() && dmgItems[0].stackSize == 1 && dmgItems[1].stackSize == 1 && dmgItems[0].getItem().isRepairable()) else if (dmgItems[1] != null && dmgItems[0].getItem() == dmgItems[1].getItem() && dmgItems[0].stackSize == 1 && dmgItems[1].stackSize == 1 && dmgItems[0].getItem().isRepairable())
{ {
Item theItem = dmgItems[0].getItem(); Item theItem = dmgItems[0].getItem();
@ -105,12 +89,10 @@ public class ItemHelper
IRecipe recipe; IRecipe recipe;
for (int i = 0; i < CraftingManager.getInstance().getRecipeList().size(); i++) for (int i = 0; i < CraftingManager.getInstance().getRecipeList().size(); i++)
{ {
recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i); recipe = CraftingManager.getInstance().getRecipeList().get(i);
if (recipe.matches(inv, world)) if (recipe.matches(inv, world))
{
return recipe.getCraftingResult(inv); return recipe.getCraftingResult(inv);
}
} }
return null; return null;
} }