Properly Updating to 1.8.8 :D
|
|
@ -1,5 +0,0 @@
|
|||
I'm a simple guy. And as it happens, as a student, right now I've got some spare time!! If you have a request, just stick it down below this line, PM me, or you can always do it yourself and send me a PR!
|
||||
|
||||
If you want me to add an ore to the Electroextractor's item list, let me know. I can do this quite easily (so can you if you just know the GameRegistry and how to pick the right number for your color!). Preesh as always guys, don't forget, requests below!:
|
||||
|
||||
_____________________________________________________________________________________________________________________________
|
||||
|
|
@ -5,114 +5,70 @@ import java.util.Random;
|
|||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCobblegen;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCobblegen;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.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(TileEntityCobblegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockTextures[0] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Bottom");
|
||||
blockTextures[1] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Top");
|
||||
blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
|
||||
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityCobblegen();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
Random random = new Random();
|
||||
TileEntityCobblegen tile = (TileEntityCobblegen) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null)
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityCobblegen)
|
||||
{
|
||||
for(int i = 0; i < tile.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0)
|
||||
{
|
||||
int j = random.nextInt(21) + 10;
|
||||
|
||||
if(j > itemstack.stackSize)
|
||||
{
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
|
||||
(double) ((float) y + f1), (double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityCobblegen) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if(world.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityCobblegen tile = (TileEntityCobblegen) world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Cobblegen, world, x, y, z);
|
||||
TileEntityCobblegen tile = (TileEntityCobblegen) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Cobblegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,115 +5,71 @@ import java.util.Random;
|
|||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.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(TileEntityCropomator.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockTextures[0] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Bottom");
|
||||
blockTextures[1] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Top");
|
||||
blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
|
||||
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
Random random = new Random();
|
||||
TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null)
|
||||
{
|
||||
for(int i = 0; i < tile.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0)
|
||||
{
|
||||
int j = random.nextInt(21) + 10;
|
||||
|
||||
if(j > itemstack.stackSize)
|
||||
{
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
|
||||
(double) ((float) y + f1), (double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityCropomator();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if(world.isRemote)
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityCropomator)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityCropomator) 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
|
||||
{
|
||||
TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z);
|
||||
TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,114 +6,69 @@ import com.oitsjustjose.criss_cross.CrissCross;
|
|||
import com.oitsjustjose.criss_cross.GUI.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.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(TileEntityElectroextractor.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockTextures[0] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Bottom");
|
||||
blockTextures[1] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Top");
|
||||
blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
|
||||
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityElectroextractor();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
Random random = new Random();
|
||||
TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null)
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityElectroextractor)
|
||||
{
|
||||
for(int i = 0; i < tile.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0)
|
||||
{
|
||||
int j = random.nextInt(21) + 10;
|
||||
|
||||
if(j > itemstack.stackSize)
|
||||
{
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
|
||||
(double) ((float) y + f1), (double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityElectroextractor) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if(world.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Electroextractor, world, x, y, z);
|
||||
TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,140 +3,166 @@ package com.oitsjustjose.criss_cross.Blocks;
|
|||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMachineBase extends BlockContainer
|
||||
{
|
||||
IIcon[] blockTextures = new IIcon[4];
|
||||
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); // 0 - Top
|
||||
this.setHardness(2.0F); // 1 - Bottom
|
||||
this.setResistance(2.0F); // 3 - Front
|
||||
this.setStepSound(soundTypeMetal); // 4 - Sides
|
||||
this.setBlockName(Reference.modid + "." + unlocName);
|
||||
super(Material.rock);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(2.0F);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
this.setUnlocalizedName(Reference.modid + "." + unlocName);
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
|
||||
this.unlocalizedName = unlocName;
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
Reference.add(this);
|
||||
}
|
||||
|
||||
// Used for the ItemStack vs. In-world Rendering
|
||||
@Override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
if(side == 0)
|
||||
return blockTextures[0];
|
||||
if(side == 1)
|
||||
return blockTextures[1];
|
||||
if(side == 3)
|
||||
return blockTextures[2];
|
||||
|
||||
return blockTextures[3];
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
setDefaultFacing(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
if(side == 0)
|
||||
return blockTextures[0];
|
||||
if(side == 1)
|
||||
return blockTextures[1];
|
||||
if(side == access.getBlockMetadata(x, y, z))
|
||||
return blockTextures[2];
|
||||
|
||||
return blockTextures[3];
|
||||
}
|
||||
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 void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
setMetadataForFront(world, x, y, z);
|
||||
}
|
||||
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, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack)
|
||||
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)
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(2), 2);
|
||||
}
|
||||
|
||||
if(l == 1)
|
||||
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(5), 2);
|
||||
}
|
||||
|
||||
if(l == 2)
|
||||
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(3), 2);
|
||||
}
|
||||
|
||||
if(l == 3)
|
||||
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
world.setBlockState(pos, state.getBlock().getStateFromMeta(4), 2);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMetadataForFront(World world, int x, int y, int z)
|
||||
private void setDefaultFacing(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z - 1);
|
||||
Block block1 = world.getBlock(x, y, z + 1);
|
||||
Block block2 = world.getBlock(x - 1, y, z);
|
||||
Block block3 = world.getBlock(x + 1, y, z);
|
||||
byte b0 = 3;
|
||||
|
||||
if(block.func_149730_j() && !block1.func_149730_j())
|
||||
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())
|
||||
{
|
||||
b0 = 3;
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
if(block1.func_149730_j() && !block.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
if(block2.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
if(block3.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
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, int x, int y, int z)
|
||||
|
||||
public static void updateBlockState(boolean active, World world, BlockPos pos)
|
||||
{
|
||||
isActive = active;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,118 +1,64 @@
|
|||
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.TileEntityStonegen;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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(TileEntityStonegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockTextures[0] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Bottom");
|
||||
blockTextures[1] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Top");
|
||||
blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
|
||||
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityStonegen();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
Random random = new Random();
|
||||
TileEntityStonegen tile = (TileEntityStonegen) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null)
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityStonegen)
|
||||
{
|
||||
for(int i = 0; i < tile.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0)
|
||||
{
|
||||
int j = random.nextInt(21) + 10;
|
||||
|
||||
if(j > itemstack.stackSize)
|
||||
{
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
|
||||
(double) ((float) y + f1), (double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityStonegen) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if(world.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityStonegen tile = (TileEntityStonegen) world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, x, y, z);
|
||||
TileEntityStonegen tile = (TileEntityStonegen) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,114 +5,71 @@ import java.util.Random;
|
|||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.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(TileEntityWoodchipper.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
Reference.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockTextures[0] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Bottom");
|
||||
blockTextures[1] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Top");
|
||||
blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
|
||||
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityWoodchipper();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
Random random = new Random();
|
||||
TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null)
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityWoodchipper)
|
||||
{
|
||||
for(int i = 0; i < tile.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = tile.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0)
|
||||
{
|
||||
int j = random.nextInt(21) + 10;
|
||||
|
||||
if(j > itemstack.stackSize)
|
||||
{
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
|
||||
(double) ((float) y + f1), (double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityWoodchipper) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY,
|
||||
float hitZ)
|
||||
{
|
||||
if(world.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Woodchipper, world, x, y, z);
|
||||
TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Stonegen, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ package com.oitsjustjose.criss_cross.Blocks;
|
|||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
||||
public class CCBlocks
|
||||
{
|
||||
|
|
@ -21,7 +22,6 @@ public class CCBlocks
|
|||
woodchipper = new BlockWoodchipper();
|
||||
cobblegen = new BlockCobblegen();
|
||||
stonegen = new BlockStonegen();
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,139 +1,145 @@
|
|||
package com.oitsjustjose.criss_cross.Container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCobblegen;
|
||||
|
||||
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
|
||||
{
|
||||
TileEntityCobblegen cobblegen;
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
|
||||
public ContainerCobblegen(EntityPlayer player, TileEntityCobblegen 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)
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.cobblegen.processTime = timeType2;
|
||||
this.cobblegen.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.cobblegen.fuelTime = timeType2;
|
||||
this.cobblegen.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.cobblegen.fuelUsetime = timeType2;
|
||||
this.cobblegen.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(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)
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if(this.lastUseTime != this.cobblegen.processTime)
|
||||
|
||||
if (this.lastUseTime != this.cobblegen.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
||||
if(this.lastChopTime != this.cobblegen.fuelTime)
|
||||
if (this.lastChopTime != this.cobblegen.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
||||
if(this.lastFuelTime != this.cobblegen.fuelUsetime)
|
||||
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())
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(slotID == 2)
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(TileEntityCobblegen.isValid(itemstack1))
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
if (TileEntityCobblegen.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileEntityCobblegen.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;
|
||||
}
|
||||
}
|
||||
else if(TileEntityCobblegen.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)
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
|
|
@ -141,38 +147,38 @@ public class ContainerCobblegen extends Container
|
|||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,143 +2,146 @@ package com.oitsjustjose.criss_cross.Container;
|
|||
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerCropomator extends Container
|
||||
{
|
||||
TileEntityCropomator cropomator;
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastProcessTime;
|
||||
private int lastCatalystInUseTime;
|
||||
|
||||
|
||||
public ContainerCropomator(EntityPlayer player, TileEntityCropomator 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)
|
||||
if (timeType1 == 0)
|
||||
{
|
||||
this.cropomator.processTime = timeType2;
|
||||
}
|
||||
|
||||
if(timeType1 == 1)
|
||||
|
||||
if (timeType1 == 1)
|
||||
{
|
||||
this.cropomator.catalystTime = timeType2;
|
||||
}
|
||||
|
||||
if(timeType1 == 2)
|
||||
|
||||
if (timeType1 == 2)
|
||||
{
|
||||
this.cropomator.catalystInUseTime = timeType2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(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)
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if(this.lastUseTime != this.cropomator.processTime)
|
||||
|
||||
if (this.lastUseTime != this.cropomator.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
||||
if(this.lastProcessTime != this.cropomator.catalystTime)
|
||||
if (this.lastProcessTime != this.cropomator.catalystTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
|
||||
if(this.lastCatalystInUseTime != this.cropomator.catalystInUseTime)
|
||||
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())
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(slotID == 2)
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(TileEntityCropomator.isValid(itemstack1))
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
if (TileEntityCropomator.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileEntityCropomator.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;
|
||||
}
|
||||
}
|
||||
else if(TileEntityCropomator.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)
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
|
|
@ -146,38 +149,38 @@ public class ContainerCropomator extends Container
|
|||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,141 +2,146 @@ package com.oitsjustjose.criss_cross.Container;
|
|||
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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
|
||||
{
|
||||
TileEntityElectroextractor electroextractor;
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastCrushTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
|
||||
public ContainerElectroextractor(EntityPlayer player, TileEntityElectroextractor 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)
|
||||
if (timeType1 == 0)
|
||||
{
|
||||
this.electroextractor.crushTime = timeType2;
|
||||
}
|
||||
|
||||
if(timeType1 == 1)
|
||||
|
||||
if (timeType1 == 1)
|
||||
{
|
||||
this.electroextractor.fuelTime = timeType2;
|
||||
}
|
||||
|
||||
if(timeType1 == 2)
|
||||
|
||||
if (timeType1 == 2)
|
||||
{
|
||||
this.electroextractor.fuelInUseTime = timeType2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(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)
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if(this.lastUseTime != this.electroextractor.crushTime)
|
||||
|
||||
if (this.lastUseTime != this.electroextractor.crushTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
|
||||
if(this.lastCrushTime != this.electroextractor.fuelTime)
|
||||
if (this.lastCrushTime != this.electroextractor.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
||||
if(this.lastFuelTime != this.electroextractor.fuelInUseTime)
|
||||
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())
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(slotID == 2)
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(TileEntityElectroextractor.isValid(itemstack1))
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
if (TileEntityElectroextractor.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileEntityElectroextractor.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;
|
||||
}
|
||||
}
|
||||
else if(TileEntityElectroextractor.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)
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
|
|
@ -144,38 +149,38 @@ public class ContainerElectroextractor extends Container
|
|||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,139 +1,145 @@
|
|||
package com.oitsjustjose.criss_cross.Container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityStonegen;
|
||||
|
||||
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
|
||||
{
|
||||
TileEntityStonegen Stonegen;
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
|
||||
public ContainerStonegen(EntityPlayer player, TileEntityStonegen 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)
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.Stonegen.processTime = timeType2;
|
||||
this.Stonegen.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.Stonegen.fuelTime = timeType2;
|
||||
this.Stonegen.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.Stonegen.fuelUsetime = timeType2;
|
||||
this.Stonegen.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(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)
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if(this.lastUseTime != this.Stonegen.processTime)
|
||||
|
||||
if (this.lastUseTime != this.Stonegen.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
||||
if(this.lastChopTime != this.Stonegen.fuelTime)
|
||||
if (this.lastChopTime != this.Stonegen.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
||||
if(this.lastFuelTime != this.Stonegen.fuelUsetime)
|
||||
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())
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(slotID == 2)
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(TileEntityStonegen.isValid(itemstack1))
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
if (TileEntityStonegen.isValid(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileEntityStonegen.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;
|
||||
}
|
||||
}
|
||||
else if(TileEntityStonegen.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)
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
|
|
@ -141,38 +147,38 @@ public class ContainerStonegen extends Container
|
|||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,139 +2,144 @@ package com.oitsjustjose.criss_cross.Container;
|
|||
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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
|
||||
{
|
||||
TileEntityWoodchipper woodchipper;
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
|
||||
public ContainerWoodchipper(EntityPlayer player, TileEntityWoodchipper 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)
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.woodchipper.processTime = timeType2;
|
||||
this.woodchipper.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.woodchipper.fuelTime = timeType2;
|
||||
this.woodchipper.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.woodchipper.fuelUsetime = timeType2;
|
||||
this.woodchipper.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(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)
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if(this.lastUseTime != this.woodchipper.processTime)
|
||||
|
||||
if (this.lastUseTime != this.woodchipper.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
||||
if(this.lastChopTime != this.woodchipper.fuelTime)
|
||||
if (this.lastChopTime != this.woodchipper.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
||||
if(this.lastFuelTime != this.woodchipper.fuelUsetime)
|
||||
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())
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(slotID == 2)
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(TileEntityWoodchipper.isValidForWoodchipper(itemstack1))
|
||||
else
|
||||
if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if(!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
if (TileEntityWoodchipper.isValidForWoodchipper(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (TileEntityWoodchipper.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;
|
||||
}
|
||||
}
|
||||
else if(TileEntityWoodchipper.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)
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
|
|
@ -142,38 +147,38 @@ public class ContainerWoodchipper extends Container
|
|||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,59 +1,53 @@
|
|||
package com.oitsjustjose.criss_cross.Container;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
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())
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,52 +2,58 @@ 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.CCCraftingRecipes;
|
||||
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.Reference;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
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 = Reference.modid, version = Reference.version, guiFactory = Reference.guifactory)
|
||||
public class CrissCross
|
||||
{
|
||||
public static CreativeTabs CCTab;
|
||||
|
||||
|
||||
@Instance(Reference.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());
|
||||
FMLCommonHandler.instance().bus().register(new ConfigHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ConfigHandler());
|
||||
CCTab = new CCTab();
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
|
||||
CCBlocks.init();
|
||||
CCItems.init();
|
||||
CCCraftingRecipes.init();
|
||||
CCMachineRecipes.init();
|
||||
OreDictionaryAdder.init();
|
||||
proxy.init();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
if(event.getSide().isClient())
|
||||
ClientProxy.init();
|
||||
}
|
||||
}
|
||||
|
|
@ -13,22 +13,21 @@ import net.minecraft.util.StatCollector;
|
|||
public class GUICobblegen extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cobblegen.png");
|
||||
|
||||
|
||||
private TileEntityCobblegen cobblegen;
|
||||
|
||||
|
||||
public GUICobblegen(EntityPlayer player, TileEntityCobblegen 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);
|
||||
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);
|
||||
|
|
@ -36,8 +35,8 @@ public class GUICobblegen extends GuiContainer
|
|||
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())
|
||||
|
||||
if (this.cobblegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.cobblegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
|
|
|
|||
|
|
@ -15,22 +15,21 @@ import net.minecraft.util.StatCollector;
|
|||
public class GUICropomator extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cropomator.png");
|
||||
|
||||
|
||||
private TileEntityCropomator cropomator;
|
||||
|
||||
|
||||
public GUICropomator(EntityPlayer player, TileEntityCropomator 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);
|
||||
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);
|
||||
|
|
@ -38,8 +37,8 @@ public class GUICropomator extends GuiContainer
|
|||
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())
|
||||
|
||||
if (this.cropomator.isUsingFuel())
|
||||
{
|
||||
int i1 = this.cropomator.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
|
|
|
|||
|
|
@ -12,24 +12,22 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
public class GUIElectroextractor extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross",
|
||||
"textures/gui/electroextractor.png");
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/electroextractor.png");
|
||||
|
||||
private TileEntityElectroextractor electroextractor;
|
||||
|
||||
|
||||
public GUIElectroextractor(EntityPlayer player, TileEntityElectroextractor 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);
|
||||
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);
|
||||
|
|
@ -37,8 +35,8 @@ public class GUIElectroextractor extends GuiContainer
|
|||
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())
|
||||
|
||||
if (this.electroextractor.isUsingFuel())
|
||||
{
|
||||
int i1 = this.electroextractor.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
|
|
|
|||
|
|
@ -2,30 +2,32 @@ package com.oitsjustjose.criss_cross.GUI;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
|
@ -10,11 +11,12 @@ import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
|||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityStonegen;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import com.oitsjustjose.criss_cross.Container.ContainerCobblegen;
|
||||
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
|
||||
{
|
||||
|
|
@ -23,83 +25,83 @@ public class GUIHandler implements IGuiHandler
|
|||
public static final int Woodchipper = 3;
|
||||
public static final int Cobblegen = 4;
|
||||
public static final int Stonegen = 5;
|
||||
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityCropomator)
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
if (tile instanceof TileEntityCropomator)
|
||||
{
|
||||
TileEntityCropomator TE = (TileEntityCropomator) tile;
|
||||
|
||||
|
||||
return new ContainerCropomator(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityElectroextractor)
|
||||
if (tile instanceof TileEntityElectroextractor)
|
||||
{
|
||||
TileEntityElectroextractor TE = (TileEntityElectroextractor) tile;
|
||||
|
||||
|
||||
return new ContainerElectroextractor(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityWoodchipper)
|
||||
if (tile instanceof TileEntityWoodchipper)
|
||||
{
|
||||
TileEntityWoodchipper TE = (TileEntityWoodchipper) tile;
|
||||
|
||||
|
||||
return new ContainerWoodchipper(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityCobblegen)
|
||||
if (tile instanceof TileEntityCobblegen)
|
||||
{
|
||||
TileEntityCobblegen TE = (TileEntityCobblegen) tile;
|
||||
|
||||
|
||||
return new ContainerCobblegen(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityStonegen)
|
||||
if (tile instanceof TileEntityStonegen)
|
||||
{
|
||||
TileEntityStonegen TE = (TileEntityStonegen) 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(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityCropomator)
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
if (tile instanceof TileEntityCropomator)
|
||||
{
|
||||
TileEntityCropomator TE = (TileEntityCropomator) tile;
|
||||
|
||||
|
||||
return new GUICropomator(player, TE);
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityElectroextractor)
|
||||
|
||||
if (tile instanceof TileEntityElectroextractor)
|
||||
{
|
||||
TileEntityElectroextractor TE = (TileEntityElectroextractor) tile;
|
||||
|
||||
|
||||
return new GUIElectroextractor(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityWoodchipper)
|
||||
if (tile instanceof TileEntityWoodchipper)
|
||||
{
|
||||
TileEntityWoodchipper TE = (TileEntityWoodchipper) tile;
|
||||
|
||||
|
||||
return new GUIWoodchipper(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityCobblegen)
|
||||
if (tile instanceof TileEntityCobblegen)
|
||||
{
|
||||
TileEntityCobblegen TE = (TileEntityCobblegen) tile;
|
||||
|
||||
|
||||
return new GUICobblegen(player, TE);
|
||||
}
|
||||
if(tile instanceof TileEntityStonegen)
|
||||
if (tile instanceof TileEntityStonegen)
|
||||
{
|
||||
TileEntityStonegen TE = (TileEntityStonegen) tile;
|
||||
|
||||
|
||||
return new GUIStonegen(player, TE);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,22 +13,21 @@ import net.minecraft.util.StatCollector;
|
|||
public class GUIStonegen extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/stonegen.png");
|
||||
|
||||
|
||||
private TileEntityStonegen stonegen;
|
||||
|
||||
|
||||
public GUIStonegen(EntityPlayer player, TileEntityStonegen 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);
|
||||
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);
|
||||
|
|
@ -36,8 +35,8 @@ public class GUIStonegen extends GuiContainer
|
|||
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())
|
||||
|
||||
if (this.stonegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.stonegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
|
|
|
|||
|
|
@ -13,22 +13,21 @@ import net.minecraft.util.StatCollector;
|
|||
public class GUIWoodchipper extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/woodchipper.png");
|
||||
|
||||
|
||||
private TileEntityWoodchipper woodchipper;
|
||||
|
||||
|
||||
public GUIWoodchipper(EntityPlayer player, TileEntityWoodchipper 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);
|
||||
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);
|
||||
|
|
@ -36,8 +35,8 @@ public class GUIWoodchipper extends GuiContainer
|
|||
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())
|
||||
|
||||
if (this.woodchipper.isUsingFuel())
|
||||
{
|
||||
int i1 = this.woodchipper.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
|
|
|
|||
|
|
@ -3,17 +3,16 @@ package com.oitsjustjose.criss_cross.GUI;
|
|||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
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(),
|
||||
Reference.modid, false, true, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
super(guiScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Reference.modid,
|
||||
false, true, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
package com.oitsjustjose.criss_cross.Items;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class CCItems
|
||||
{
|
||||
public static Item dusts;
|
||||
public static Item magicBucket;
|
||||
|
||||
public static Item buckets;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
dusts = new ItemDust();
|
||||
magicBucket = new ItemMagicBuckets();
|
||||
buckets = new ItemModBuckets();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,116 +4,85 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
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>();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon overlay;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon base;
|
||||
|
||||
|
||||
public ItemDust()
|
||||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
GameRegistry.registerItem(this, "itemDust");
|
||||
GameRegistry.registerItem(this, "dust");
|
||||
Reference.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
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamageForRenderPass(int meta, int pass)
|
||||
{
|
||||
return pass == 0 ? base : overlay;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getUnlocalizedName(ItemStack itemStack)
|
||||
// {
|
||||
// if(itemStack.getItemDamage() >= colors.size() || itemStack.getItemDamage() >= dustNames.size())
|
||||
// {
|
||||
// itemStack.setStackDisplayName(StatCollector.translateToLocal("item.CrissCross.trash.name"));
|
||||
// return("item." + Reference.modid + ".trash");
|
||||
// }
|
||||
// return "item." + Reference.modid + "." + dustNames.get(itemStack.getItemDamage());
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
overlay = register.registerIcon(Reference.modid + ":dust_overlay");
|
||||
base = register.registerIcon(Reference.modid + ":dust_base");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
if(pass == 1)
|
||||
if (pass == 1)
|
||||
{
|
||||
if(stack.getItemDamage() >= colors.size())
|
||||
if (stack.getItemDamage() >= colors.size())
|
||||
return 0;
|
||||
return colors.get(stack.getItemDamage());
|
||||
}
|
||||
else
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@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 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);
|
||||
}
|
||||
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return "item." + Reference.modid + ".dust";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for(int i = 0; i < dustNames.size(); i++)
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
{
|
||||
ItemStack stack = new ItemStack(item, 1, i);
|
||||
list.add(stack);
|
||||
|
|
|
|||
|
|
@ -1,135 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.Items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemMagicBuckets extends Item
|
||||
{
|
||||
String[] types = new String[]
|
||||
{
|
||||
"everfulBucket", "voidBucket"
|
||||
};
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon[] icons = new IIcon[types.length];
|
||||
|
||||
public ItemMagicBuckets()
|
||||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CrissCross.CCTab);
|
||||
GameRegistry.registerItem(this, "magicBucket");
|
||||
this.setContainerItem(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = register.registerIcon(Reference.modid + ":" + types[i]);
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
if(!world.canMineBlock(player, x, y, z))
|
||||
return itemstack;
|
||||
|
||||
if(!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, itemstack))
|
||||
return itemstack;
|
||||
|
||||
if(itemstack.getItemDamage() == 1)
|
||||
{
|
||||
Material material = world.getBlock(x, y, z).getMaterial();
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(material.isLiquid() && meta == 0)
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(world.getBlock(x, y, z).getMaterial() == Material.lava
|
||||
|| world.getBlock(x, y, z).getMaterial() == Material.water)
|
||||
return itemstack;
|
||||
|
||||
if(movingobjectposition.sideHit == 0)
|
||||
--y;
|
||||
|
||||
if(movingobjectposition.sideHit == 1)
|
||||
++y;
|
||||
|
||||
if(movingobjectposition.sideHit == 2)
|
||||
--z;
|
||||
|
||||
if(movingobjectposition.sideHit == 3)
|
||||
++z;
|
||||
|
||||
if(movingobjectposition.sideHit == 4)
|
||||
--x;
|
||||
|
||||
if(movingobjectposition.sideHit == 5)
|
||||
++x;
|
||||
|
||||
if(!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, itemstack))
|
||||
return itemstack;
|
||||
|
||||
if(itemstack.getItemDamage() == 0)
|
||||
world.setBlock(x, y, z, Blocks.flowing_water);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return "item." + Reference.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));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
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.Reference;
|
||||
|
||||
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");
|
||||
Reference.add(this);
|
||||
}
|
||||
|
||||
@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(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return "item." + Reference.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));
|
||||
}
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ import com.oitsjustjose.criss_cross.Items.CCItems;
|
|||
import com.oitsjustjose.criss_cross.Util.CCLog;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
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 CCCraftingRecipes
|
||||
|
|
@ -21,118 +21,94 @@ public class CCCraftingRecipes
|
|||
initBucketRecipes();
|
||||
initBlockGeneratorRecipes();
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
));
|
||||
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 initBucketRecipes()
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.magicBucket, 1, 0),
|
||||
"DFD", "WBW", "DFD", 'W', Items.water_bucket, 'B', Items.bucket, 'D', "gemDiamond", 'F', "blockDiamond"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CCItems.magicBucket, 1, 1),
|
||||
"OGO",
|
||||
"GBG",
|
||||
"OGO",
|
||||
'B', Items.bucket, 'G', "blockGlass", 'O', Blocks.obsidian
|
||||
));
|
||||
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void woodChipperRecipe()
|
||||
{
|
||||
String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null)
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
|
||||
if(unlocItem.length == 2)
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if(unlocItem.length == 3)
|
||||
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("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
|
||||
});
|
||||
|
||||
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(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null)
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
|
||||
if(unlocItem.length == 2)
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if(unlocItem.length == 3)
|
||||
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("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
|
||||
});
|
||||
|
||||
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(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null)
|
||||
|
||||
if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
|
||||
if(unlocItem.length == 2)
|
||||
ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if(unlocItem.length == 3)
|
||||
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("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
|
||||
});
|
||||
|
||||
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,6 +1,7 @@
|
|||
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;
|
||||
|
|
@ -8,10 +9,10 @@ import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
|||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.CCLog;
|
||||
import com.oitsjustjose.criss_cross.Util.ClientProxy;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.ItemHelper;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
|
@ -19,6 +20,7 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class CCMachineRecipes
|
||||
|
|
@ -26,7 +28,7 @@ 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();
|
||||
|
|
@ -35,129 +37,102 @@ public class CCMachineRecipes
|
|||
initElectroextractorOreDictionary();
|
||||
initWoodchipperFuels();
|
||||
initWoodchipperOreDictionary();
|
||||
|
||||
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));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
//TODO: Finish this, it's pretty important
|
||||
|
||||
public static void initAutosmithRecipes()
|
||||
{
|
||||
for(int i = 0; i < Item.itemRegistry.getKeys().size(); i++)
|
||||
{
|
||||
Item item = Item.getItemById(i);
|
||||
if(item != null && item.isItemTool(new ItemStack(item, 1, Short.MAX_VALUE)) && item.isRepairable())
|
||||
{
|
||||
for(int j = 0; j < Item.ToolMaterial.values().length; j++)
|
||||
{
|
||||
ItemStack repairItem = Item.ToolMaterial.values()[j].getRepairItemStack();
|
||||
if(repairItem.getDisplayName().contains(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void initCropomatorRecipes()
|
||||
{
|
||||
for(int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
||||
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.cropomatorInputs[i].split(":");
|
||||
if(unlocStack.length == 2)
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1);
|
||||
CropomatorRecipes.getInstance().addRecipe(newStack,
|
||||
new ItemStack(newStack.getItem(), cropomatorQTY, newStack.getItemDamage()));
|
||||
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("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 (unlocStack.length == 3)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(
|
||||
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
|
||||
Integer.parseInt(unlocStack[2]));
|
||||
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()));
|
||||
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("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)
|
||||
catch (Exception e)
|
||||
{
|
||||
CCLog.warn("[CrissCross]: Error reading itemstack for inputs from input file at item: " + (i + 1));
|
||||
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++)
|
||||
for (int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.cropomatorCatalysts[i].split(":");
|
||||
if(unlocStack.length == 2)
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
TileEntityCropomator.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileEntityCropomator.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("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 (unlocStack.length == 3)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(
|
||||
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
|
||||
Integer.parseInt(unlocStack[2]));
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileEntityCropomator.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
|
||||
+ " could not be added to the Cropomator's catalyst list.");
|
||||
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)
|
||||
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()
|
||||
|
|
@ -168,25 +143,25 @@ public class CCMachineRecipes
|
|||
}
|
||||
};
|
||||
InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3);
|
||||
for(int i = 0; i < 9; i++)
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
localInventoryCrafting.setInventorySlotContents(i, null);
|
||||
}
|
||||
ArrayList localArrayList = OreDictionary.getOres("logWood");
|
||||
for(int j = 0; j < localArrayList.size(); j++)
|
||||
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)
|
||||
if (ItemHelper.getItemDamage(localItemStack1) == 32767)
|
||||
{
|
||||
for(int k = 0; k < 16; k++)
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
localItemStack3 = ItemHelper.cloneStack(localItemStack1, 1);
|
||||
localItemStack3.setItemDamage(k);
|
||||
localInventoryCrafting.setInventorySlotContents(0, localItemStack3);
|
||||
localItemStack4 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
|
||||
if(localItemStack4 != null)
|
||||
if (localItemStack4 != null)
|
||||
{
|
||||
ItemStack localItemStack5 = localItemStack4.copy();
|
||||
ItemStack tmp129_127 = localItemStack5;
|
||||
|
|
@ -200,7 +175,7 @@ public class CCMachineRecipes
|
|||
ItemStack localItemStack2 = localItemStack1.copy();
|
||||
localInventoryCrafting.setInventorySlotContents(0, localItemStack2);
|
||||
localItemStack3 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
|
||||
if(localItemStack3 != null)
|
||||
if (localItemStack3 != null)
|
||||
{
|
||||
localItemStack4 = localItemStack3.copy();
|
||||
ItemStack tmp201_199 = localItemStack4;
|
||||
|
|
@ -210,61 +185,58 @@ public class CCMachineRecipes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void initWoodchipperFuels()
|
||||
{
|
||||
for(int i = 0; i < ConfigHandler.woodchipperFuels.length; i++)
|
||||
for (int i = 0; i < ConfigHandler.woodchipperFuels.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.woodchipperFuels[i].split(":");
|
||||
if(unlocStack.length == 2)
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileEntityWoodchipper.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("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 (unlocStack.length == 3)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(
|
||||
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
|
||||
Integer.parseInt(unlocStack[2]));
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileEntityWoodchipper.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i]
|
||||
+ " could not be added to the Woodchipper's fuel list.");
|
||||
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)
|
||||
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++)
|
||||
for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] unlocStack = ConfigHandler.electroextractorEnergySources[i].split(":");
|
||||
if(unlocStack.length == 2)
|
||||
if (unlocStack.length == 2)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
TileEntityElectroextractor.addFuel(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]));
|
||||
else
|
||||
{
|
||||
CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i]
|
||||
|
|
@ -272,14 +244,13 @@ public class CCMachineRecipes
|
|||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||
}
|
||||
}
|
||||
|
||||
if(unlocStack.length == 3)
|
||||
|
||||
if (unlocStack.length == 3)
|
||||
{
|
||||
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||
if (ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]) != null)
|
||||
{
|
||||
ItemStack newStack = new ItemStack(
|
||||
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
|
||||
Integer.parseInt(unlocStack[2]));
|
||||
ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(unlocStack[0], unlocStack[1]).getItem(), 1, Integer.parseInt(
|
||||
unlocStack[2]));
|
||||
TileEntityElectroextractor.addFuel(newStack);
|
||||
}
|
||||
else
|
||||
|
|
@ -290,46 +261,50 @@ public class CCMachineRecipes
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
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++)
|
||||
for (int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++)
|
||||
{
|
||||
String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":");
|
||||
if(OreDictionary.doesOreNameExist("ore" + entry[0]) && OreDictionary.doesOreNameExist("ingot" + entry[0]))
|
||||
if (doesOreNameExist("ore" + entry[0]) && doesOreNameExist("ingot" + entry[0]))
|
||||
{
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres("ore" + 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));
|
||||
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(!OreDictionary.doesOreNameExist("ore" + entry[0]))
|
||||
CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0]
|
||||
+ ".");
|
||||
else if(!OreDictionary.doesOreNameExist("ingot" + entry[0]))
|
||||
CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] + ".");
|
||||
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++)
|
||||
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
{
|
||||
ItemStack ingot = null;
|
||||
if(OreDictionary.doesOreNameExist("ingot" + dustNames.get(i)))
|
||||
if (doesOreNameExist("ingot" + dustNames.get(i)))
|
||||
ingot = OreDictionary.getOres("ingot" + dustNames.get(i)).get(0);
|
||||
if(ingot != null)
|
||||
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,6 +1,5 @@
|
|||
package com.oitsjustjose.criss_cross.Recipes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
|
@ -8,59 +7,56 @@ import java.util.Map.Entry;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.oitsjustjose.criss_cross.Items.CCItems;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCobblegen;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityStonegen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class CobblegenRecipes
|
||||
{
|
||||
private static final CobblegenRecipes recipeBase = new CobblegenRecipes();
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
|
||||
public CobblegenRecipes()
|
||||
{
|
||||
this.addRecipe(new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
|
||||
TileEntityCobblegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileEntityCobblegen.addFuel(new ItemStack(CCItems.magicBucket));
|
||||
TileEntityCobblegen.addFuel(new ItemStack(CCItems.buckets));
|
||||
}
|
||||
|
||||
|
||||
public static CobblegenRecipes 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())
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
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());
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
|
|
|
|||
|
|
@ -14,44 +14,43 @@ 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())
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
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());
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
|
|
|
|||
|
|
@ -16,40 +16,39 @@ 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())
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
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());
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
|
|
|
|||
|
|
@ -16,47 +16,46 @@ public class StonegenRecipes
|
|||
{
|
||||
private static final StonegenRecipes recipeBase = new StonegenRecipes();
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
|
||||
public StonegenRecipes()
|
||||
{
|
||||
this.addRecipe(new ItemStack(Items.lava_bucket), new ItemStack(Blocks.stone));
|
||||
TileEntityStonegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileEntityStonegen.addFuel(new ItemStack(CCItems.magicBucket));
|
||||
TileEntityStonegen.addFuel(new ItemStack(CCItems.buckets));
|
||||
}
|
||||
|
||||
|
||||
public static StonegenRecipes 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())
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
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());
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
|
|
|
|||
|
|
@ -16,40 +16,39 @@ 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())
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
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());
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
|
|
|
|||
|
|
@ -2,239 +2,73 @@ package com.oitsjustjose.criss_cross.TileEntity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Blocks.BlockCobblegen;
|
||||
import com.oitsjustjose.criss_cross.Container.ContainerCobblegen;
|
||||
import com.oitsjustjose.criss_cross.Recipes.CobblegenRecipes;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.oitsjustjose.criss_cross.Blocks.BlockCobblegen;
|
||||
import com.oitsjustjose.criss_cross.Recipes.CobblegenRecipes;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityCobblegen extends TileEntity implements ISidedInventory
|
||||
public class TileEntityCobblegen extends TileEntityGeneric
|
||||
{
|
||||
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 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;
|
||||
|
||||
public static ArrayList<ItemStack> getFuels()
|
||||
public TileEntityCobblegen()
|
||||
{
|
||||
return fuelItems;
|
||||
super("Cobblegen", proTicks);
|
||||
}
|
||||
|
||||
|
||||
@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 getInventoryName()
|
||||
{
|
||||
return "container.cobblegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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");
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if(this.fuelTime == 0 && this.canProcess())
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if(this.ItemStacks[1] != null)
|
||||
{
|
||||
if(this.ItemStacks[1].stackSize == 0)
|
||||
|
||||
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())
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if(this.processTime == proTicks)
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
|
|
@ -246,147 +80,75 @@ public class TileEntityCobblegen extends TileEntity implements ISidedInventory
|
|||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag != this.fuelTime > 0)
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockCobblegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
|
||||
this.zCoord);
|
||||
BlockCobblegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if(input != null)
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = CobblegenRecipes.getInstance().getResult(input);
|
||||
if(output == null)
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if(!outputSlot.isItemEqual(output))
|
||||
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(CobblegenRecipes.getInstance().getResult(itemstack) != null)
|
||||
if (CobblegenRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if(this.canProcess())
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = CobblegenRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if(outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
if(input.stackSize <= 0)
|
||||
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.xCoord, this.yCoord, this.zCoord) != this ? false
|
||||
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int slot)
|
||||
{
|
||||
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return side != 0 || slot != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerCobblegen(playerInventory.player, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,232 +3,80 @@ 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.Recipes.ElectroextractorRecipes;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.TileEntity;
|
||||
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 TileEntityCropomator extends TileEntity implements ISidedInventory
|
||||
public class TileEntityCropomator 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 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;
|
||||
|
||||
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 getInventoryName()
|
||||
{
|
||||
return "container.cropomator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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");
|
||||
this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.catalystTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if(this.catalystTime > 0)
|
||||
|
||||
if (this.catalystTime > 0)
|
||||
{
|
||||
--this.catalystTime;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if(this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if(this.catalystTime == 0 && this.canProcess())
|
||||
if (this.catalystTime == 0 && this.canProcess())
|
||||
{
|
||||
this.catalystInUseTime = this.catalystTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if(this.catalystTime > 0)
|
||||
|
||||
if (this.catalystTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if(this.ItemStacks[1] != null)
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if(this.ItemStacks[1].stackSize == 0)
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isUsingFuel() && this.canProcess())
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if(this.processTime == proTicks)
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
|
|
@ -240,50 +88,211 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
|||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag != this.catalystTime > 0)
|
||||
|
||||
if (flag != this.catalystTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.xCoord, this.yCoord,
|
||||
this.zCoord);
|
||||
BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
|
||||
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 Reference.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)
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
||||
if(output == null)
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if(!outputSlot.isItemEqual(output))
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if(fuelItems.get(i) == itemstack)
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
|
|
@ -291,96 +300,152 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if(CropomatorRecipes.getInstance().getResult(itemstack) != null)
|
||||
if (CropomatorRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if(this.canProcess())
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if(outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if(input.stackSize <= 0)
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
|
||||
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
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;
|
||||
}
|
||||
|
||||
public void openInventory()
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
public void closeInventory()
|
||||
|
||||
@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[] getAccessibleSlotsFromSide(int slot)
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side)
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return side != 0 || slot != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,238 +3,79 @@ package com.oitsjustjose.criss_cross.TileEntity;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Blocks.BlockElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Items.ItemDust;
|
||||
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.Reference;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
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.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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 TileEntityElectroextractor extends TileEntity implements ISidedInventory
|
||||
public class TileEntityElectroextractor 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 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 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 getInventoryName()
|
||||
{
|
||||
return "container.electroextractor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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");
|
||||
this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if(this.fuelTime == 0 && this.canProcess())
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelInUseTime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if(this.ItemStacks[1] != null)
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if(this.ItemStacks[1].stackSize == 0)
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isUsingFuel() && this.canProcess())
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.crushTime;
|
||||
|
||||
if(this.crushTime == proTicks)
|
||||
|
||||
if (this.crushTime == proTicks)
|
||||
{
|
||||
this.crushTime = 0;
|
||||
this.processItem();
|
||||
|
|
@ -246,50 +87,194 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
|
|||
this.crushTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag != this.fuelTime > 0)
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
|
||||
this.zCoord);
|
||||
BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
|
||||
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)
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
||||
if(output == null)
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if(!outputSlot.isItemEqual(output))
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if(fuelItems.get(i) == itemstack)
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
|
|
@ -297,96 +282,175 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if(ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
|
||||
if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if(this.canProcess())
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if(outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if(input.stackSize <= 0)
|
||||
if (input.stackSize <= 0)
|
||||
{
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
return isItemEnergetic(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isItemEnergetic(ItemStack itemstack)
|
||||
{
|
||||
for(int i = 0; i < fuelItems.size(); i++)
|
||||
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())
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
|
||||
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
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;
|
||||
}
|
||||
|
||||
public void openInventory()
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeInventory()
|
||||
|
||||
@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 Reference.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[] getAccessibleSlotsFromSide(int slot)
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side)
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return side != 0 || slot != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
package com.oitsjustjose.criss_cross.TileEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
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 abstract class TileEntityGeneric extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = 0;
|
||||
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 String defaultName;
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||
|
||||
public int fuelTime;
|
||||
public int processTime;
|
||||
public int fuelUsetime;
|
||||
|
||||
public TileEntityGeneric(String tileName, int processTicks)
|
||||
{
|
||||
this.defaultName = tileName;
|
||||
this.proTicks = processTicks;
|
||||
|
||||
/*
|
||||
* Any Tile Entity extending this TE must implement its own update(),
|
||||
* canProcess(), isValid(), processItem(), and createContainer()
|
||||
*/
|
||||
}
|
||||
|
||||
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 Reference.modid + ":container." + this.defaultName.toLowerCase();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
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 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 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;
|
||||
}
|
||||
|
||||
@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." + this.defaultName.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,239 +3,78 @@ 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.Recipes.StonegenRecipes;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.TileEntity;
|
||||
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 TileEntityStonegen extends TileEntity implements ISidedInventory
|
||||
public class TileEntityStonegen 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 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;
|
||||
|
||||
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 getInventoryName()
|
||||
{
|
||||
return "container.stonegen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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");
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if(this.fuelTime == 0 && this.canProcess())
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if(this.ItemStacks[1] != null)
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if(this.ItemStacks[1].stackSize == 0)
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isUsingFuel() && this.canProcess())
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if(this.processTime == proTicks)
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
|
|
@ -247,50 +86,216 @@ public class TileEntityStonegen extends TileEntity implements ISidedInventory
|
|||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag != this.fuelTime > 0)
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
|
||||
this.zCoord);
|
||||
BlockStonegen.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
|
||||
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 Reference.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)
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = StonegenRecipes.getInstance().getResult(input);
|
||||
if(output == null)
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if(!outputSlot.isItemEqual(output))
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if(fuelItems.get(i) == itemstack)
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
|
|
@ -298,96 +303,155 @@ public class TileEntityStonegen extends TileEntity implements ISidedInventory
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValid(ItemStack itemstack)
|
||||
{
|
||||
if(StonegenRecipes.getInstance().getResult(itemstack) != null)
|
||||
if (StonegenRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if(this.canProcess())
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = StonegenRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if(outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
if(input.stackSize <= 0)
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
|
||||
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
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;
|
||||
}
|
||||
|
||||
public void openInventory()
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeInventory()
|
||||
|
||||
@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[] getAccessibleSlotsFromSide(int slot)
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side)
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return side != 0 || slot != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,240 +3,79 @@ 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.Reference;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.TileEntity;
|
||||
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 TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
||||
public class TileEntityWoodchipper 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 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;
|
||||
|
||||
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 getInventoryName()
|
||||
{
|
||||
return "container.woodchipper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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");
|
||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if(this.fuelTime == 0 && this.canProcess())
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||
|
||||
if(this.fuelTime > 0)
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if(this.ItemStacks[1] != null)
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if(this.ItemStacks[1].stackSize == 0)
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isUsingFuel() && this.canProcess())
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.processTime;
|
||||
|
||||
if(this.processTime == proTicks)
|
||||
|
||||
if (this.processTime == proTicks)
|
||||
{
|
||||
this.processTime = 0;
|
||||
this.processItem();
|
||||
|
|
@ -248,50 +87,211 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
|||
this.processTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag != this.fuelTime > 0)
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
|
||||
this.zCoord);
|
||||
BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
|
||||
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 Reference.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)
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
||||
if(output == null)
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if(!outputSlot.isItemEqual(output))
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
if(fuelItems.get(i) == itemstack)
|
||||
if (fuelItems.get(i) == itemstack)
|
||||
{
|
||||
fuelItems.remove(i);
|
||||
return true;
|
||||
|
|
@ -299,97 +299,156 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValidForWoodchipper(ItemStack itemstack)
|
||||
{
|
||||
if(WoodchipperRecipes.getInstance().getResult(itemstack) != null)
|
||||
if (WoodchipperRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if(this.canProcess())
|
||||
if (this.canProcess())
|
||||
{
|
||||
|
||||
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if(outputSlot == null)
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if(outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
else
|
||||
if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
|
||||
--input.stackSize;
|
||||
if(input.stackSize <= 0)
|
||||
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++)
|
||||
for (int i = 0; i < fuelItems.size(); i++)
|
||||
{
|
||||
ItemStack temp = fuelItems.get(i);
|
||||
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
|
||||
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
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;
|
||||
}
|
||||
|
||||
public void openInventory()
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeInventory()
|
||||
|
||||
@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[] getAccessibleSlotsFromSide(int slot)
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side)
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
return side != 0 || slot != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,27 +6,27 @@ import org.apache.logging.log4j.Logger;
|
|||
public class CCLog
|
||||
{
|
||||
private static Logger LOGGER = LogManager.getLogger(Reference.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);
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ public class CCTab extends CreativeTabs
|
|||
{
|
||||
super(CreativeTabs.getNextID(), "tab" + Reference.modid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return Item.getItemFromBlock(CCBlocks.electroextractor);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,78 @@
|
|||
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.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void preInit()
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void init()
|
||||
{
|
||||
|
||||
ArrayList<Block> blocks = Reference.getModBlocks();
|
||||
ArrayList<Item> items = Reference.getModItems();
|
||||
|
||||
for(Block b : blocks)
|
||||
register(b, "");
|
||||
for(Item i : items)
|
||||
register(i, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
//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;
|
||||
if(item.getHasSubtypes())
|
||||
{
|
||||
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, Reference.modid.toLowerCase() + ":" + name);
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
else if(customName == "")
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + item.getUnlocalizedName().substring(16).toLowerCase(), "inventory"));
|
||||
else
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + customName, "inventory"));
|
||||
}
|
||||
|
||||
@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).substring(16).toLowerCase();
|
||||
ModelBakery.addVariantName(itemBlock, Reference.modid.toLowerCase() + ":" + name);
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
else if(customName == "")
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + block.getUnlocalizedName().substring(16).toLowerCase(), "inventory"));
|
||||
else
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(Reference.modid.toLowerCase() + ":" + customName, "inventory"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package com.oitsjustjose.criss_cross.Util;
|
||||
|
||||
public class CommonProxy
|
||||
public abstract class CommonProxy
|
||||
{
|
||||
public void preInit()
|
||||
public static void preInit()
|
||||
{
|
||||
};
|
||||
|
||||
public void init()
|
||||
|
||||
public static void init()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
package com.oitsjustjose.criss_cross.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
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
|
||||
{
|
||||
|
|
@ -15,135 +16,116 @@ public class ConfigHandler
|
|||
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 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 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 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)
|
||||
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>.")
|
||||
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>.")
|
||||
|
||||
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,
|
||||
|
||||
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",
|
||||
|
||||
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>.")
|
||||
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,
|
||||
|
||||
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",
|
||||
|
||||
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.")
|
||||
|
||||
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,
|
||||
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",
|
||||
|
||||
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
|
||||
|
||||
// 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())
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if(event.modID.equalsIgnoreCase(Reference.modid))
|
||||
if (event.modID.equalsIgnoreCase(Reference.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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,77 +11,76 @@ import net.minecraft.world.World;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author TeamCoFH All credit goes to TeamCoFH, this was required for proper
|
||||
* woodchipper recipes :)
|
||||
*
|
||||
* @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)
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(item, stackSize);
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack cloneStack(Block item, int stackSize)
|
||||
{
|
||||
|
||||
if(item == null)
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(item, stackSize);
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack cloneStack(ItemStack stack, int stackSize)
|
||||
{
|
||||
|
||||
if(stack == null)
|
||||
|
||||
if (stack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ItemStack retStack = stack.copy();
|
||||
retStack.stackSize = stackSize;
|
||||
|
||||
|
||||
return retStack;
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack cloneStack(ItemStack stack)
|
||||
{
|
||||
|
||||
if(stack == null)
|
||||
|
||||
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++)
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if(inv.getStackInSlot(i) != null)
|
||||
if (inv.getStackInSlot(i) != null)
|
||||
{
|
||||
if(dmgItems[0] == null)
|
||||
if (dmgItems[0] == null)
|
||||
{
|
||||
dmgItems[0] = inv.getStackInSlot(i);
|
||||
}
|
||||
|
|
@ -92,34 +91,35 @@ public class ItemHelper
|
|||
}
|
||||
}
|
||||
}
|
||||
if(dmgItems[0] == null || dmgItems[0].getItem() == null)
|
||||
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].getItemDamageForDisplay();
|
||||
int var8 = theItem.getMaxDamage() - dmgItems[1].getItemDamageForDisplay();
|
||||
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++)
|
||||
if (dmgItems[1] != null && dmgItems[0].getItem() == dmgItems[1].getItem() && dmgItems[0].stackSize == 1 && dmgItems[1].stackSize == 1
|
||||
&& dmgItems[0].getItem().isRepairable())
|
||||
{
|
||||
recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i);
|
||||
|
||||
if(recipe.matches(inv, world))
|
||||
{
|
||||
return recipe.getCraftingResult(inv);
|
||||
}
|
||||
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;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,8 +13,8 @@ public class OreDictionaryAdder
|
|||
public static void init()
|
||||
{
|
||||
ArrayList<String> dustNames = ItemDust.getDusts();
|
||||
|
||||
for(int i = 0; i < dustNames.size(); i++)
|
||||
|
||||
for (int i = 0; i < dustNames.size(); i++)
|
||||
OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(CCItems.dusts, 1, i));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,36 @@
|
|||
package com.oitsjustjose.criss_cross.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Reference
|
||||
{
|
||||
public static final String modid = "CrissCross";
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "crisscross:cobblestonegenerator" },
|
||||
"facing=south": { "model": "crisscross:cobblestonegenerator", "y": 180 },
|
||||
"facing=west": { "model": "crisscross:cobblestonegenerator", "y": 270 },
|
||||
"facing=east": { "model": "crisscross:cobblestonegenerator", "y": 90 }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "crisscross:cropomator" },
|
||||
"facing=south": { "model": "crisscross:cropomator", "y": 180 },
|
||||
"facing=west": { "model": "crisscross:cropomator", "y": 270 },
|
||||
"facing=east": { "model": "crisscross:cropomator", "y": 90 }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "crisscross:electroextractor" },
|
||||
"facing=south": { "model": "crisscross:electroextractor", "y": 180 },
|
||||
"facing=west": { "model": "crisscross:electroextractor", "y": 270 },
|
||||
"facing=east": { "model": "crisscross:electroextractor", "y": 90 }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "crisscross:stonegenerator" },
|
||||
"facing=south": { "model": "crisscross:stonegenerator", "y": 180 },
|
||||
"facing=west": { "model": "crisscross:stonegenerator", "y": 270 },
|
||||
"facing=east": { "model": "crisscross:stonegenerator", "y": 90 }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "crisscross:woodchipper" },
|
||||
"facing=south": { "model": "crisscross:woodchipper", "y": 180 },
|
||||
"facing=west": { "model": "crisscross:woodchipper", "y": 270 },
|
||||
"facing=east": { "model": "crisscross:woodchipper", "y": 90 }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parent": "block/orientable",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"parent": "crisscross:block/cobblestonegenerator",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "crisscross:block/cropomator",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/main/resources/assets/crisscross/models/item/dust.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"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 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"parent": "crisscross:block/electroextractor",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"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 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"parent": "crisscross:block/stonegenerator",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"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 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"parent": "crisscross:block/woodchipper",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 944 B After Width: | Height: | Size: 944 B |
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 944 B After Width: | Height: | Size: 944 B |
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 738 B After Width: | Height: | Size: 738 B |
|
|
@ -4,7 +4,7 @@
|
|||
"name": "CrissCross",
|
||||
"description": "A Criss-Cross of Vanilla-Styled Machinery!",
|
||||
"version": "1.3",
|
||||
"mcversion": "1.7.10",
|
||||
"mcversion": "1.8.8",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
"authorList": ["oitsjustjose"],
|
||||
|
|
|
|||