--
|
|
@ -1,74 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCobblegen extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "CobblestoneGenerator";
|
||||
|
||||
public BlockCobblegen()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileCobblegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileCobblegen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileCobblegen)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileCobblegen) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileCobblegen tile = (TileCobblegen) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Cobblegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCropomator extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "Cropomator";
|
||||
|
||||
public BlockCropomator()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileCropomator.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileCropomator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileCropomator)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileCropomator) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileCropomator tile = (TileCropomator) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockElectroextractor extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "ElectroExtractor";
|
||||
|
||||
public BlockElectroextractor()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileElectroextractor.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileElectroextractor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileElectroextractor)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileElectroextractor) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileElectroextractor tile = (TileElectroextractor) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMachineBase extends BlockContainer
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
|
||||
private static String unlocalizedName;
|
||||
private static boolean isActive = false;
|
||||
|
||||
public BlockMachineBase(String unlocName)
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(2.0F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setUnlocalizedName(Lib.modid + "." + unlocName);
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
this.unlocalizedName = unlocName;
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
Lib.add(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
setDefaultFacing(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getStateForEntityRender(IBlockState state)
|
||||
{
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
EnumFacing enumfacing = EnumFacing.getFront(meta);
|
||||
|
||||
if (enumfacing.getAxis() == EnumFacing.Axis.Y)
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(FACING, enumfacing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumFacing) state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState()
|
||||
{
|
||||
return new BlockState(this, new IProperty[] { FACING });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack itemstack)
|
||||
{
|
||||
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;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(2), 2);
|
||||
}
|
||||
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(5), 2);
|
||||
}
|
||||
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(3), 2);
|
||||
}
|
||||
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(4), 2);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaultFacing(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block = world.getBlockState(pos.north()).getBlock();
|
||||
Block block1 = world.getBlockState(pos.south()).getBlock();
|
||||
Block block2 = world.getBlockState(pos.west()).getBlock();
|
||||
Block block3 = world.getBlockState(pos.east()).getBlock();
|
||||
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
}
|
||||
else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.EAST;
|
||||
}
|
||||
else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock())
|
||||
{
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateBlockState(boolean active, World world, BlockPos pos)
|
||||
{
|
||||
isActive = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileMobGrinder;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockMobGrinder extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "mobGinder";
|
||||
public BlockMobGrinder()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileMobGrinder.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileMobGrinder(meta);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockStonegen extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "StoneGenerator";
|
||||
|
||||
public BlockStonegen()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileStonegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileStonegen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileStonegen)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileStonegen) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileStonegen tile = (TileStonegen) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockWoodchipper extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "WoodChipper";
|
||||
|
||||
public BlockWoodchipper()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileWoodchipper.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
Lib.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileWoodchipper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileWoodchipper)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileWoodchipper) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileWoodchipper tile = (TileWoodchipper) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
||||
public class CCBlocks
|
||||
{
|
||||
public static Block cropomator;
|
||||
public static Block electroextractor;
|
||||
public static Block woodchipper;
|
||||
public static Block cobblegen;
|
||||
public static Block stonegen;
|
||||
public static Block mobGrinder;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
cropomator = new BlockCropomator();
|
||||
electroextractor = new BlockElectroextractor();
|
||||
woodchipper = new BlockWoodchipper();
|
||||
cobblegen = new BlockCobblegen();
|
||||
stonegen = new BlockStonegen();
|
||||
// mobGrinder = new BlockMobGrinder();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerCobblegen extends Container
|
||||
{
|
||||
TileCobblegen cobblegen;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
public ContainerCobblegen(EntityPlayer player, TileCobblegen cobblegen)
|
||||
{
|
||||
this.player = player;
|
||||
this.cobblegen = cobblegen;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastChopTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(cobblegen, 0, 56, 17)); // input
|
||||
this.addSlotToContainer(new Slot(cobblegen, 1, 56, 53)); // catalyst
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, cobblegen, 2, 116, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.cobblegen.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.cobblegen.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.cobblegen.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.fuelUsetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.cobblegen.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
||||
if (this.lastChopTime != this.cobblegen.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
||||
if (this.lastFuelTime != this.cobblegen.fuelUsetime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.fuelUsetime);
|
||||
}
|
||||
this.lastUseTime = this.cobblegen.processTime;
|
||||
this.lastChopTime = this.cobblegen.fuelTime;
|
||||
this.lastFuelTime = this.cobblegen.fuelUsetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileCobblegen.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileCobblegen.isItemFuel(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.cobblegen.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerCropomator extends Container
|
||||
{
|
||||
TileCropomator cropomator;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastProcessTime;
|
||||
private int lastCatalystInUseTime;
|
||||
|
||||
public ContainerCropomator(EntityPlayer player, TileCropomator cropomator)
|
||||
{
|
||||
this.player = player;
|
||||
this.cropomator = cropomator;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastProcessTime = 0;
|
||||
lastCatalystInUseTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); // input
|
||||
this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); // catalyst
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
if (timeType1 == 0)
|
||||
{
|
||||
this.cropomator.processTime = timeType2;
|
||||
}
|
||||
|
||||
if (timeType1 == 1)
|
||||
{
|
||||
this.cropomator.catalystTime = timeType2;
|
||||
}
|
||||
|
||||
if (timeType1 == 2)
|
||||
{
|
||||
this.cropomator.catalystInUseTime = timeType2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.cropomator.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
||||
if (this.lastProcessTime != this.cropomator.catalystTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
|
||||
if (this.lastCatalystInUseTime != this.cropomator.catalystInUseTime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
|
||||
}
|
||||
this.lastUseTime = this.cropomator.processTime;
|
||||
this.lastProcessTime = this.cropomator.catalystTime;
|
||||
this.lastCatalystInUseTime = this.cropomator.catalystInUseTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileCropomator.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileCropomator.isItemCatalyst(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.cropomator.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerElectroextractor extends Container
|
||||
{
|
||||
TileElectroextractor electroextractor;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastCrushTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
public ContainerElectroextractor(EntityPlayer player, TileElectroextractor electroextractor)
|
||||
{
|
||||
this.player = player;
|
||||
this.electroextractor = electroextractor;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastCrushTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); // input
|
||||
this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); // fuelitem
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
if (timeType1 == 0)
|
||||
{
|
||||
this.electroextractor.crushTime = timeType2;
|
||||
}
|
||||
|
||||
if (timeType1 == 1)
|
||||
{
|
||||
this.electroextractor.fuelTime = timeType2;
|
||||
}
|
||||
|
||||
if (timeType1 == 2)
|
||||
{
|
||||
this.electroextractor.fuelInUseTime = timeType2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.electroextractor.crushTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
|
||||
if (this.lastCrushTime != this.electroextractor.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
||||
if (this.lastFuelTime != this.electroextractor.fuelInUseTime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
|
||||
}
|
||||
this.lastUseTime = this.electroextractor.crushTime;
|
||||
this.lastCrushTime = this.electroextractor.fuelTime;
|
||||
this.lastFuelTime = this.electroextractor.fuelInUseTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileElectroextractor.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileElectroextractor.isItemEnergetic(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.electroextractor.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerStonegen extends Container
|
||||
{
|
||||
TileStonegen Stonegen;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
public ContainerStonegen(EntityPlayer player, TileStonegen Stonegen)
|
||||
{
|
||||
this.player = player;
|
||||
this.Stonegen = Stonegen;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastChopTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(Stonegen, 0, 56, 17)); // input
|
||||
this.addSlotToContainer(new Slot(Stonegen, 1, 56, 53)); // catalyst
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, Stonegen, 2, 116, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.Stonegen.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.Stonegen.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.Stonegen.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.fuelUsetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.Stonegen.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
||||
if (this.lastChopTime != this.Stonegen.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
||||
if (this.lastFuelTime != this.Stonegen.fuelUsetime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.fuelUsetime);
|
||||
}
|
||||
this.lastUseTime = this.Stonegen.processTime;
|
||||
this.lastChopTime = this.Stonegen.fuelTime;
|
||||
this.lastFuelTime = this.Stonegen.fuelUsetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileStonegen.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileStonegen.isItemFuel(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.Stonegen.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerWoodchipper extends Container
|
||||
{
|
||||
TileWoodchipper woodchipper;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
public ContainerWoodchipper(EntityPlayer player, TileWoodchipper woodchipper)
|
||||
{
|
||||
this.player = player;
|
||||
this.woodchipper = woodchipper;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastChopTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); // input
|
||||
this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); // catalyst
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.woodchipper.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.woodchipper.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.woodchipper.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.woodchipper.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
||||
if (this.lastChopTime != this.woodchipper.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
||||
if (this.lastFuelTime != this.woodchipper.fuelUsetime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
|
||||
}
|
||||
this.lastUseTime = this.woodchipper.processTime;
|
||||
this.lastChopTime = this.woodchipper.fuelTime;
|
||||
this.lastFuelTime = this.woodchipper.fuelUsetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileWoodchipper.isValidForWoodchipper(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileWoodchipper.isItemFuel(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.woodchipper.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MachineOutputSlot extends Slot
|
||||
{
|
||||
/** The player that is using the GUI where this slot resides. */
|
||||
private EntityPlayer thePlayer;
|
||||
private int temp;
|
||||
|
||||
public MachineOutputSlot(EntityPlayer player, IInventory inventory, int x, int y, int z)
|
||||
{
|
||||
super(inventory, x, y, z);
|
||||
this.thePlayer = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot)
|
||||
{
|
||||
if (this.getHasStack())
|
||||
{
|
||||
this.temp += Math.min(slot, this.getStack().stackSize);
|
||||
}
|
||||
|
||||
return super.decrStackSize(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack)
|
||||
{
|
||||
this.onCrafting(itemstack);
|
||||
super.onPickupFromSlot(player, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCrafting(ItemStack itemstack, int slot)
|
||||
{
|
||||
this.temp += slot;
|
||||
this.onCrafting(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCrafting(ItemStack stack)
|
||||
{
|
||||
stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.temp);
|
||||
this.temp = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.CCBlocks;
|
||||
import com.oitsjustjose.criss_cross.items.CCItems;
|
||||
import com.oitsjustjose.criss_cross.items.ItemDust;
|
||||
import com.oitsjustjose.criss_cross.recipes.VanillaRecipes;
|
||||
import com.oitsjustjose.criss_cross.recipes.CCMachineRecipes;
|
||||
import com.oitsjustjose.criss_cross.util.CCTab;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.CommonProxy;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.OreDictionaryAdder;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = Lib.modid, name = Lib.name, version = Lib.version, guiFactory = Lib.guifactory)
|
||||
public class CrissCross
|
||||
{
|
||||
public static CreativeTabs CCTab;
|
||||
|
||||
@Instance(Lib.modid)
|
||||
public static CrissCross instance;
|
||||
|
||||
@SidedProxy(clientSide = "com.oitsjustjose.criss_cross.util.ClientProxy", serverSide = "com.oitsjustjose.criss_cross.util.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@EventHandler
|
||||
public static void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
ConfigHandler.init(event.getSuggestedConfigurationFile());
|
||||
MinecraftForge.EVENT_BUS.register(new ConfigHandler());
|
||||
CCTab = new CCTab();
|
||||
proxy.preInit();
|
||||
|
||||
CCBlocks.init();
|
||||
CCItems.init();
|
||||
VanillaRecipes.init();
|
||||
CCMachineRecipes.init();
|
||||
OreDictionaryAdder.init();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
if(event.getSide().isClient())
|
||||
ClientProxy.init();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUICobblegen extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cobblegen.png");
|
||||
|
||||
private TileCobblegen cobblegen;
|
||||
|
||||
public GUICobblegen(EntityPlayer player, TileCobblegen cobblegen)
|
||||
{
|
||||
super(new ContainerCobblegen(player, cobblegen));
|
||||
this.cobblegen = cobblegen;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cobblegen"), 30, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.cobblegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.cobblegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.cobblegen.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUICropomator extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cropomator.png");
|
||||
|
||||
private TileCropomator cropomator;
|
||||
|
||||
public GUICropomator(EntityPlayer player, TileCropomator cropomator)
|
||||
{
|
||||
super(new ContainerCropomator(player, cropomator));
|
||||
this.cropomator = cropomator;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.cropomator.isUsingFuel())
|
||||
{
|
||||
int i1 = this.cropomator.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.cropomator.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUIElectroextractor extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/electroextractor.png");
|
||||
|
||||
private TileElectroextractor electroextractor;
|
||||
|
||||
public GUIElectroextractor(EntityPlayer player, TileElectroextractor electroextractor)
|
||||
{
|
||||
super(new ContainerElectroextractor(player, electroextractor));
|
||||
this.electroextractor = electroextractor;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.electroextractor.isUsingFuel())
|
||||
{
|
||||
int i1 = this.electroextractor.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.electroextractor.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler;
|
||||
|
||||
public class GUIFactory implements IModGuiFactory
|
||||
{
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return ModGUIConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GUIHandler implements IGuiHandler
|
||||
{
|
||||
public static final int Cropomator = 1;
|
||||
public static final int Electroextractor = 2;
|
||||
public static final int Woodchipper = 3;
|
||||
public static final int Cobblegen = 4;
|
||||
public static final int Stonegen = 5;
|
||||
public static final int Lamp = 6;
|
||||
|
||||
@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));
|
||||
|
||||
if (tile instanceof TileCropomator)
|
||||
{
|
||||
TileCropomator TE = (TileCropomator) tile;
|
||||
|
||||
return new ContainerCropomator(player, TE);
|
||||
}
|
||||
if (tile instanceof TileElectroextractor)
|
||||
{
|
||||
TileElectroextractor TE = (TileElectroextractor) tile;
|
||||
|
||||
return new ContainerElectroextractor(player, TE);
|
||||
}
|
||||
if (tile instanceof TileWoodchipper)
|
||||
{
|
||||
TileWoodchipper TE = (TileWoodchipper) tile;
|
||||
|
||||
return new ContainerWoodchipper(player, TE);
|
||||
}
|
||||
if (tile instanceof TileCobblegen)
|
||||
{
|
||||
TileCobblegen TE = (TileCobblegen) tile;
|
||||
|
||||
return new ContainerCobblegen(player, TE);
|
||||
}
|
||||
if (tile instanceof TileStonegen)
|
||||
{
|
||||
TileStonegen TE = (TileStonegen) tile;
|
||||
|
||||
return new ContainerStonegen(player, TE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
if (tile instanceof TileCropomator)
|
||||
{
|
||||
TileCropomator TE = (TileCropomator) tile;
|
||||
|
||||
return new GUICropomator(player, TE);
|
||||
}
|
||||
|
||||
if (tile instanceof TileElectroextractor)
|
||||
{
|
||||
TileElectroextractor TE = (TileElectroextractor) tile;
|
||||
|
||||
return new GUIElectroextractor(player, TE);
|
||||
}
|
||||
if (tile instanceof TileWoodchipper)
|
||||
{
|
||||
TileWoodchipper TE = (TileWoodchipper) tile;
|
||||
|
||||
return new GUIWoodchipper(player, TE);
|
||||
}
|
||||
if (tile instanceof TileCobblegen)
|
||||
{
|
||||
TileCobblegen TE = (TileCobblegen) tile;
|
||||
|
||||
return new GUICobblegen(player, TE);
|
||||
}
|
||||
if (tile instanceof TileStonegen)
|
||||
{
|
||||
TileStonegen TE = (TileStonegen) tile;
|
||||
|
||||
return new GUIStonegen(player, TE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUIStonegen extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/stonegen.png");
|
||||
|
||||
private TileStonegen stonegen;
|
||||
|
||||
public GUIStonegen(EntityPlayer player, TileStonegen stonegen)
|
||||
{
|
||||
super(new ContainerStonegen(player, stonegen));
|
||||
this.stonegen = stonegen;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.stonegen"), 30, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.stonegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.stonegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.stonegen.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUIWoodchipper extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/woodchipper.png");
|
||||
|
||||
private TileWoodchipper woodchipper;
|
||||
|
||||
public GUIWoodchipper(EntityPlayer player, TileWoodchipper woodchipper)
|
||||
{
|
||||
super(new ContainerWoodchipper(player, woodchipper));
|
||||
this.woodchipper = woodchipper;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.woodchipper.isUsingFuel())
|
||||
{
|
||||
int i1 = this.woodchipper.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.woodchipper.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
|
||||
public class ModGUIConfig extends GuiConfig
|
||||
{
|
||||
public ModGUIConfig(GuiScreen guiScreen)
|
||||
{
|
||||
super(guiScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Lib.modid,
|
||||
false, true, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.items;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
public class CCItems
|
||||
{
|
||||
public static Item dusts;
|
||||
public static Item buckets;
|
||||
public static Item infiniApple;
|
||||
public static Item mantleSmasherMkI;
|
||||
public static Item mantleSmasherMkII;
|
||||
|
||||
public static ToolMaterial mkI;
|
||||
public static ToolMaterial mkII;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
mkI = EnumHelper.addToolMaterial("mkI", 7, 6244, 8.0F, 0.0F, 22);
|
||||
mkI.setRepairItem(new ItemStack(Blocks.emerald_block));
|
||||
mkII = EnumHelper.addToolMaterial("mkII", 10, -1, 12.0F, 0.0F, 32);
|
||||
|
||||
dusts = new ItemDust();
|
||||
buckets = new ItemModBuckets();
|
||||
infiniApple = new ItemInfiniApple();
|
||||
mantleSmasherMkI = new ItemMantleSmasher(mkI);
|
||||
mantleSmasherMkII = new ItemMantleSmasher(mkII);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDust extends Item
|
||||
{
|
||||
private static ArrayList<String> dustNames = new ArrayList<String>();
|
||||
private static ArrayList<Integer> colors = new ArrayList<Integer>();
|
||||
|
||||
public ItemDust()
|
||||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
GameRegistry.registerItem(this, "dust");
|
||||
Lib.add(this);
|
||||
}
|
||||
|
||||
public static ArrayList<String> getDusts()
|
||||
{
|
||||
return dustNames;
|
||||
}
|
||||
|
||||
public static void addDustType(String name, int color)
|
||||
{
|
||||
dustNames.add(name);
|
||||
colors.add(color);
|
||||
}
|
||||
|
||||
public static String getName(int meta)
|
||||
{
|
||||
return dustNames.get(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
if (pass == 1)
|
||||
{
|
||||
if (stack.getItemDamage() >= colors.size())
|
||||
return 0;
|
||||
return colors.get(stack.getItemDamage());
|
||||
}
|
||||
else
|
||||
return 10724259;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameInefficiently(ItemStack itemstack)
|
||||
{
|
||||
int meta = itemstack.getItemDamage();
|
||||
return (StatCollector.translateToLocal("item.CrissCross.dustPrefix") + " " + ItemDust.getName(meta) + " " + StatCollector.translateToLocal(
|
||||
"item.CrissCross.dustPostfix"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack)
|
||||
{
|
||||
return this.getUnlocalizedNameInefficiently(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return "item." + Lib.modid + ".dust";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
{
|
||||
ItemStack stack = new ItemStack(item, 1, i);
|
||||
list.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.items;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.event.InfiniAppleEvent;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ItemInfiniApple extends Item
|
||||
{
|
||||
public ItemInfiniApple()
|
||||
{
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
this.setUnlocalizedName(Lib.modid + ".infiniApple");
|
||||
GameRegistry.registerItem(this, "infiniApple");
|
||||
MinecraftForge.EVENT_BUS.register(new InfiniAppleEvent());
|
||||
Lib.add(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.items;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMantleSmasher extends ItemPickaxe
|
||||
{
|
||||
public ItemMantleSmasher(ToolMaterial material)
|
||||
{
|
||||
super(material);
|
||||
this.setUnlocalizedName(Lib.modid + ".mantleSmasher_" + material.name());
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
GameRegistry.registerItem(this, this.getUnlocalizedName());
|
||||
Lib.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
if (!world.isRemote && !player.isSneaking())
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock().getMaterial() != Material.rock)
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
|
||||
MovingObjectPosition movObjPos = raytraceFromEntity(world, player, false, 4.5d);
|
||||
EnumFacing side = movObjPos.sideHit;
|
||||
|
||||
if(side == null)
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
|
||||
if (itemstack.getItem() instanceof ItemMantleSmasher)
|
||||
{
|
||||
if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH)
|
||||
{
|
||||
breakBlock(world, player, pos.up().west());
|
||||
breakBlock(world, player, pos.up());
|
||||
breakBlock(world, player, pos.up().east());
|
||||
breakBlock(world, player, pos.west());
|
||||
breakBlock(world, player, pos.east());
|
||||
breakBlock(world, player, pos.down().west());
|
||||
breakBlock(world, player, pos.down());
|
||||
breakBlock(world, player, pos.down().east());
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
|
||||
}
|
||||
else if (side == EnumFacing.EAST || side == EnumFacing.WEST)
|
||||
{
|
||||
breakBlock(world, player, pos.up().north());
|
||||
breakBlock(world, player, pos.up());
|
||||
breakBlock(world, player, pos.up().south());
|
||||
breakBlock(world, player, pos.north());
|
||||
breakBlock(world, player, pos.south());
|
||||
breakBlock(world, player, pos.down().north());
|
||||
breakBlock(world, player, pos.down());
|
||||
breakBlock(world, player, pos.down().south());
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
|
||||
}
|
||||
else if (side == EnumFacing.UP || side == EnumFacing.DOWN)
|
||||
{
|
||||
breakBlock(world, player, pos.north().east());
|
||||
breakBlock(world, player, pos.north());
|
||||
breakBlock(world, player, pos.north().west());
|
||||
breakBlock(world, player, pos.east());
|
||||
breakBlock(world, player, pos.west());
|
||||
breakBlock(world, player, pos.south().east());
|
||||
breakBlock(world, player, pos.south());
|
||||
breakBlock(world, player, pos.south().west());
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onBlockStartBreak(itemstack, pos, player);
|
||||
}
|
||||
|
||||
void breakBlock(World world, EntityPlayer player, BlockPos pos)
|
||||
{
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if (block.getMaterial() == Material.rock)
|
||||
{
|
||||
block.onBlockHarvested(world, pos, state, player);
|
||||
if (block.removedByPlayer(world, pos, player, true))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, pos, state);
|
||||
block.harvestBlock(world, player, pos, state, world.getTileEntity(pos));
|
||||
}
|
||||
world.playAuxSFXAtEntity(player, Block.getIdFromBlock(block), pos, 1);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range)
|
||||
{
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f;
|
||||
if (!world.isRemote && player instanceof EntityPlayer)
|
||||
d1 += 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = new Vec3(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = range;
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
return world.rayTraceBlocks(vec3, vec31, par3, !par3, par3);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemModBuckets extends Item
|
||||
{
|
||||
String[] types = new String[] { "everfulBucket", "voidBucket" };
|
||||
|
||||
public ItemModBuckets()
|
||||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
this.setContainerItem(this);
|
||||
GameRegistry.registerItem(this, "magicBucket");
|
||||
Lib.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
if(stack.getItemDamage() == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
IBlockState state = world.getBlockState(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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return "item." + Lib.modid + "." + types[itemStack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.CropomatorRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class CropomatorFuelHandler extends CropomatorRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mCropomator.get(cycleticks / 48 % mCropomator.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mCropomator.get(cycleticks / 48 % mCropomator.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<CropomatorPair> mCropomator = new ArrayList<CropomatorRecipeHandler.CropomatorPair>();
|
||||
|
||||
public CropomatorFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.cropomatorfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = CropomatorRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mCropomator.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("cropomatorfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "cropomatorfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.Recipes.CropomatorRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class CropomatorRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class CropomatorPair extends CachedRecipe
|
||||
{
|
||||
public CropomatorPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.cropomatorProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "cropomatorfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "cropomator"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUICropomator.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.cropomator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class)
|
||||
loadCraftingRecipes("cropomator");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
CropomatorPair arecipe = new CropomatorPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUICropomator.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityCropomator.isItemCatalyst(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "cropomator";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.ElectroextractorRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ElectroextractorFuelHandler extends ElectroextractorRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<ElectroextractorPair> mElectroextractor = new ArrayList<ElectroextractorRecipeHandler.ElectroextractorPair>();
|
||||
|
||||
public ElectroextractorFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.electroextractorfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = ElectroextractorRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mElectroextractor.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("Electroextractorfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "electroextractorfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Recipes.ElectroextractorRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class ElectroextractorPair extends CachedRecipe
|
||||
{
|
||||
public ElectroextractorPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.electroextractorProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "Electroextractorfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "Electroextractor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUIElectroextractor.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.electroextractor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class)
|
||||
loadCraftingRecipes("Electroextractor");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
ElectroextractorPair arecipe = new ElectroextractorPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUIElectroextractor.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityElectroextractor.isItemEnergetic(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "electroextractor";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEICrissCrossConfig implements IConfigureNEI
|
||||
{
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
registerHandler(new CropomatorFuelHandler());
|
||||
registerHandler(new CropomatorRecipeHandler());
|
||||
registerHandler(new ElectroextractorFuelHandler());
|
||||
registerHandler(new ElectroextractorRecipeHandler());
|
||||
registerHandler(new WoodchipperFuelHandler());
|
||||
registerHandler(new WoodchipperRecipeHandler());
|
||||
API.registerGuiOverlay(GUICropomator.class, "cropomator");
|
||||
API.registerGuiOverlay(GUIElectroextractor.class, "electroextractor");
|
||||
API.registerGuiOverlay(GUIWoodchipper.class, "woodchipper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return Reference.modid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
return Reference.version;
|
||||
}
|
||||
|
||||
private static void registerHandler(TemplateRecipeHandler handler)
|
||||
{
|
||||
API.registerRecipeHandler(handler);
|
||||
API.registerUsageHandler(handler);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.WoodchipperRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class WoodchipperFuelHandler extends WoodchipperRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<WoodchipperPair> mWoodchipper = new ArrayList<WoodchipperRecipeHandler.WoodchipperPair>();
|
||||
|
||||
public WoodchipperFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.woodchipperfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = WoodchipperRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mWoodchipper.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("woodchipperfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "woodchipperfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Recipes.WoodchipperRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class WoodchipperRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class WoodchipperPair extends CachedRecipe
|
||||
{
|
||||
public WoodchipperPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.woodchipperProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "woodchipperfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "woodchipper"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUIWoodchipper.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.woodchipper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class)
|
||||
loadCraftingRecipes("woodchipper");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
WoodchipperPair arecipe = new WoodchipperPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUIWoodchipper.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityWoodchipper.isItemFuel(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "woodchipper";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.items.CCItems;
|
||||
import com.oitsjustjose.criss_cross.items.ItemDust;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.util.CCLog;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.ItemHelper;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class CCMachineRecipes
|
||||
{
|
||||
public static int cropomatorQTY = ConfigHandler.cropomatorOutput;
|
||||
public static int electroQTY = ConfigHandler.electroextractorOutput;
|
||||
public static int woodchipperQTY = ConfigHandler.woodchipperOutput;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
initCropomatorRecipes();
|
||||
initCropomatorFuels();
|
||||
initElectroextractorFuels();
|
||||
initElectroextractorOreDictionary();
|
||||
initWoodchipperFuels();
|
||||
initWoodchipperOreDictionary();
|
||||
|
||||
TileStonegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileStonegen.addFuel(new ItemStack(CCItems.buckets));
|
||||
TileCobblegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileCobblegen.addFuel(new ItemStack(CCItems.buckets));
|
||||
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, electroQTY));
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), new ItemStack(Items.emerald, electroQTY));
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, electroQTY));
|
||||
}
|
||||
|
||||
public static void initCropomatorRecipes()
|
||||
{
|
||||
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.cropomatorInputs[i].split(":");
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]);
|
||||
CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), cropomatorQTY, newStack
|
||||
.getItemDamage()));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
|
||||
}
|
||||
}
|
||||
if (unlocStack.length == 3)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
newStack.stackSize = cropomatorQTY;
|
||||
CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), cropomatorQTY, newStack
|
||||
.getItemDamage()));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CCLog.warn("Error reading itemstack for inputs from input file at item: " + (i + 1));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void initCropomatorFuels()
|
||||
{
|
||||
for (int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.cropomatorCatalysts[i].split(":");
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileCropomator.addFuel(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]));
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
|
||||
if (unlocStack.length == 3)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileCropomator.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CCLog.warn("Error reading itemstack for catalysts from input file at item: " + (i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All Credit goes to TeamCoFH for the code. After so many algorithms
|
||||
// attempted, I gave up and used one that worked:
|
||||
|
||||
public static void initWoodchipperOreDictionary()
|
||||
{
|
||||
Container local1 = new Container()
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer paramAnonymousEntityPlayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3);
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
localInventoryCrafting.setInventorySlotContents(i, null);
|
||||
}
|
||||
List<ItemStack> localArrayList = OreDictionary.getOres("logWood");
|
||||
for (int j = 0; j < localArrayList.size(); j++)
|
||||
{
|
||||
ItemStack localItemStack1 = (ItemStack) localArrayList.get(j);
|
||||
ItemStack localItemStack3;
|
||||
ItemStack localItemStack4;
|
||||
if (ItemHelper.getItemDamage(localItemStack1) == 32767)
|
||||
{
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
localItemStack3 = ItemHelper.cloneStack(localItemStack1, 1);
|
||||
localItemStack3.setItemDamage(k);
|
||||
localInventoryCrafting.setInventorySlotContents(0, localItemStack3);
|
||||
localItemStack4 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
|
||||
if (localItemStack4 != null)
|
||||
{
|
||||
ItemStack localItemStack5 = localItemStack4.copy();
|
||||
ItemStack tmp129_127 = localItemStack5;
|
||||
tmp129_127.stackSize = woodchipperQTY;
|
||||
WoodchipperRecipes.getInstance().addRecipe(localItemStack3, localItemStack5);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack localItemStack2 = localItemStack1.copy();
|
||||
localInventoryCrafting.setInventorySlotContents(0, localItemStack2);
|
||||
localItemStack3 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
|
||||
if (localItemStack3 != null)
|
||||
{
|
||||
localItemStack4 = localItemStack3.copy();
|
||||
ItemStack tmp201_199 = localItemStack4;
|
||||
tmp201_199.stackSize = woodchipperQTY;
|
||||
WoodchipperRecipes.getInstance().addRecipe(localItemStack2, localItemStack4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void initWoodchipperFuels()
|
||||
{
|
||||
for (int i = 0; i < ConfigHandler.woodchipperFuels.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.woodchipperFuels[i].split(":");
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileWoodchipper.addFuel(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]));
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
|
||||
if (unlocStack.length == 3)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileWoodchipper.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CCLog.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void initElectroextractorFuels()
|
||||
{
|
||||
for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.electroextractorEnergySources[i].split(":");
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileElectroextractor.addFuel(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]));
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i]
|
||||
+ " could not be added to the Electroextractor's fuel list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
|
||||
if (unlocStack.length == 3)
|
||||
{
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileElectroextractor.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i]
|
||||
+ " could not be added to the Electroextractor's fuel list.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CCLog.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void initElectroextractorOreDictionary()
|
||||
{
|
||||
ArrayList<String> dustNames = ItemDust.getDusts();
|
||||
for (int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++)
|
||||
{
|
||||
String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":");
|
||||
if (doesOreNameExist("ore" + entry[0]) && doesOreNameExist("ingot" + entry[0]))
|
||||
{
|
||||
List<ItemStack> ores = OreDictionary.getOres("ore" + entry[0]);
|
||||
ItemDust.addDustType(entry[0], Integer.parseInt(entry[1]));
|
||||
for (int j = 0; j < ores.size(); j++)
|
||||
ElectroextractorRecipes.getInstance().addRecipe(ores.get(j), new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] + " could not be registered.");
|
||||
if (!doesOreNameExist("ore" + entry[0]))
|
||||
CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0] + ".");
|
||||
else
|
||||
if (!doesOreNameExist("ingot" + entry[0]))
|
||||
CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] + ".");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
{
|
||||
ItemStack ingot = null;
|
||||
if (doesOreNameExist("ingot" + dustNames.get(i)))
|
||||
ingot = OreDictionary.getOres("ingot" + dustNames.get(i)).get(0);
|
||||
if (ingot != null)
|
||||
GameRegistry.addSmelting(new ItemStack(CCItems.dusts, 1, i), ingot, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean doesOreNameExist(String oreName)
|
||||
{
|
||||
List<ItemStack> ores = OreDictionary.getOres(oreName);
|
||||
return ores.size() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CropomatorRecipes
|
||||
{
|
||||
private static final CropomatorRecipes recipeBase = new CropomatorRecipes();
|
||||
public static final ArrayList<ItemStack> inputs = new ArrayList<ItemStack>();
|
||||
public static final ArrayList<ItemStack> outputs = new ArrayList<ItemStack>();
|
||||
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
public static CropomatorRecipes getInstance()
|
||||
{
|
||||
return recipeBase;
|
||||
}
|
||||
|
||||
public void addRecipe(ItemStack input, ItemStack stack)
|
||||
{
|
||||
this.recipes.put(input, stack);
|
||||
inputs.add(input);
|
||||
outputs.add(stack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack stack)
|
||||
{
|
||||
Iterator iterator = this.recipes.entrySet().iterator();
|
||||
Entry entry;
|
||||
|
||||
do
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
return (ItemStack) entry.getValue();
|
||||
}
|
||||
|
||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ElectroextractorRecipes
|
||||
{
|
||||
private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes();
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
public static ElectroextractorRecipes getInstance()
|
||||
{
|
||||
return recipeBase;
|
||||
}
|
||||
|
||||
public void addRecipe(ItemStack input, ItemStack stack)
|
||||
{
|
||||
this.recipes.put(input, stack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack stack)
|
||||
{
|
||||
Iterator iterator = this.recipes.entrySet().iterator();
|
||||
Entry entry;
|
||||
|
||||
do
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
return (ItemStack) entry.getValue();
|
||||
}
|
||||
|
||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.CCBlocks;
|
||||
import com.oitsjustjose.criss_cross.items.CCItems;
|
||||
import com.oitsjustjose.criss_cross.util.CCLog;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class VanillaRecipes
|
||||
{
|
||||
public static void init()
|
||||
{
|
||||
cropomatorRecipe();
|
||||
electroextractorRecipe();
|
||||
woodChipperRecipe();
|
||||
initBlockGeneratorRecipes();
|
||||
initOthers();
|
||||
}
|
||||
|
||||
static void initBlockGeneratorRecipes()
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCBlocks.cobblegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "cobblestone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCBlocks.stonegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "stone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
}
|
||||
|
||||
static void initOthers()
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.buckets, 1, 0), "DFD", "WBW", "DFD", 'W', Items.water_bucket, 'B', Items.bucket, 'D', "gemDiamond", 'F', "blockDiamond"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.buckets, 1, 1), "OGO", "GBG", "OGO", 'B', Items.bucket, 'G', "blockGlass", 'O', Blocks.obsidian));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.infiniApple, 1, 0), "###", "#N#", "###", '#', new ItemStack(Items.golden_apple, 1, 1), 'N', Items.nether_star));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.mantleSmasherMkI), "## ", "#PI", " II", '#', "blockEmerald", 'I', "blockIron", 'P', Items.diamond_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.mantleSmasherMkII), "## ", "#PI", " IN", '#', "blockDiamond", 'I', "blockGold", 'P', CCItems.mantleSmasherMkI, 'N', Items.nether_star));
|
||||
}
|
||||
|
||||
static void woodChipperRecipe()
|
||||
{
|
||||
String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if (unlocItem.length == 3)
|
||||
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + "could not be added as part of the recipe of the Woodchipper.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
|
||||
}
|
||||
|
||||
static void electroextractorRecipe()
|
||||
{
|
||||
String[] unlocItem = ConfigHandler.electroextractorRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if (unlocItem.length == 3)
|
||||
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + " could not be added as part of the recipe of the electroextractor.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem });
|
||||
}
|
||||
|
||||
static void cropomatorRecipe()
|
||||
{
|
||||
String[] unlocItem = ConfigHandler.cropomatorRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if (unlocItem.length == 3)
|
||||
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + " could not be added as part of the recipe of the cropomator.");
|
||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class WoodchipperRecipes
|
||||
{
|
||||
private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes();
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
public static WoodchipperRecipes getInstance()
|
||||
{
|
||||
return recipeBase;
|
||||
}
|
||||
|
||||
public void addRecipe(ItemStack input, ItemStack stack)
|
||||
{
|
||||
this.recipes.put(input, stack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack stack)
|
||||
{
|
||||
Iterator iterator = this.recipes.entrySet().iterator();
|
||||
Entry entry;
|
||||
|
||||
do
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
return (ItemStack) entry.getValue();
|
||||
}
|
||||
|
||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,452 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileCobblegen extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = ConfigHandler.blockGeneratorProcessTimes;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int fuelTime;
|
||||
public int processTime;
|
||||
public int fuelUsetime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getFuels()
|
||||
{
|
||||
return fuelItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.cobblestonegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomInventoryName(String newName)
|
||||
{
|
||||
this.customName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("FuelTime");
|
||||
this.processTime = tag.getShort("WorkTime");
|
||||
if (this.ItemStacks[1] != null)
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.fuelUsetime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||
tag.setShort("WorkTime", (short) this.processTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.processTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.fuelUsetime == 0)
|
||||
{
|
||||
this.fuelUsetime = proTicks;
|
||||
}
|
||||
|
||||
return this.fuelTime * par1 / this.fuelUsetime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = new ItemStack(Blocks.cobblestone);
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addFuel(ItemStack itemstack)
|
||||
{
|
||||
fuelItems.add(itemstack);
|
||||
}
|
||||
|
||||
public static boolean removeFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if (itemstack.getItem() == Items.lava_bucket)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = new ItemStack(Blocks.cobblestone);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemFuel(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
case 1:
|
||||
return this.fuelUsetime;
|
||||
case 2:
|
||||
return this.processTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.fuelUsetime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.processTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerCobblegen(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,451 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
||||
import com.oitsjustjose.criss_cross.recipes.CropomatorRecipes;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileCropomator extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = ConfigHandler.cropomatorProcessTime;
|
||||
private static int qty = ConfigHandler.cropomatorOutput;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
private static String customName;
|
||||
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int catalystTime;
|
||||
public int processTime;
|
||||
public int catalystInUseTime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.catalystTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.catalystTime > 0)
|
||||
{
|
||||
--this.catalystTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.catalystTime == 0 && this.canProcess())
|
||||
{
|
||||
this.catalystInUseTime = this.catalystTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.catalystTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.catalystTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getFuels()
|
||||
{
|
||||
return fuelItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.cropomator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.catalystTime = tag.getShort("BonemealTime");
|
||||
this.processTime = tag.getShort("ProcessTime");
|
||||
if(this.ItemStacks[1] != null)
|
||||
this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.catalystInUseTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("BonemealTime", (short) this.catalystTime);
|
||||
tag.setShort("ProcessTime", (short) this.processTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.processTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.catalystInUseTime == 0)
|
||||
{
|
||||
this.catalystInUseTime = proTicks;
|
||||
}
|
||||
|
||||
return this.catalystTime * par1 / this.catalystInUseTime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.catalystTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addFuel(ItemStack itemstack)
|
||||
{
|
||||
fuelItems.add(itemstack);
|
||||
}
|
||||
|
||||
public static boolean removeFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if (CropomatorRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemCatalyst(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isItemCatalyst(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.catalystTime;
|
||||
case 1:
|
||||
return this.catalystInUseTime;
|
||||
case 2:
|
||||
return this.processTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.catalystTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.catalystInUseTime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.processTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cropomator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerCropomator(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemCatalyst(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,456 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.recipes.ElectroextractorRecipes;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileElectroextractor extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = ConfigHandler.electroextractorProcessTime;
|
||||
private static int qty = ConfigHandler.electroextractorOutput;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int fuelTime;
|
||||
public int crushTime;
|
||||
public int fuelInUseTime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelInUseTime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.crushTime;
|
||||
|
||||
if (this.crushTime == proTicks)
|
||||
{
|
||||
this.crushTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.crushTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("Energy");
|
||||
this.crushTime = tag.getShort("CrushTime");
|
||||
if(this.ItemStacks[1] != null)
|
||||
this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.fuelInUseTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("Energy", (short) this.fuelTime);
|
||||
tag.setShort("CrushTime", (short) this.crushTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.crushTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.fuelInUseTime == 0)
|
||||
{
|
||||
this.fuelInUseTime = proTicks;
|
||||
}
|
||||
|
||||
return this.fuelTime * par1 / this.fuelInUseTime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addFuel(ItemStack itemstack)
|
||||
{
|
||||
fuelItems.add(itemstack);
|
||||
}
|
||||
|
||||
public static boolean removeFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemEnergetic(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isItemEnergetic(ItemStack itemstack)
|
||||
{
|
||||
if(fuelItems == null || fuelItems.size() <= 0)
|
||||
return false;
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
case 1:
|
||||
return this.fuelInUseTime;
|
||||
case 2:
|
||||
return this.crushTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.fuelInUseTime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.crushTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerElectroextractor(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.electroextractor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomInventoryName(String newName)
|
||||
{
|
||||
this.customName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemEnergetic(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileMobGrinder extends TileEntity implements ITickable
|
||||
{
|
||||
int facing;
|
||||
|
||||
public TileMobGrinder(int dir)
|
||||
{
|
||||
super();
|
||||
this.facing = dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
World world = this.worldObj;
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB getAABBForFacing(BlockPos pos, int facing)
|
||||
{
|
||||
switch (facing)
|
||||
{
|
||||
case 2: return new AxisAlignedBB(pos, pos.north(3));
|
||||
case 3: return new AxisAlignedBB(pos, pos.south(3));
|
||||
case 4: return new AxisAlignedBB(pos, pos.west(3));
|
||||
case 5: return new AxisAlignedBB(pos, pos.east(3));
|
||||
default: return new AxisAlignedBB(pos, pos);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,456 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileStonegen extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = ConfigHandler.blockGeneratorProcessTimes;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int fuelTime;
|
||||
public int processTime;
|
||||
public int fuelUsetime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getFuels()
|
||||
{
|
||||
return fuelItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.stonegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomInventoryName(String newName)
|
||||
{
|
||||
this.customName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("FuelTime");
|
||||
this.processTime = tag.getShort("WorkTime");
|
||||
if(this.ItemStacks[1] != null)
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.fuelUsetime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||
tag.setShort("WorkTime", (short) this.processTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.processTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.fuelUsetime == 0)
|
||||
{
|
||||
this.fuelUsetime = proTicks;
|
||||
}
|
||||
|
||||
return this.fuelTime * par1 / this.fuelUsetime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = new ItemStack(Blocks.stone);
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addFuel(ItemStack itemstack)
|
||||
{
|
||||
fuelItems.add(itemstack);
|
||||
}
|
||||
|
||||
public static boolean removeFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if (itemstack.getItem() == Items.lava_bucket)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = new ItemStack(Blocks.stone);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemFuel(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
case 1:
|
||||
return this.fuelUsetime;
|
||||
case 2:
|
||||
return this.processTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.fuelUsetime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.processTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerStonegen(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,454 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.recipes.WoodchipperRecipes;
|
||||
import com.oitsjustjose.criss_cross.util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.util.Lib;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileWoodchipper extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = ConfigHandler.woodchipperProcessTime;
|
||||
private static int qty = ConfigHandler.woodchipperOutput;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int fuelTime;
|
||||
public int processTime;
|
||||
public int fuelUsetime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getFuels()
|
||||
{
|
||||
return fuelItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.woodchipper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("FuelTime");
|
||||
this.processTime = tag.getShort("WorkTime");
|
||||
if(this.ItemStacks[1] != null)
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.fuelUsetime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||
tag.setShort("WorkTime", (short) this.processTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.processTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.fuelUsetime == 0)
|
||||
{
|
||||
this.fuelUsetime = proTicks;
|
||||
}
|
||||
|
||||
return this.fuelTime * par1 / this.fuelUsetime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addFuel(ItemStack itemstack)
|
||||
{
|
||||
fuelItems.add(itemstack);
|
||||
}
|
||||
|
||||
public static boolean removeFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidForWoodchipper(ItemStack itemstack)
|
||||
{
|
||||
if (WoodchipperRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemFuel(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack itemstack)
|
||||
{
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
case 1:
|
||||
return this.fuelUsetime;
|
||||
case 2:
|
||||
return this.processTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.fuelUsetime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.processTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.woodchipper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerWoodchipper(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class CCLog
|
||||
{
|
||||
private static Logger LOGGER = LogManager.getLogger(Lib.modid);
|
||||
|
||||
public CCLog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void warn(String msg)
|
||||
{
|
||||
LOGGER.warn(msg);
|
||||
}
|
||||
|
||||
public static void error(String msg)
|
||||
{
|
||||
LOGGER.error(msg);
|
||||
}
|
||||
|
||||
public static void info(String msg)
|
||||
{
|
||||
LOGGER.info(msg);
|
||||
}
|
||||
|
||||
public static void debug(String msg)
|
||||
{
|
||||
LOGGER.debug(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.CCBlocks;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class CCTab extends CreativeTabs
|
||||
{
|
||||
public CCTab()
|
||||
{
|
||||
super(CreativeTabs.getNextID(), "tab" + Lib.modid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return Item.getItemFromBlock(CCBlocks.electroextractor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void init()
|
||||
{
|
||||
ArrayList<Block> blocks = Lib.getModBlocks();
|
||||
ArrayList<Item> items = Lib.getModItems();
|
||||
|
||||
for (Block b : blocks)
|
||||
register(b, "");
|
||||
for (Item i : items)
|
||||
register(i, "");
|
||||
}
|
||||
|
||||
// WARNING: The following code is BULLSHIT and should be handled by FORGE. But it isn't. So sorry if you can't understand much. Just remember
|
||||
// kids:
|
||||
// EVERYTHING HAS TO BE IN LOWER CASE. NOTHING YOU LEARNED IN SCHOOL ABOUT CAPITALIZATION MATTERS ANYMORE.
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void register(Item item, String customName)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
List<ItemStack> subItems = new ArrayList<ItemStack>();
|
||||
item.getSubItems(item, CrissCross.CCTab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = item.getUnlocalizedName(sub).substring(16).toLowerCase();
|
||||
ModelBakery.addVariantName(item, Lib.modid.toLowerCase() + ":" + name);
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Lib.modid.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void register(Block block, String customName)
|
||||
{
|
||||
int meta = 0;
|
||||
Item itemBlock = Item.getItemFromBlock(block);
|
||||
if (itemBlock.getHasSubtypes())
|
||||
{
|
||||
List<ItemStack> subItems = new ArrayList<ItemStack>();
|
||||
itemBlock.getSubItems(itemBlock, CrissCross.CCTab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = itemBlock.getUnlocalizedName(sub).toLowerCase().replace("crisscross.", "").replace("tile.", "");
|
||||
ModelBakery.addVariantName(itemBlock, Lib.modid.toLowerCase() + ":" + name);
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Lib.modid.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
else if (customName == "")
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, 0, new ModelResourceLocation(Lib.modid.toLowerCase() + ":" + block.getUnlocalizedName().substring(16)
|
||||
.toLowerCase(), "inventory"));
|
||||
else
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, 0, new ModelResourceLocation(Lib.modid.toLowerCase() + ":" + customName, "inventory"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
public abstract class CommonProxy
|
||||
{
|
||||
public static void preInit()
|
||||
{
|
||||
};
|
||||
|
||||
public static void init()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ConfigHandler
|
||||
{
|
||||
public static Configuration config;
|
||||
public static int cropomatorProcessTime;
|
||||
public static int cropomatorOutput;
|
||||
public static String cropomatorRecipeItem;
|
||||
public static String[] cropomatorInputs;
|
||||
public static String[] cropomatorCatalysts;
|
||||
public static String[] defaultCropomatorInputs = new String[] { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot",
|
||||
"minecraft:cactus", "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2", "minecraft:sapling:3",
|
||||
"minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:dye:3",
|
||||
"minecraft:pumpkin", "minecraft:wheat", "minecraft:wheat_seeds" };
|
||||
public static String[] defaultCropomatorCatalystItems = new String[] { "minecraft:dye:15" };
|
||||
|
||||
public static int electroextractorProcessTime;
|
||||
public static int electroextractorOutput;
|
||||
public static String electroextractorRecipeItem;
|
||||
public static String[] electroextractorEnergySources;
|
||||
public static String[] electroextractorOreDictInputs;
|
||||
public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:15400704", "Aluminum:15987699",
|
||||
"Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903",
|
||||
"Mithril:4433113", "Nickel:16580553" };
|
||||
public static String[] defaultElectroextractorEnergySources = new String[] { "minecraft:redstone_block" };
|
||||
|
||||
public static int woodchipperProcessTime;
|
||||
public static int woodchipperOutput;
|
||||
public static String woodchipperRecipeItem;
|
||||
public static String[] woodchipperFuels;
|
||||
public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0", "CrissCross:magicBucket:0" };
|
||||
|
||||
public static int blockGeneratorProcessTimes;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
// Create the configuration object from the given configuration file
|
||||
if (config == null)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
loadConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadConfiguration()
|
||||
{
|
||||
// Cropomator Configs
|
||||
cropomatorInputs = config.get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs,
|
||||
"A list of items to be added to the Cropomator's recipe list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
|
||||
.getStringList();
|
||||
|
||||
cropomatorCatalysts = config.get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems,
|
||||
"A list of items to be added to the Cropomator's catalyst list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
|
||||
.getStringList();
|
||||
|
||||
cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1, Short.MAX_VALUE,
|
||||
"Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200.");
|
||||
|
||||
cropomatorOutput = config.getInt("Cropomator Output Quantity", config.CATEGORY_GENERAL, 3, 0, 64,
|
||||
"Control how many of the input item you get as the output item. Default is 3.");
|
||||
|
||||
cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block",
|
||||
"This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
|
||||
|
||||
// Electroextractor's Configs
|
||||
electroextractorEnergySources = config.get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources,
|
||||
"A list of items to be added as the Electroextractor's energy sources. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
|
||||
.getStringList();
|
||||
|
||||
electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0, Short.MAX_VALUE,
|
||||
"Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200.");
|
||||
|
||||
electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64,
|
||||
"Control how many dusts you get as the output. Default is 2.");
|
||||
|
||||
electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block",
|
||||
"This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
|
||||
|
||||
electroextractorOreDictInputs = config.get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.",
|
||||
defaultElectroextractorOreDictInputs, "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.")
|
||||
.getStringList();
|
||||
|
||||
// Woodchipper's Configs
|
||||
woodchipperFuels = config.get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels,
|
||||
"A list of items to be added as the Woodchipper's 'fuels'. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.").getStringList();
|
||||
|
||||
woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0, Short.MAX_VALUE,
|
||||
"Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200.");
|
||||
|
||||
woodchipperOutput = config.getInt("Woodchipper Output Quantity", config.CATEGORY_GENERAL, 6, 0, 64,
|
||||
"Control how many planks are yielded from processing a log. Default is 6.");
|
||||
|
||||
woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, "minecraft:diamond_block",
|
||||
"This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
|
||||
|
||||
// Autosmith's Configs
|
||||
blockGeneratorProcessTimes = config.getInt("Stone Generators' Process Times", config.CATEGORY_GENERAL, 20, 0, Short.MAX_VALUE,
|
||||
"Control how many ticks it takes a stone generator to process an item. Default is 20; furnaces are 200.");
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.modID.equalsIgnoreCase(Lib.modid))
|
||||
loadConfiguration();
|
||||
}
|
||||
|
||||
// put this here because most references to finditemstack are due to this confighandler
|
||||
public static ItemStack findItemStack(String modid, String name)
|
||||
{
|
||||
if (GameRegistry.findItem(modid, name) != null)
|
||||
return new ItemStack(GameRegistry.findItem(modid, name));
|
||||
else
|
||||
if (GameRegistry.findBlock(modid, name) != null)
|
||||
return new ItemStack(GameRegistry.findBlock(modid, name));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TeamCoFH All credit goes to TeamCoFH, this was required for proper woodchipper recipes :)
|
||||
*
|
||||
*/
|
||||
|
||||
public class ItemHelper
|
||||
{
|
||||
public static ItemStack cloneStack(Item item, int stackSize)
|
||||
{
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(item, stackSize);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack cloneStack(Block item, int stackSize)
|
||||
{
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(item, stackSize);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack cloneStack(ItemStack stack, int stackSize)
|
||||
{
|
||||
|
||||
if (stack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack retStack = stack.copy();
|
||||
retStack.stackSize = stackSize;
|
||||
|
||||
return retStack;
|
||||
}
|
||||
|
||||
public static ItemStack cloneStack(ItemStack stack)
|
||||
{
|
||||
|
||||
if (stack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack retStack = stack.copy();
|
||||
|
||||
return retStack;
|
||||
}
|
||||
|
||||
public static int getItemDamage(ItemStack stack)
|
||||
{
|
||||
|
||||
return Items.diamond.getDamage(stack);
|
||||
}
|
||||
|
||||
public static ItemStack findMatchingRecipe(InventoryCrafting inv, World world)
|
||||
{
|
||||
|
||||
ItemStack[] dmgItems = new ItemStack[2];
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null)
|
||||
{
|
||||
if (dmgItems[0] == null)
|
||||
{
|
||||
dmgItems[0] = inv.getStackInSlot(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmgItems[1] = inv.getStackInSlot(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dmgItems[0] == null || dmgItems[0].getItem() == 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())
|
||||
{
|
||||
Item theItem = dmgItems[0].getItem();
|
||||
int var13 = theItem.getMaxDamage() - dmgItems[0].getItemDamage();
|
||||
int var8 = theItem.getMaxDamage() - dmgItems[1].getItemDamage();
|
||||
int var9 = var13 + var8 + theItem.getMaxDamage() * 5 / 100;
|
||||
int var10 = Math.max(0, theItem.getMaxDamage() - var9);
|
||||
|
||||
return new ItemStack(dmgItems[0].getItem(), 1, var10);
|
||||
}
|
||||
else
|
||||
{
|
||||
IRecipe recipe;
|
||||
for (int i = 0; i < CraftingManager.getInstance().getRecipeList().size(); i++)
|
||||
{
|
||||
recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i);
|
||||
|
||||
if (recipe.matches(inv, world))
|
||||
{
|
||||
return recipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Lib
|
||||
{
|
||||
public static final String modid = "CrissCross";
|
||||
public static final String name = "Criss Cross";
|
||||
public static final String version = "1.3";
|
||||
public static final String guifactory = "com.oitsjustjose.criss_cross.gui.GUIFactory";
|
||||
|
||||
private static final ArrayList<Item> allItems = new ArrayList<Item>();
|
||||
private static final ArrayList<Block> allBlocks = new ArrayList<Block>();
|
||||
|
||||
public static ArrayList<Item> getModItems()
|
||||
{
|
||||
return allItems;
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getModBlocks()
|
||||
{
|
||||
return allBlocks;
|
||||
}
|
||||
|
||||
public static void add(Item item)
|
||||
{
|
||||
allItems.add(item);
|
||||
}
|
||||
|
||||
public static void add(Block block)
|
||||
{
|
||||
allBlocks.add(block);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.items.CCItems;
|
||||
import com.oitsjustjose.criss_cross.items.ItemDust;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class OreDictionaryAdder
|
||||
{
|
||||
public static void init()
|
||||
{
|
||||
ArrayList<String> dustNames = ItemDust.getDusts();
|
||||
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(CCItems.dusts, 1, i));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.event;
|
||||
|
||||
import com.oitsjustjose.criss_cross.items.CCItems;
|
||||
|
||||
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.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class InfiniAppleEvent
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void registerEvent(PlayerEvent event)
|
||||
{
|
||||
if (event.entityPlayer == null)
|
||||
return;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
|
||||
if (player.inventory.hasItem(CCItems.infiniApple))
|
||||
{
|
||||
if (player.getFoodStats() != null)
|
||||
{
|
||||
player.getFoodStats().setFoodLevel(20);
|
||||
player.getFoodStats().setFoodSaturationLevel(5.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/cobblestone_generator/cobblestone_generator_top",
|
||||
"front": "crisscross:blocks/cobblestone_generator/cobblestone_generator_front",
|
||||
"side": "crisscross:blocks/cobblestone_generator/cobblestone_generator_sides",
|
||||
"bottom": "crisscross:blocks/cobblestone_generator/cobblestone_generator_bottom"
|
||||
},
|
||||
"model": "crisscross:cobblestonegenerator",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/cropomator/cropomator_top",
|
||||
"front": "crisscross:blocks/cropomator/cropomator_front",
|
||||
"side": "crisscross:blocks/cropomator/cropomator_sides",
|
||||
"bottom": "crisscross:blocks/cropomator/cropomator_bottom"
|
||||
},
|
||||
"model": "crisscross:cropomator",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/electroextractor/electroextractor_top",
|
||||
"front": "crisscross:blocks/electroextractor/electroextractor_front",
|
||||
"side": "crisscross:blocks/electroextractor/electroextractor_sides",
|
||||
"bottom": "crisscross:blocks/electroextractor/electroextractor_bottom"
|
||||
},
|
||||
"model": "crisscross:electroextractor",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/stone_generator/stone_generator_top",
|
||||
"front": "crisscross:blocks/stone_generator/stone_generator_front",
|
||||
"side": "crisscross:blocks/stone_generator/stone_generator_sides",
|
||||
"bottom": "crisscross:blocks/stone_generator/stone_generator_bottom"
|
||||
},
|
||||
"model": "crisscross:stonegenerator",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/wood_chipper/wood_chipper_top",
|
||||
"front": "crisscross:blocks/wood_chipper/wood_chipper_front",
|
||||
"side": "crisscross:blocks/wood_chipper/wood_chipper_sides",
|
||||
"bottom": "crisscross:blocks/wood_chipper/wood_chipper_bottom"
|
||||
},
|
||||
"model": "crisscross:woodchipper",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#Blocks
|
||||
tile.CrissCross.Cropomator.name=Cropomator
|
||||
tile.CrissCross.ElectroExtractor.name=ElectroExtractor
|
||||
tile.CrissCross.WoodChipper.name=Wood Chipper
|
||||
tile.CrissCross.CobblestoneGenerator.name=Cobblestone Generator
|
||||
tile.CrissCross.StoneGenerator.name=Smooth Stone Generator
|
||||
|
||||
#Items
|
||||
#Dust Name Components
|
||||
item.CrissCross.trash.name=This is a bad item, please trash it.
|
||||
item.CrissCross.dustPrefix=Electrolytic
|
||||
item.CrissCross.dustPostfix=Dust
|
||||
#Buckets
|
||||
item.CrissCross.everfulBucket.name=Everful Bucket
|
||||
item.CrissCross.voidBucket.name=Insatiable Bucket
|
||||
item.CrissCross.infiniApple.name=§cI§6n§ef§ai§2n§bi§3A§9p§1p§5l§de§r
|
||||
item.CrissCross.mantleSmasher_mkI.name=Mantle Smasher
|
||||
item.CrissCross.mantleSmasher_mkII.name=§cM§6a§en§at§2l§be§3 S§9m§1a§5s§dh§ce§6r§e M§ak§2. §bII§r
|
||||
|
||||
#Chat Color Codes for Rainbow Chat: C 6 E A 2 B 3 9 1 5 D
|
||||
|
||||
|
||||
#Containers
|
||||
container.cropomator=Cropomator
|
||||
container.electroextractor=ElectroExtractor
|
||||
container.woodchipper=Wood Chipper
|
||||
container.stonegen=Smooth Stone Generator
|
||||
container.cobblegen=Cobblestone Generator
|
||||
|
||||
#NEI Integration
|
||||
recipe.cropomatorfuel=Cropomator Fuels
|
||||
recipe.cropomator=Cropomator
|
||||
recipe.electroextractor=ElectroExtractor
|
||||
recipe.electroextractorfuel=ElectorExtractor Fuels
|
||||
recipe.woodchipper=Wood Chipper
|
||||
recipe.woodchipperfuel=Wood Chipper Fuels
|
||||
recipe.stonegen=Smooth Stone Generator
|
||||
recipe.cobblegen=Cobblestone Generator
|
||||
|
||||
#Tab
|
||||
itemGroup.tabCrissCross=Criss Cross
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"textures": {
|
||||
"top": "#top",
|
||||
"front": "#front",
|
||||
"side": "#side",
|
||||
"bottom": "#bottom"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"textures": {
|
||||
"top": "#top",
|
||||
"front": "#front",
|
||||
"side": "#side",
|
||||
"bottom": "#bottom"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"textures": {
|
||||
"top": "#top",
|
||||
"front": "#front",
|
||||
"side": "#side",
|
||||
"bottom": "#bottom"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"textures": {
|
||||
"top": "#top",
|
||||
"front": "#front",
|
||||
"side": "#side",
|
||||
"bottom": "#bottom"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"textures": {
|
||||
"top": "#top",
|
||||
"front": "#front",
|
||||
"side": "#side",
|
||||
"bottom": "#bottom"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/dust_base",
|
||||
"layer1": "crisscross:items/dust_overlay"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 0, 90, -35 ],
|
||||
"translation": [ 0, 1.25, -3.5 ],
|
||||
"scale": [ 0.85, 0.85, 0.85 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/everfulBucket"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 0, 90, -35 ],
|
||||
"translation": [ 0, 1.25, -3.5 ],
|
||||
"scale": [ 0.85, 0.85, 0.85 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/infiniApple"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ -90, 0, 0 ],
|
||||
"translation": [ 0, 1, -3 ],
|
||||
"scale": [ 0.55, 0.55, 0.55 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/mantleSmasher_mkI"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 0, 90, -50 ],
|
||||
"translation": [ 0, 3, -0.85 ],
|
||||
"scale": [ 0.85, 0.85, 0.85 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/mantleSmasher_mkII"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 0, 90, -50 ],
|
||||
"translation": [ 0, 3, -0.85 ],
|
||||
"scale": [ 0.85, 0.85, 0.85 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "crisscross:items/voidBucket"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 0, 90, -35 ],
|
||||
"translation": [ 0, 1.25, -3.5 ],
|
||||
"scale": [ 0.85, 0.85, 0.85 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 782 B |
|
Before Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"animation": {
|
||||
"frames": [
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
31,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 6.1 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 640 B |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 6.1 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |