diff --git a/README.md b/README.md index 3790246ae..6cbe6e357 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,6 @@ What that means? The License can be customized by me: - When it comes to the Mod, always link back to the the Forum Thread linked above. ### NOTES -- The above License only applies for Code I wrote myself, any APIs used (such as the CoFH API, the InventoryTweaks API and the MineFactoryReloaded API) have their own License that is being respected. +- The above License only applies for Code I wrote myself, any APIs used (such as the CoFH API and the InventoryTweaks API) have their own License that is being respected. - Almost all of the Assets used in this Mod are made by Glenthor and are owned by me. You are not allowed to copy them for any other Project without my Permission. diff --git a/build.gradle b/build.gradle index 12d0a25d9..887dc9aa2 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'maven' -version = "1.7.10-0.0.6.0" +version = "1.7.10-0.0.6.1" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index 2c7456d48..5e5da37a6 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -10,6 +10,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import ellpeck.actuallyadditions.achievement.InitAchievements; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.communication.InterModCommunications; import ellpeck.actuallyadditions.config.ConfigurationHandler; import ellpeck.actuallyadditions.crafting.GrinderCrafting; import ellpeck.actuallyadditions.crafting.InitCrafting; @@ -24,6 +25,7 @@ import ellpeck.actuallyadditions.material.InitItemMaterials; import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.proxy.IProxy; import ellpeck.actuallyadditions.recipe.FuelHandler; +import ellpeck.actuallyadditions.recipe.HairyBallHandler; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; @@ -76,8 +78,14 @@ public class ActuallyAdditions{ ItemCoffee.initIngredients(); GrinderCrafting.init(); ItemCrafting.initMashedFoodRecipes(); + HairyBallHandler.init(); proxy.postInit(); Util.logInfo("PostInitialization Finished."); } + + @EventHandler + public void onIMCReceived(FMLInterModComms.IMCEvent event){ + InterModCommunications.processIMC(event.getMessages()); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index 2e145b832..f8ec91d38 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -113,3 +113,7 @@ -Testificate Bucks -Village House that has a Coffee Machine -Villager who sells Coffee and Cookies + +-Inventory Emitter + -Emits a Redstone Signal dependant on the Amount of a specified Item in it + -Items are configurable in the GUI diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java index d7de4dbf3..1160e5652 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java @@ -20,25 +20,27 @@ public abstract class BlockContainerBase extends BlockContainer{ } public void dropInventory(World world, int x, int y, int z){ - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileEntityInventoryBase){ - TileEntityInventoryBase tileEntity = (TileEntityInventoryBase)tile; - if(tileEntity.getSizeInventory() > 0){ - for(int i = 0; i < tileEntity.getSizeInventory(); i++){ - ItemStack itemStack = tileEntity.getStackInSlot(i); - if(itemStack != null && itemStack.stackSize > 0){ - Random rand = new Random(); - float dX = rand.nextFloat()*0.8F+0.1F; - float dY = rand.nextFloat()*0.8F+0.1F; - float dZ = rand.nextFloat()*0.8F+0.1F; - EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy()); - if(itemStack.hasTagCompound()) entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy()); - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian()*factor; - entityItem.motionY = rand.nextGaussian()*factor+0.2F; - entityItem.motionZ = rand.nextGaussian()*factor; - world.spawnEntityInWorld(entityItem); - itemStack.stackSize = 0; + if(!world.isRemote){ + TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TileEntityInventoryBase){ + TileEntityInventoryBase tileEntity = (TileEntityInventoryBase)tile; + if(tileEntity.getSizeInventory() > 0){ + for(int i = 0; i < tileEntity.getSizeInventory(); i++){ + ItemStack itemStack = tileEntity.getStackInSlot(i); + if(itemStack != null && itemStack.stackSize > 0){ + Random rand = new Random(); + float dX = rand.nextFloat()*0.8F+0.1F; + float dY = rand.nextFloat()*0.8F+0.1F; + float dZ = rand.nextFloat()*0.8F+0.1F; + EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy()); + if(itemStack.hasTagCompound()) entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy()); + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian()*factor; + entityItem.motionY = rand.nextGaussian()*factor+0.2F; + entityItem.motionZ = rand.nextGaussian()*factor; + world.spawnEntityInWorld(entityItem); + itemStack.stackSize = 0; + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java new file mode 100644 index 000000000..f908f34aa --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java @@ -0,0 +1,85 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class BlockGeneric extends Block implements INameableItem{ + + public String name; + + public BlockGeneric(String name){ + super(Material.rock); + this.name = name; + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public IIcon getIcon(int side, int meta){ + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.uncommon; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int meta){ + return meta; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 5f9495cde..9f5fa7856 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -121,7 +121,7 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { if(KeyUtil.isShiftPressed()){ list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY)); - for(int i = 1; i < 6; i++){ + for(int i = 1; i < 7; i++){ list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + (i + 1))); } if((((BlockInputter)theBlock).isAdvanced)) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)theBlock).getName() + ".desc")); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java index 513a52bcc..8ceeed77b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java @@ -91,7 +91,7 @@ public class BlockMisc extends Block implements INameableItem{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName()); + if(stack.getItemDamage() < allMiscBlocks.length) BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java index e04e805df..f48af25a9 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java @@ -2,7 +2,6 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.items.ItemSeed; import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,16 +15,11 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.api.FertilizerType; -import powercrystals.minefactoryreloaded.api.HarvestType; -import powercrystals.minefactoryreloaded.api.IFactoryFertilizable; -import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; import java.util.List; -import java.util.Map; import java.util.Random; -public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHarvestable, IFactoryFertilizable{ +public class BlockPlant extends BlockCrops implements INameableItem{ private IIcon[] textures; private String name; @@ -42,19 +36,9 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar this.addDropAmount = addDropAmount; } - @Override - public boolean canBlockStay(World world, int x, int y, int z){ - return y > 0 && y < 256 && world.getBlock(x, y-1, z).getMaterial() == ((ItemSeed)this.seedItem).soilBlock.getMaterial(); - } - @Override public int quantityDropped(int meta, int fortune, Random random){ - return meta >= 7 ? super.quantityDropped(meta, fortune, random) : random.nextInt(addDropAmount)+minDropAmount; - } - - @Override - public boolean canPlaceBlockOn(Block block){ - return block == ((ItemSeed)this.seedItem).soilBlock; + return meta >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(meta, fortune, random); } @Override @@ -143,57 +127,4 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar return damage; } } - - @Override - public Block getPlant(){ - return this; - } - - @Override - public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType){ - return true; - } - - @Override - public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType){ - if (this.func_149851_a(world, x, y, z, world.isRemote)){ - if(!world.isRemote){ - if(this.func_149852_a(world, world.rand, x, y, z)){ - this.func_149853_b(world, world.rand, x, y, z); - return true; - } - } - } - return false; - } - - @Override - public HarvestType getHarvestType(){ - return HarvestType.Normal; - } - - @Override - public boolean breakBlock(){ - return true; - } - - @Override - public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z){ - return world.getBlockMetadata(x, y, z) >= 7; - } - - @Override - public List getDrops(World world, Random rand, Map harvesterSettings, int x, int y, int z){ - return this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0); - } - - @Override - public void preHarvest(World world, int x, int y, int z){ - - } - - @Override - public void postHarvest(World world, int x, int y, int z){ - - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java new file mode 100644 index 000000000..ab02e09b0 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java @@ -0,0 +1,129 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.List; + +public class BlockSlabs extends Block implements INameableItem{ + + private String name; + private Block fullBlock; + + public BlockSlabs(String name, Block fullBlock){ + super(Material.rock); + this.fullBlock = fullBlock; + this.name = name; + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity){ + this.setBlockBoundsBasedOnState(world, x, y, z); + super.addCollisionBoxesToList(world, x, y, z, axis, list, entity); + } + + @Override + public void setBlockBoundsForItemRender(){ + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + int meta = world.getBlockMetadata(x, y, z); + float minY = meta == 1 ? 0.5F : 0.0F; + float maxY = meta == 1 ? 1.0F : 0.5F; + this.setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F); + } + + @Override + public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){ + if (side == 1) return meta; + if (side == 0 || hitY >= 0.5F) return meta+1; + return meta; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta){ + return this.fullBlock.getIcon(0, 0); + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.uncommon; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int meta){ + return meta; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){ + if(world.getBlock(x, y, z) == this.theBlock && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){ + if(world.setBlock(x, y, z, ((BlockSlabs)this.theBlock).fullBlock, 0, 3)){ + world.playSoundEffect(x+0.5F, y+0.5F, z+0.5F, this.theBlock.stepSound.getBreakSound(), (this.theBlock.stepSound.getVolume()+1.0F)/2.0F, this.theBlock.stepSound.getPitch()*0.8F); + stack.stackSize--; + return true; + } + } + return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ); + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java new file mode 100644 index 000000000..97da40c66 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java @@ -0,0 +1,69 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.block.Block; +import net.minecraft.block.BlockStairs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +import java.util.List; + +public class BlockStair extends BlockStairs implements INameableItem{ + + private String name; + + public BlockStair(Block block, String name){ + super(block, 0); + this.name = name; + this.setLightOpacity(0); + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.uncommon; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int meta){ + return meta; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java new file mode 100644 index 000000000..93e88aa18 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java @@ -0,0 +1,118 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.metalists.TheWildPlants; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBush; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.List; + +public class BlockWildPlant extends BlockBush implements INameableItem{ + + public static final TheWildPlants[] allWildPlants = TheWildPlants.values(); + public IIcon[] textures = new IIcon[allWildPlants.length]; + + public BlockWildPlant(){ + this.setStepSound(soundTypeGrass); + } + + @Override + public boolean canBlockStay(World world, int x, int y, int z){ + return world.getBlockMetadata(x, y, z) == TheWildPlants.RICE.ordinal() ? world.getBlock(x, y-1, z).getMaterial() == Material.water : world.getBlock(x, y - 1, z).canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this); + } + + @Override + public boolean canSilkHarvest(){ + return false; + } + + @SuppressWarnings("all") + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list){ + for (int j = 0; j < allWildPlants.length; j++){ + list.add(new ItemStack(item, 1, j)); + } + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune){ + return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, x, y, z, 7, fortune); + } + + @Override + public IIcon getIcon(int side, int metadata){ + return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getIcon(0, 7); + } + + @Override + public String getName(){ + return "blockWild"; + } + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z){ + int meta = world.getBlockMetadata(x, y, z); + return meta >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[meta].wildVersionOf).seedItem; + } + + @Override + public String getOredictName(){ + return ""; + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName() + (stack.getItemDamage() >= allWildPlants.length ? " ERROR!" : allWildPlants[stack.getItemDamage()].getName()); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + if(stack.getItemDamage() < allWildPlants.length) BlockUtil.addInformation(theBlock, list, 1, allWildPlants[stack.getItemDamage()].getName()); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIconFromDamage(int meta){ + return this.theBlock.getIcon(0, meta); + } + + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 821a6a463..53f03e35b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.blocks; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.CompatUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; @@ -10,12 +11,12 @@ import net.minecraft.item.EnumRarity; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import org.apache.logging.log4j.Level; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; public class InitBlocks{ public static Block blockCompost; public static Block blockMisc; + public static Block blockWildPlant; public static Block blockFeeder; public static Block blockGiantChest; @@ -67,9 +68,29 @@ public class InitBlocks{ public static Block blockEnergizer; public static Block blockEnervator; + public static Block blockTestifiBucksGreenWall; + public static Block blockTestifiBucksWhiteWall; + public static Block blockTestifiBucksGreenStairs; + public static Block blockTestifiBucksWhiteStairs; + public static Block blockTestifiBucksGreenSlab; + public static Block blockTestifibucksWhiteSlab; + public static void init(){ Util.logInfo("Initializing Blocks..."); + blockTestifiBucksGreenWall = new BlockGeneric("blockTestifiBucksGreenWall"); + BlockUtil.register(blockTestifiBucksGreenWall, BlockGeneric.TheItemBlock.class); + blockTestifiBucksWhiteWall = new BlockGeneric("blockTestifiBucksWhiteWall"); + BlockUtil.register(blockTestifiBucksWhiteWall, BlockGeneric.TheItemBlock.class); + blockTestifiBucksGreenStairs = new BlockStair(blockTestifiBucksGreenWall, "blockTestifiBucksGreenStairs"); + BlockUtil.register(blockTestifiBucksGreenStairs, BlockStair.TheItemBlock.class); + blockTestifiBucksWhiteStairs = new BlockStair(blockTestifiBucksWhiteWall, "blockTestifiBucksWhiteStairs"); + BlockUtil.register(blockTestifiBucksWhiteStairs, BlockStair.TheItemBlock.class); + blockTestifiBucksGreenSlab = new BlockSlabs("blockTestifiBucksGreenSlab", blockTestifiBucksGreenWall); + BlockUtil.register(blockTestifiBucksGreenSlab, BlockSlabs.TheItemBlock.class); + blockTestifibucksWhiteSlab = new BlockSlabs("blockTestifibucksWhiteSlab", blockTestifiBucksWhiteWall); + BlockUtil.register(blockTestifibucksWhiteSlab, BlockSlabs.TheItemBlock.class); + blockEnergizer = new BlockEnergizer(true); BlockUtil.register(blockEnergizer, BlockEnergizer.TheItemBlock.class); @@ -108,23 +129,19 @@ public class InitBlocks{ blockRice = new BlockPlant("blockRice", 6, 1, 2); BlockUtil.register(blockRice, BlockPlant.TheItemBlock.class, false); - FactoryRegistry.sendMessage("registerHarvestable", blockRice); - FactoryRegistry.sendMessage("registerFertilizable", blockRice); + CompatUtil.registerMFRPlant(blockRice); blockCanola = new BlockPlant("blockCanola", 4, 3, 3); BlockUtil.register(blockCanola, BlockPlant.TheItemBlock.class, false); - FactoryRegistry.sendMessage("registerHarvestable", blockCanola); - FactoryRegistry.sendMessage("registerFertilizable", blockCanola); + CompatUtil.registerMFRPlant(blockCanola); blockFlax = new BlockPlant("blockFlax", 6, 2, 4); BlockUtil.register(blockFlax, BlockPlant.TheItemBlock.class, false); - FactoryRegistry.sendMessage("registerHarvestable", blockFlax); - FactoryRegistry.sendMessage("registerFertilizable", blockFlax); + CompatUtil.registerMFRPlant(blockFlax); blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2); BlockUtil.register(blockCoffee, BlockPlant.TheItemBlock.class, false); - FactoryRegistry.sendMessage("registerHarvestable", blockCoffee); - FactoryRegistry.sendMessage("registerFertilizable", blockCoffee); + CompatUtil.registerMFRPlant(blockCoffee); blockCompost = new BlockCompost(); BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class); @@ -189,10 +206,14 @@ public class InitBlocks{ blockPhantomBooster = new BlockPhantomBooster(); BlockUtil.register(blockPhantomBooster, BlockPhantomBooster.TheItemBlock.class); + blockWildPlant = new BlockWildPlant(); + BlockUtil.register(blockWildPlant, BlockWildPlant.TheItemBlock.class, false, BlockWildPlant.allWildPlants); + registerFluids(); } public static void registerFluids(){ + //Canola Fluid String canolaOil = "canolaoil"; if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){ fluidCanolaOil = new FluidAA(canolaOil).setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon); @@ -203,6 +224,7 @@ public class InitBlocks{ } fluidCanolaOil = FluidRegistry.getFluid(canolaOil); + //Canola Block if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){ blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil"); BlockUtil.register(blockCanolaOil, BlockFluidFlowing.TheItemBlock.class, false); @@ -212,6 +234,7 @@ public class InitBlocks{ } blockCanolaOil = fluidCanolaOil.getBlock(); + //Oil Fluid String oil = "oil"; if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){ fluidOil = new FluidAA(oil).setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon); @@ -222,6 +245,7 @@ public class InitBlocks{ } fluidOil = FluidRegistry.getFluid(oil); + //Oil Block if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil"); BlockUtil.register(blockOil, BlockFluidFlowing.TheItemBlock.class, false); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheWildPlants.java b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheWildPlants.java new file mode 100644 index 000000000..8d1a03e5c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheWildPlants.java @@ -0,0 +1,36 @@ +package ellpeck.actuallyadditions.blocks.metalists; + +import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.block.Block; +import net.minecraft.item.EnumRarity; + +public enum TheWildPlants implements INameableItem{ + + CANOLA("Canola", EnumRarity.rare, "blockCanolaWild", InitBlocks.blockCanola), + FLAX("Flax", EnumRarity.rare, "blockFlaxWild", InitBlocks.blockFlax), + RICE("Rice", EnumRarity.rare, "blockRiceWild", InitBlocks.blockRice), + COFFEE("Coffee", EnumRarity.rare, "blockCoffeeWild", InitBlocks.blockCoffee); + + public final String name; + public final String oredictName; + public final EnumRarity rarity; + public final Block wildVersionOf; + + TheWildPlants(String name, EnumRarity rarity, String oredictName, Block wildVersionOf){ + this.name = name; + this.rarity = rarity; + this.oredictName = oredictName; + this.wildVersionOf = wildVersionOf; + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public String getOredictName(){ + return this.oredictName; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java b/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java new file mode 100644 index 000000000..3fa551e59 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java @@ -0,0 +1,70 @@ +package ellpeck.actuallyadditions.communication; + +import cpw.mods.fml.common.event.FMLInterModComms; +import ellpeck.actuallyadditions.items.ItemCoffee; +import ellpeck.actuallyadditions.recipe.GrinderRecipeManualRegistry; +import ellpeck.actuallyadditions.recipe.HairyBallHandler; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import org.apache.logging.log4j.Level; + +import java.util.List; + +public class InterModCommunications{ + + public static void processIMC(List messages){ + for(FMLInterModComms.IMCMessage message : messages){ + if(message.key.equalsIgnoreCase("registerCrusherRecipe")){ + NBTTagCompound compound = message.getNBTValue(); + if(compound != null){ + ItemStack input = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("input")); + ItemStack outputOne = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("outputOne")); + ItemStack outputTwo = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("outputTwo")); + int secondChance = compound.getInteger("secondChance"); + + if(input != null && outputOne != null){ + GrinderRecipeManualRegistry.registerRecipe(input, outputOne, outputTwo, secondChance); + Util.logInfo("Crusher Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + input.toString() + " -> " + outputOne.toString() + (outputTwo != null ? " + " + outputTwo.toString() + ", Second Chance: " + secondChance : "")); + } + else ModUtil.LOGGER.log(Level.ERROR, "Crusher Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Input or an Output!"); + } + } + + if(message.key.equalsIgnoreCase("registerCoffeeMachineRecipe")){ + NBTTagCompound compound = message.getNBTValue(); + if(compound != null){ + ItemStack input = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("input")); + int potionID = compound.getInteger("id"); + int duration = compound.getInteger("duration"); + int amplifier = compound.getInteger("amplifier"); + int maxAmp = compound.getInteger("maxAmp"); + + if(input != null && potionID > 0 && duration > 0 && maxAmp > 0){ + PotionEffect effect = new PotionEffect(potionID, duration, amplifier); + ItemCoffee.registerIngredient(new ItemCoffee.Ingredient(input, new PotionEffect[]{effect}, maxAmp)); + Util.logInfo("Coffee Machine Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + input.toString() + " -> " + effect.toString()); + } + else ModUtil.LOGGER.log(Level.ERROR, "Coffee Machine Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Input, a Potion ID, a Duration or a max Amplifier!"); + } + } + + if(message.key.equalsIgnoreCase("registerBallOfHairRecipe")){ + NBTTagCompound compound = message.getNBTValue(); + if(compound != null){ + ItemStack output = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("output")); + int chance = compound.getInteger("chance"); + + if(output != null && chance > 0){ + HairyBallHandler.addReturn(output, chance); + Util.logInfo("Ball Of Hair Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + output.toString() + ", Chance: " + chance); + } + else ModUtil.LOGGER.log(Level.ERROR, "Ball Of Hair Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Output or a Chance!"); + } + } + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index 5a2e05617..2ed8f077e 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.config.values; import ellpeck.actuallyadditions.config.ConfigCategories; import ellpeck.actuallyadditions.config.ConfigValues; +import net.minecraftforge.fluids.FluidContainerRegistry; public enum ConfigIntValues{ @@ -86,9 +87,9 @@ public enum ConfigIntValues{ COFFEE_CACHE_ADDED_PER_ITEM("Coffee Machine: Coffee added per Cup", ConfigCategories.MACHINE_VALUES, 1, 1, 300, "The amount of Coffee added by one Coffee Item in the Coffee Machine"), COFFEE_CACHE_USED_PER_ITEM("Coffee Machine: Coffee used per Cup", ConfigCategories.MACHINE_VALUES, 10, 1, 300, "The amount of Coffee used to brew one Coffee in the Coffee Machine"), COFFEE_MACHINE_TIME_USED("Coffee Machine: Time to Brew", ConfigCategories.MACHINE_VALUES, 500, 10, 10000, "The amount of time the Coffee Machine takes to brew a Coffee"), + COFFEE_MACHINE_WATER_USED("Coffee Machine: Water Used per Cup", ConfigCategories.MACHINE_VALUES, 500, 1, 4*FluidContainerRegistry.BUCKET_VOLUME, "The amount of Water the Coffee Machine uses per Cup"), COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from"), - DRILL_ENERGY_USE("Drill: Energy Use Per Block or Hit", ConfigCategories.DRILL_VALUES, 100, 5, 10000, "How much Energy the Drill uses per Block"), DRILL_SPEED_EXTRA_USE("Speed Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 50, 0, 10000, "How much extra Energy the Speed Upgrade uses"), diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java index 28a62a506..092df6a4f 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java @@ -3,9 +3,9 @@ package ellpeck.actuallyadditions.crafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheFoods; -import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry; -import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry.SearchCase; -import ellpeck.actuallyadditions.recipe.GrinderRecipes; +import ellpeck.actuallyadditions.recipe.GrinderRecipeAutoRegistry; +import ellpeck.actuallyadditions.recipe.GrinderRecipeAutoRegistry.SearchCase; +import ellpeck.actuallyadditions.recipe.GrinderRecipeManualRegistry; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -16,28 +16,28 @@ public class GrinderCrafting{ public static void init(){ Util.logInfo("Initializing Crusher Recipes..."); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10)); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal())); - GrinderRecipes.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal())); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal())); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10)); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal())); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal())); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal())); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand)); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); - GrinderRecipes.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone)); - GrinderRecipes.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2)); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand)); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone)); + GrinderRecipeManualRegistry.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2)); - GrinderRecipes.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); - GrinderRecipes.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); + GrinderRecipeManualRegistry.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); + GrinderRecipeManualRegistry.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); - GrinderRecipeRegistry.searchCases.add(new SearchCase("oreNether", 6)); - GrinderRecipeRegistry.searchCases.add(new SearchCase("denseore", 8)); - GrinderRecipeRegistry.searchCases.add(new SearchCase("gem", 1)); - GrinderRecipeRegistry.searchCases.add(new SearchCase("ingot", 1)); - GrinderRecipeRegistry.searchCases.add(new SearchCase("ore", 2)); + GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("oreNether", 6)); + GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("denseore", 8)); + GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("gem", 1)); + GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("ingot", 1)); + GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("ore", 2)); - GrinderRecipeRegistry.exceptions.add("ingotBrick"); - GrinderRecipeRegistry.exceptions.add("ingotBrickNether"); + GrinderRecipeAutoRegistry.exceptions.add("ingotBrick"); + GrinderRecipeAutoRegistry.exceptions.add("ingotBrickNether"); - GrinderRecipeRegistry.registerFinally(); + GrinderRecipeAutoRegistry.registerFinally(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index aa6dea2ba..541f64054 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -31,10 +31,10 @@ public class CreativeTab extends CreativeTabs{ add(InitBlocks.blockPhantomLiquiface); add(InitBlocks.blockPhantomPlacer); add(InitBlocks.blockPhantomBreaker); - add(InitBlocks.blockPhantomBooster); - add(InitBlocks.blockCoffeeMachine); add(InitBlocks.blockInputter); add(InitBlocks.blockInputterAdvanced); + add(InitBlocks.blockPhantomBooster); + add(InitBlocks.blockCoffeeMachine); add(InitBlocks.blockGreenhouseGlass); add(InitBlocks.blockGrinder); @@ -64,6 +64,13 @@ public class CreativeTab extends CreativeTabs{ add(InitBlocks.blockCanolaPress); add(InitBlocks.blockFermentingBarrel); + add(InitBlocks.blockTestifiBucksGreenWall); + add(InitBlocks.blockTestifiBucksWhiteWall); + add(InitBlocks.blockTestifiBucksGreenStairs); + add(InitBlocks.blockTestifiBucksWhiteStairs); + add(InitBlocks.blockTestifiBucksGreenSlab); + add(InitBlocks.blockTestifibucksWhiteSlab); + add(InitItems.itemDrill); add(InitItems.itemDrillUpgradeSpeed); add(InitItems.itemDrillUpgradeSpeedII); @@ -119,10 +126,10 @@ public class CreativeTab extends CreativeTabs{ add(InitItems.itemShovelObsidian); add(InitItems.itemHoeObsidian); + add(InitItems.itemJams); + add(InitItems.itemPotionRing); add(InitItems.itemPotionRingAdvanced); - - add(InitItems.itemJams); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/event/WorldDecorationEvent.java b/src/main/java/ellpeck/actuallyadditions/event/WorldDecorationEvent.java index f78511e11..0fa3acaba 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/WorldDecorationEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/WorldDecorationEvent.java @@ -2,11 +2,12 @@ package ellpeck.actuallyadditions.event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.blocks.metalists.TheWildPlants; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.world.World; import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import java.util.ArrayList; @@ -24,11 +25,11 @@ public class WorldDecorationEvent{ int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ); if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.water){ - ArrayList blocksAroundBottom = this.getMaterialsAround(event.world, genX, genY, genZ); - ArrayList blocksAroundTop = this.getMaterialsAround(event.world, genX, genY+1, genZ); + ArrayList blocksAroundBottom = WorldUtil.getMaterialsAround(event.world, genX, genY, genZ); + ArrayList blocksAroundTop = WorldUtil.getMaterialsAround(event.world, genX, genY+1, genZ); if(blocksAroundBottom.contains(Material.grass) || blocksAroundBottom.contains(Material.ground) || blocksAroundBottom.contains(Material.rock) || blocksAroundBottom.contains(Material.sand)){ - if(!blocksAroundTop.contains(Material.water) && !blocksAroundTop.contains(Material.water) && !blocksAroundTop.contains(Material.water) && event.world.getBlock(genX, genY+1, genZ).getMaterial() == Material.air){ - event.world.setBlock(genX, genY+1, genZ, InitBlocks.blockRice, event.rand.nextInt(8), 2); + if(!blocksAroundTop.contains(Material.water) && event.world.getBlock(genX, genY+1, genZ).getMaterial() == Material.air){ + event.world.setBlock(genX, genY+1, genZ, InitBlocks.blockWildPlant, TheWildPlants.RICE.ordinal(), 2); } } } @@ -36,12 +37,12 @@ public class WorldDecorationEvent{ } } - this.genPlantNormally(InitBlocks.blockCanola, ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event); - this.genPlantNormally(InitBlocks.blockFlax, ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event); - this.genPlantNormally(InitBlocks.blockCoffee, ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.grass, event); + this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event); + this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event); + this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.grass, event); } - public void genPlantNormally(Block plant, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){ + public void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){ if(doIt){ for(int i = 0; i < amount; i++){ if(new Random().nextInt(100) == 0){ @@ -50,21 +51,11 @@ public class WorldDecorationEvent{ int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ)-1; if(event.world.getBlock(genX, genY, genZ).getMaterial() == blockBelow){ - event.world.setBlock(genX, genY+1, genZ, plant, event.rand.nextInt(8), 2); + event.world.setBlock(genX, genY+1, genZ, plant, meta, 2); } } } } } - public ArrayList getMaterialsAround(World world, int x, int y, int z){ - ArrayList blocks = new ArrayList(); - blocks.add(world.getBlock(x+1, y, z).getMaterial()); - blocks.add(world.getBlock(x-1, y, z).getMaterial()); - blocks.add(world.getBlock(x, y, z+1).getMaterial()); - blocks.add(world.getBlock(x, y, z-1).getMaterial()); - - return blocks; - } - } diff --git a/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java b/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java index 3d58b94d7..a35437f9e 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java @@ -13,31 +13,34 @@ import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraftforge.common.ChestGenHooks; -import java.util.Random; - public class InitVillager{ - public static ChestGenHooks jamHouseChest; + public static final String JAM_HOUSE_CHEST_NAME = ModUtil.MOD_ID_LOWER+".jamHouseChest"; public static void init(){ Util.logInfo("Initializing Village Addons..."); if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){ - - int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue(); - VillagerRegistry.instance().registerVillagerId(jamID); - VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler()); - - jamHouseChest = new ChestGenHooks("JamHouse", new WeightedRandomChestContent[0], 5, 20); - for(int i = 0; i < TheJams.values().length; i++){ - jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, new Random().nextInt(5)+1, i), 1, 1, 15)); - } - jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.glass_bottle, new Random().nextInt(5)+1), 1, 1, 15)); - jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.potionitem, new Random().nextInt(5)+1), 1, 1, 15)); - - VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler()); - MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER + ":jamHouseStructure"); + initJamVillagePart(); } } + private static void initJamVillagePart(){ + int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue(); + VillagerRegistry.instance().registerVillagerId(jamID); + VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler()); + + ChestGenHooks jamHouseChest = ChestGenHooks.getInfo(JAM_HOUSE_CHEST_NAME); + jamHouseChest.setMin(5); + jamHouseChest.setMax(20); + for(int i = 0; i < TheJams.values().length; i++){ + ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10)); + } + ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.glass_bottle), 1, 2, 30)); + ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20)); + + VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler()); + MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure"); + } + } diff --git a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java index 7241492df..dfc349da1 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java @@ -10,6 +10,7 @@ import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureVillagePieces; +import net.minecraftforge.common.ChestGenHooks; import java.util.List; import java.util.Random; @@ -49,8 +50,8 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{ for (int i = 0; i < xSize; i++){ for(int j = 0; j < zSize; j++){ - this.clearCurrentPositionBlocksUpwards(world, j, ySize, i, sbb); - this.func_151554_b(world, Blocks.cobblestone, 0, j, 0, i, sbb); + this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb); + this.func_151554_b(world, Blocks.cobblestone, 0, i, -1, j, sbb); } } @@ -163,12 +164,9 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{ //Loot Chest this.placeBlockAtCurrentPosition(world, Blocks.chest, 0, 8, 1, 6, sbb); - int posX = this.getXWithOffset(8, 6); - int posY = this.getYWithOffset(1); - int posZ = this.getZWithOffset(8, 6); - TileEntity chest = world.getTileEntity(posX, posY, posZ); + TileEntity chest = world.getTileEntity(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6)); if(chest != null && chest instanceof TileEntityChest){ - WeightedRandomChestContent.generateChestContents(rand, InitVillager.jamHouseChest.getItems(rand), (TileEntityChest)chest, InitVillager.jamHouseChest.getCount(rand)); + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand)); } //Torches diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java index 23ba136db..cd6c5427a 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java @@ -15,6 +15,9 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; @InventoryContainer public class ContainerCoffeeMachine extends Container{ @@ -24,6 +27,7 @@ public class ContainerCoffeeMachine extends Container{ private int lastCoffeeAmount; private int lastEnergyAmount; private int lastBrewTime; + private int lastWaterAmount; public ContainerCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile){ this.machine = (TileEntityCoffeeMachine)tile; @@ -38,6 +42,9 @@ public class ContainerCoffeeMachine extends Container{ } } + this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_WATER_INPUT, 26, 73)); + this.addSlotToContainer(new SlotOutput(machine, TileEntityCoffeeMachine.SLOT_WATER_OUTPUT, 45, 73)); + for (int i = 0; i < 3; i++){ for (int j = 0; j < 9; j++){ this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); @@ -54,6 +61,7 @@ public class ContainerCoffeeMachine extends Container{ iCraft.sendProgressBarUpdate(this, 0, this.machine.storage.getEnergyStored()); iCraft.sendProgressBarUpdate(this, 1, this.machine.coffeeCacheAmount); iCraft.sendProgressBarUpdate(this, 2, this.machine.brewTime); + iCraft.sendProgressBarUpdate(this, 3, this.machine.tank.getFluidAmount()); } @@ -66,11 +74,13 @@ public class ContainerCoffeeMachine extends Container{ if(this.lastEnergyAmount != this.machine.storage.getEnergyStored()) iCraft.sendProgressBarUpdate(this, 0, this.machine.storage.getEnergyStored()); if(this.lastCoffeeAmount != this.machine.coffeeCacheAmount) iCraft.sendProgressBarUpdate(this, 1, this.machine.coffeeCacheAmount); if(this.lastBrewTime != this.machine.brewTime) iCraft.sendProgressBarUpdate(this, 2, this.machine.brewTime); + if(this.lastWaterAmount != this.machine.tank.getFluidAmount()) iCraft.sendProgressBarUpdate(this, 3, this.machine.tank.getFluidAmount()); } this.lastEnergyAmount = this.machine.storage.getEnergyStored(); this.lastCoffeeAmount = this.machine.coffeeCacheAmount; this.lastBrewTime = this.machine.brewTime; + this.lastWaterAmount = this.machine.tank.getFluidAmount(); } @Override @@ -79,6 +89,7 @@ public class ContainerCoffeeMachine extends Container{ if(par1 == 0) this.machine.storage.setEnergyStored(par2); if(par1 == 1) this.machine.coffeeCacheAmount = par2; if(par1 == 2) this.machine.brewTime = par2; + if(par1 == 3) this.machine.tank.setFluid(new FluidStack(FluidRegistry.WATER, par2)); } @Override @@ -88,7 +99,7 @@ public class ContainerCoffeeMachine extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = 11; + final int inventoryStart = 13; final int inventoryEnd = inventoryStart+26; final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; @@ -109,6 +120,9 @@ public class ContainerCoffeeMachine extends Container{ if(ItemCoffee.getIngredientFromStack(newStack) != null){ this.mergeItemStack(newStack, 3, 10, false); } + if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME))){ + this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_WATER_INPUT, TileEntityCoffeeMachine.SLOT_WATER_INPUT+1, false); + } } if(slot <= hotbarEnd && slot >= hotbarStart){ diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index e81b1d0af..1eb7a3952 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.inventory; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; -import ellpeck.actuallyadditions.recipe.GrinderRecipes; +import ellpeck.actuallyadditions.recipe.GrinderRecipeManualRegistry; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityGrinder; import invtweaks.api.container.InventoryContainer; @@ -104,7 +104,7 @@ public class ContainerGrinder extends Container{ if(currentStack.getItem() != null){ if(slot <= hotbarEnd && slot >= inventoryStart){ - if(GrinderRecipes.getOutput(currentStack, false) != null){ + if(GrinderRecipeManualRegistry.getOutput(currentStack, false) != null){ this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false); if(this.isDouble) this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java index 8b20a09f0..89893d4aa 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java @@ -20,14 +20,15 @@ public class ContainerInputter extends Container{ private TileEntityInputter tileInputter; private int lastSideToPut; - private int lastSlotToPut; private int lastSideToPull; - private int lastSlotToPull; - private int lastPlaceToPutSlotAmount; - private int lastPlaceToPullSlotAmount; private int lastIsPullWhitelist; private int lastIsPutWhitelist; + private int lastSlotPutStart; + private int lastSlotPutEnd; + private int lastSlotPullStart; + private int lastSlotPullEnd; + private boolean isAdvanced; public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile, boolean isAdvanced){ @@ -48,11 +49,11 @@ public class ContainerInputter extends Container{ for(int i = 0; i < 3; i++){ for (int j = 0; j < 9; j++){ - this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18 + (isAdvanced ? 12+GuiInputter.OFFSET_ADVANCED : 0))); + this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18 + (isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0))); } } for(int i = 0; i < 9; i++){ - this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? 12+GuiInputter.OFFSET_ADVANCED : 0))); + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0))); } } @@ -60,13 +61,14 @@ public class ContainerInputter extends Container{ public void addCraftingToCrafters(ICrafting iCraft){ super.addCraftingToCrafters(iCraft); iCraft.sendProgressBarUpdate(this, 0, this.tileInputter.sideToPut); - iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.slotToPut); - iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.sideToPull); - iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull); - iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount); - iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount); - iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.isPullWhitelist ? 1 : 0); - iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.isPutWhitelist ? 1 : 0); + iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.sideToPull); + iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.isPullWhitelist ? 1 : 0); + iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.isPutWhitelist ? 1 : 0); + + iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.slotToPutStart); + iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.slotToPutEnd); + iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.slotToPullStart); + iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.slotToPullEnd); } @Override @@ -75,37 +77,39 @@ public class ContainerInputter extends Container{ for(Object crafter : this.crafters){ ICrafting iCraft = (ICrafting)crafter; if(this.lastSideToPut != this.tileInputter.sideToPut) iCraft.sendProgressBarUpdate(this, 0, this.tileInputter.sideToPut); - if(this.lastSlotToPut != this.tileInputter.slotToPut) iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.slotToPut); - if(this.lastSideToPull != this.tileInputter.sideToPull) iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.sideToPull); - if(this.lastSlotToPull != this.tileInputter.slotToPull) iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull); - if(this.lastPlaceToPullSlotAmount != this.tileInputter.placeToPullSlotAmount) iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount); - if(this.lastPlaceToPutSlotAmount != this.tileInputter.placeToPutSlotAmount) iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount); - if(this.lastIsPullWhitelist != (this.tileInputter.isPullWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.isPullWhitelist ? 1 : 0); - if(this.lastIsPutWhitelist != (this.tileInputter.isPutWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.isPutWhitelist ? 1 : 0); + if(this.lastSideToPull != this.tileInputter.sideToPull) iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.sideToPull); + if(this.lastIsPullWhitelist != (this.tileInputter.isPullWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.isPullWhitelist ? 1 : 0); + if(this.lastIsPutWhitelist != (this.tileInputter.isPutWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.isPutWhitelist ? 1 : 0); + + if(this.lastSlotPutStart != this.tileInputter.slotToPutStart) iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.slotToPutStart); + if(this.lastSlotPutEnd != this.tileInputter.slotToPutEnd) iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.slotToPutEnd); + if(this.lastSlotPullStart != this.tileInputter.slotToPullStart) iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.slotToPullStart); + if(this.lastSlotPullEnd != this.tileInputter.slotToPullEnd) iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.slotToPullEnd); } this.lastSideToPut = this.tileInputter.sideToPut; - this.lastSlotToPut = this.tileInputter.slotToPut; this.lastSideToPull = this.tileInputter.sideToPull; - this.lastSlotToPull = this.tileInputter.slotToPull; - this.lastPlaceToPullSlotAmount = this.tileInputter.placeToPullSlotAmount; - this.lastPlaceToPutSlotAmount = this.tileInputter.placeToPutSlotAmount; this.lastIsPutWhitelist = this.tileInputter.isPutWhitelist ? 1 : 0; this.lastIsPullWhitelist = this.tileInputter.isPullWhitelist ? 1 : 0; + this.lastSlotPutStart = this.tileInputter.slotToPutStart; + this.lastSlotPutEnd = this.tileInputter.slotToPutEnd; + this.lastSlotPullStart = this.tileInputter.slotToPullStart; + this.lastSlotPullEnd = this.tileInputter.slotToPullEnd; } @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2){ if(par1 == 0) this.tileInputter.sideToPut = par2; - if(par1 == 1) this.tileInputter.slotToPut = par2; - if(par1 == 2) this.tileInputter.sideToPull = par2; - if(par1 == 3) this.tileInputter.slotToPull = par2; - if(par1 == 4) this.tileInputter.placeToPullSlotAmount = par2; - if(par1 == 5) this.tileInputter.placeToPutSlotAmount = par2; - if(par1 == 6) this.tileInputter.isPullWhitelist = par2 == 1; - if(par1 == 7) this.tileInputter.isPutWhitelist = par2 == 1; + if(par1 == 1) this.tileInputter.sideToPull = par2; + if(par1 == 2) this.tileInputter.isPullWhitelist = par2 == 1; + if(par1 == 3) this.tileInputter.isPutWhitelist = par2 == 1; + + if(par1 == 4) this.tileInputter.slotToPutStart = par2; + if(par1 == 5) this.tileInputter.slotToPutEnd = par2; + if(par1 == 6) this.tileInputter.slotToPullStart = par2; + if(par1 == 7) this.tileInputter.slotToPullEnd = par2; } @Override @@ -115,10 +119,10 @@ public class ContainerInputter extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = this.isAdvanced ? 25 : 1; - final int inventoryEnd = inventoryStart+26; - final int hotbarStart = inventoryEnd+1; - final int hotbarEnd = hotbarStart+8; + final int inventory = this.isAdvanced ? 25 : 1; + final int inventoryEnd = inventory+26; + final int hotbar = inventoryEnd+1; + final int hotbarEnd = hotbar+8; Slot theSlot = (Slot)this.inventorySlots.get(slot); if(theSlot.getHasStack()){ @@ -126,20 +130,20 @@ public class ContainerInputter extends Container{ ItemStack newStack = currentStack.copy(); if(currentStack.getItem() != null){ - if(slot <= hotbarEnd && slot >= inventoryStart){ + if(slot <= hotbarEnd && slot >= inventory){ this.mergeItemStack(newStack, 0, 1, false); } - if(slot <= hotbarEnd && slot >= hotbarStart){ - this.mergeItemStack(newStack, inventoryStart, inventoryEnd, false); + if(slot <= hotbarEnd && slot >= hotbar){ + this.mergeItemStack(newStack, inventory, inventoryEnd, false); } - else if(slot <= inventoryEnd && slot >= inventoryStart){ - this.mergeItemStack(newStack, hotbarStart, hotbarEnd, false); + else if(slot <= inventoryEnd && slot >= inventory){ + this.mergeItemStack(newStack, hotbar, hotbarEnd, false); } - else if(slot < inventoryStart){ - this.mergeItemStack(newStack, inventoryStart, hotbarEnd, false); + else if(slot < inventory){ + this.mergeItemStack(newStack, inventory, hotbarEnd, false); } if(newStack.stackSize == 0) theSlot.putStack(null); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java index be2fc918f..fb48794bd 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java @@ -17,6 +17,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidRegistry; import org.lwjgl.opengl.GL11; import java.util.Collections; @@ -49,7 +50,7 @@ public class GuiCoffeeMachine extends GuiContainer{ public void initGui(){ super.initGui(); - GuiButton buttonOkay = new GuiButton(0, guiLeft+60, guiTop+11, 58, 20, "OK"); + GuiButton buttonOkay = new GuiButton(0, guiLeft+60, guiTop+11, 58, 20, StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.ok")); this.buttonList.add(buttonOkay); } @@ -75,7 +76,11 @@ public class GuiCoffeeMachine extends GuiContainer{ if(this.machine.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ int i = this.machine.getEnergyScaled(83); - drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 16, i); + drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 6, i); + } + if(this.machine.tank.getFluidAmount() > 0){ + int i = this.machine.getWaterScaled(64); + drawTexturedModalRect(this.guiLeft+27, this.guiTop+70-i, 182, 0, 6, i); } if(this.machine.coffeeCacheAmount > 0){ @@ -97,9 +102,13 @@ public class GuiCoffeeMachine extends GuiContainer{ super.drawScreen(x, y, f); String text1 = this.machine.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.machine.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF"; - if(x >= guiLeft+16 && y >= guiTop+5 && x <= guiLeft+33 && y <= guiTop+89){ + if(x >= guiLeft+16 && y >= guiTop+5 && x <= guiLeft+23 && y <= guiTop+89){ this.func_146283_a(Collections.singletonList(text1), x, y); } + String text3 = this.machine.tank.getFluidAmount() + "/" + this.machine.tank.getCapacity() + " mB "+StatCollector.translateToLocal(FluidRegistry.WATER.getUnlocalizedName()); + if(x >= guiLeft+27 && y >= guiTop+5 && x <= guiLeft+33 && y <= guiTop+70){ + this.func_146283_a(Collections.singletonList(text3), x, y); + } String text2 = this.machine.coffeeCacheAmount + "/" + this.machine.coffeeCacheMaxAmount+" "+StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.coffee"); if(x >= guiLeft+40 && y >= guiTop+25 && x <= guiLeft+49 && y <= guiTop+56){ diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFeeder.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFeeder.java index aee9220ef..e98a4d800 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFeeder.java @@ -19,7 +19,7 @@ import java.util.Arrays; public class GuiFeeder extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFeeder"); - private TileEntityFeeder tileFeeder; + public TileEntityFeeder tileFeeder; public int loveCounter; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java index e5570d9c1..846ee6806 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java @@ -5,20 +5,22 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.ContainerInputter; import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.gui.PacketGuiButton; +import ellpeck.actuallyadditions.network.gui.PacketGuiNumber; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityInputter; import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import java.util.Collections; @@ -29,33 +31,34 @@ public class GuiInputter extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced"); - private TileEntityInputter tileInputter; + public TileEntityInputter tileInputter; private int x; private int y; private int z; private World world; - private SmallerButton buttonSlotPutP; - private SmallerButton buttonSlotPullP; - private SmallerButton buttonSlotPutM; - private SmallerButton buttonSlotPullM; - private SmallerButton whitelistPut; private SmallerButton whitelistPull; + private GuiTextField fieldPutStart; + private GuiTextField fieldPutEnd; + + private GuiTextField fieldPullStart; + private GuiTextField fieldPullEnd; + private boolean isAdvanced; - public static final int OFFSET_ADVANCED = 35; + public static final int OFFSET_ADVANCED = 12+36; public static final String[] sideString = new String[]{ - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.down"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.north"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.east"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.south"), - StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.west")}; + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.disabled"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.up"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.down"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.north"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.east"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.south"), + StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.west")}; public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){ super(new ContainerInputter(inventory, tile, isAdvanced)); @@ -65,7 +68,7 @@ public class GuiInputter extends GuiContainer{ this.z = z; this.world = world; this.xSize = 176; - this.ySize = 93+86 + (isAdvanced ? 12+OFFSET_ADVANCED : 0); + this.ySize = 93+86+(isAdvanced ? OFFSET_ADVANCED : 0); this.isAdvanced = isAdvanced; } @@ -74,36 +77,105 @@ public class GuiInputter extends GuiContainer{ AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileInputter.getInventoryName()); } + @Override + public void updateScreen(){ + super.updateScreen(); + + this.fieldPutStart.updateCursorCounter(); + this.fieldPutEnd.updateCursorCounter(); + this.fieldPullStart.updateCursorCounter(); + this.fieldPullEnd.updateCursorCounter(); + } + @SuppressWarnings("unchecked") @Override public void initGui(){ super.initGui(); - SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 155, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), ">"); - SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 90, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "<"); - buttonSlotPutP = new SmallerButton(2, guiLeft+ 155, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "+"); - buttonSlotPutM = new SmallerButton(3, guiLeft + 90, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "-"); + this.fieldPullStart = new GuiTextField(this.fontRendererObj, guiLeft+13, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8); + this.fieldPullStart.setMaxStringLength(4); + this.fieldPullStart.setEnableBackgroundDrawing(false); + this.fieldPullEnd = new GuiTextField(this.fontRendererObj, guiLeft+50, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8); + this.fieldPullEnd.setMaxStringLength(4); + this.fieldPullEnd.setEnableBackgroundDrawing(false); - SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 70, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), ">"); - SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 5, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "<"); - buttonSlotPullP = new SmallerButton(6, guiLeft + 70, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "+"); - buttonSlotPullM = new SmallerButton(7, guiLeft + 5, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "-"); + this.fieldPutStart = new GuiTextField(this.fontRendererObj, guiLeft+98, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8); + this.fieldPutStart.setMaxStringLength(4); + this.fieldPutStart.setEnableBackgroundDrawing(false); + this.fieldPutEnd = new GuiTextField(this.fontRendererObj, guiLeft+135, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8); + this.fieldPutEnd.setMaxStringLength(4); + this.fieldPutEnd.setEnableBackgroundDrawing(false); + + SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft+155, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), ">"); + SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft+90, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), "<"); + + SmallerButton buttonSidePullP = new SmallerButton(2, guiLeft+70, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), ">"); + SmallerButton buttonSidePullM = new SmallerButton(3, guiLeft+5, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), "<"); whitelistPull = new SmallerButton(TileEntityInputter.WHITELIST_PULL_BUTTON_ID, guiLeft+3, guiTop+16, ""); whitelistPut = new SmallerButton(TileEntityInputter.WHITELIST_PUT_BUTTON_ID, guiLeft+157, guiTop+16, ""); this.buttonList.add(buttonSidePutP); - this.buttonList.add(buttonSlotPutP); this.buttonList.add(buttonSidePullP); - this.buttonList.add(buttonSlotPullP); this.buttonList.add(buttonSidePutM); - this.buttonList.add(buttonSlotPutM); this.buttonList.add(buttonSidePullM); - this.buttonList.add(buttonSlotPullM); if(this.isAdvanced){ this.buttonList.add(whitelistPut); this.buttonList.add(whitelistPull); } + + this.buttonList.add(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, guiLeft+84, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0))); + } + + @Override + protected void mouseClicked(int par1, int par2, int par3){ + this.fieldPutStart.mouseClicked(par1, par2, par3); + this.fieldPutEnd.mouseClicked(par1, par2, par3); + this.fieldPullStart.mouseClicked(par1, par2, par3); + this.fieldPullEnd.mouseClicked(par1, par2, par3); + + super.mouseClicked(par1, par2, par3); + } + + @Override + public void keyTyped(char theChar, int key){ + if((!fieldPutStart.isFocused() && !fieldPutEnd.isFocused() && !fieldPullStart.isFocused() && !fieldPullEnd.isFocused())){ + super.keyTyped(theChar, key); + } + + if(key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER){ + if(this.fieldPutStart.isFocused()) this.setVariable(this.fieldPutStart, 0); + if(this.fieldPutEnd.isFocused()) this.setVariable(this.fieldPutEnd, 1); + if(this.fieldPullStart.isFocused()) this.setVariable(this.fieldPullStart, 2); + if(this.fieldPullEnd.isFocused()) this.setVariable(this.fieldPullEnd, 3); + } + + if(Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT){ + this.fieldPutStart.textboxKeyTyped(theChar, key); + this.fieldPutEnd.textboxKeyTyped(theChar, key); + this.fieldPullStart.textboxKeyTyped(theChar, key); + this.fieldPullEnd.textboxKeyTyped(theChar, key); + } + } + + public void setVariable(GuiTextField field, int sendInt){ + if(!field.getText().isEmpty()){ + this.sendPacket(parse(field.getText()), sendInt); + field.setText(""); + } + } + + private int parse(String theInt){ + try{ + return Integer.parseInt(theInt); + } + catch(Exception e){ + return -1; + } + } + + private void sendPacket(int text, int textID){ + PacketHandler.theNetwork.sendToServer(new PacketGuiNumber(x, y, z, world, text, textID, Minecraft.getMinecraft().thePlayer)); } @Override @@ -111,31 +183,32 @@ public class GuiInputter extends GuiContainer{ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.drawTexturedModalRect(this.guiLeft, this.guiTop+93 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 0, 0, 176, 86); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+93+(isAdvanced ? OFFSET_ADVANCED : 0), 0, 0, 176, 86); this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93 + (isAdvanced ? 12+OFFSET_ADVANCED : 0)); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93+(isAdvanced ? OFFSET_ADVANCED : 0)); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 22 + 3, guiTop + 32 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.pull"), guiLeft+22+3, guiTop+32+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.put"), guiLeft+107+3, guiTop+32+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft+24+1, guiTop+45+3+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft+109+1, guiTop+45+3+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutStart), guiLeft+99, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); + this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutEnd), guiLeft+136, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); + this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullStart), guiLeft+14, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); + this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullEnd), guiLeft+51, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); + + this.fieldPutStart.drawTextBox(); + this.fieldPutEnd.drawTextBox(); + this.fieldPullStart.drawTextBox(); + this.fieldPullEnd.drawTextBox(); } @Override public void drawScreen(int x, int y, float f){ super.drawScreen(x, y, f); - this.buttonSlotPullP.enabled = this.tileInputter.placeToPullSlotAmount > 0; - this.buttonSlotPullM.enabled = this.tileInputter.placeToPullSlotAmount > 0; - - this.buttonSlotPutP.enabled = this.tileInputter.placeToPutSlotAmount > 0; - this.buttonSlotPutM.enabled = this.tileInputter.placeToPutSlotAmount > 0; - this.whitelistPull.displayString = this.tileInputter.isPullWhitelist ? "O" : "X"; this.whitelistPut.displayString = this.tileInputter.isPutWhitelist ? "O" : "X"; @@ -153,7 +226,14 @@ public class GuiInputter extends GuiContainer{ @Override public void actionPerformed(GuiButton button){ - PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer)); + if(button.id == TileEntityInputter.OKAY_BUTTON_ID){ + this.setVariable(this.fieldPutStart, 0); + this.setVariable(this.fieldPutEnd, 1); + this.setVariable(this.fieldPullStart, 2); + this.setVariable(this.fieldPullEnd, 3); + } + else + PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer)); } public static class SmallerButton extends GuiButton{ @@ -166,11 +246,10 @@ public class GuiInputter extends GuiContainer{ @Override public void drawButton(Minecraft mc, int x, int y){ - if (this.visible){ - FontRenderer renderer = mc.fontRenderer; + if(this.visible){ mc.getTextureManager().bindTexture(resLoc); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; + this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height; int k = this.getHoverState(this.field_146123_n); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); @@ -179,13 +258,36 @@ public class GuiInputter extends GuiContainer{ this.mouseDragged(mc, x, y); int color = 14737632; - if (packedFGColour != 0) color = packedFGColour; - else if (!this.enabled) color = 10526880; - else if (this.field_146123_n) color = 16777120; + if(packedFGColour != 0) color = packedFGColour; + else if(!this.enabled) color = 10526880; + else if(this.field_146123_n) color = 16777120; - this.drawCenteredString(renderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height-8) / 2, color); + this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition+this.width/2, this.yPosition+(this.height-8)/2, color); } } } + public static class TinyButton extends GuiButton{ + + public final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); + + public TinyButton(int id, int x, int y){ + super(id, x, y, 8, 8, ""); + } + + @Override + public void drawButton(Minecraft mc, int x, int y){ + if(this.visible){ + mc.getTextureManager().bindTexture(resLoc); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height; + int k = this.getHoverState(this.field_146123_n); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.drawTexturedModalRect(this.xPosition, this.yPosition, 192, k*8, 8, 8); + this.mouseDragged(mc, x, y); + } + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index 8340eb3c9..388eca358 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -5,7 +5,7 @@ import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.tools.*; import ellpeck.actuallyadditions.material.InitItemMaterials; -import ellpeck.actuallyadditions.recipe.HairyBallHandler; +import ellpeck.actuallyadditions.util.CompatUtil; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; @@ -13,9 +13,7 @@ import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.fluids.FluidContainerRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; public class InitItems{ @@ -157,26 +155,25 @@ public class InitItems{ itemHairyBall = new ItemHairyBall(); ItemUtil.register(itemHairyBall); - HairyBallHandler.init(); itemCoffeeBean = new ItemCoffeeBean(); ItemUtil.register(itemCoffeeBean); - itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, itemFoods, TheFoods.RICE.ordinal()); + itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal()); ItemUtil.register(itemRiceSeed); - FactoryRegistry.sendMessage("registerPlantable", itemRiceSeed); + CompatUtil.registerMFRSeed(itemRiceSeed); - itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, itemMisc, TheMiscItems.CANOLA.ordinal()); + itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal()); ItemUtil.register(itemCanolaSeed); - FactoryRegistry.sendMessage("registerPlantable", itemCanolaSeed); + CompatUtil.registerMFRSeed(itemCanolaSeed); - itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Blocks.grass, EnumPlantType.Plains, Items.string, 0); + itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Items.string, 0); ItemUtil.register(itemFlaxSeed); - FactoryRegistry.sendMessage("registerPlantable", itemFlaxSeed); + CompatUtil.registerMFRSeed(itemFlaxSeed); - itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, itemCoffeeBean, 0); + itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, itemCoffeeBean, 0); ItemUtil.register(itemCoffeeSeed); - FactoryRegistry.sendMessage("registerPlantable", itemCoffeeSeed); + CompatUtil.registerMFRSeed(itemCoffeeSeed); itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare); itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index 1298809c3..98e8171d3 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.items; import cofh.api.energy.ItemEnergyContainer; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; +import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; @@ -35,6 +36,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import org.apache.logging.log4j.Level; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -266,14 +268,14 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ if(this.getEnergyStored(stack) >= use){ Block block = world.getBlock(xPos, yPos, zPos); float hardness = block.getBlockHardness(world, xPos, yPos, zPos); - if(hardness > -1.0F && this.canHarvestBlock(block, stack)){ + if(hardness > -1.0F && ((x == xPos && y == yPos && z == zPos) || this.canHarvestBlock(block, stack))){ this.extractEnergy(stack, use, false); ArrayList drops = new ArrayList(); int meta = world.getBlockMetadata(xPos, yPos, zPos); if(block.canSilkHarvest(world, player, xPos, yPos, zPos, meta) && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ - drops.add(new ItemStack(block, 1, meta)); + addSilkDrops(drops, block, meta, world, player); } else{ int fortune = this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE) ? (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1) : 0; @@ -299,6 +301,18 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ } } + public static void addSilkDrops(ArrayList drops, Block block, int meta, World world, EntityPlayer player){ + try{ + Method method = ReflectionHelper.findMethod(Block.class, block, new String[]{"createStackedBlock"}, int.class); + ItemStack silkDrop = (ItemStack)method.invoke(block, meta); + if(silkDrop != null) drops.add(silkDrop); + } + catch(Exception e){ + player.addChatComponentMessage(new ChatComponentText("Oh! That shouldn't have happened! Trying to get and use a private Method here might have bugged! Report this situation to the Mod Author ASAP!")); + ModUtil.LOGGER.log(Level.ERROR, "Player "+player.getDisplayName()+" who should break a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception trying to get and use a private Method! Report this to the Mod Author ASAP!"); + } + } + @Override public String getName(){ return "itemDrill"; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java index fa2b6d5cf..d052b3690 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java @@ -7,84 +7,32 @@ import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.EnumPlantType; -import net.minecraftforge.common.util.BlockSnapshot; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.event.ForgeEventFactory; -import powercrystals.minefactoryreloaded.api.IFactoryPlantable; -import powercrystals.minefactoryreloaded.api.ReplacementBlock; import java.util.List; -public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlantable{ +public class ItemSeed extends ItemSeeds implements INameableItem{ public Block plant; - public Block soilBlock; - public EnumPlantType type; public String name; - public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, Item returnItem, int returnMeta){ - super(plant, soilBlock); + public ItemSeed(String name, Block plant, Item returnItem, int returnMeta){ + super(plant, Blocks.farmland); this.name = name; this.plant = plant; - this.soilBlock = soilBlock; - this.type = type; ((BlockPlant)this.plant).seedItem = this; ((BlockPlant)this.plant).returnItem = returnItem; ((BlockPlant)this.plant).returnMeta = returnMeta; } - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){ - if(this.type == EnumPlantType.Water || hitSide != 1) return false; - else if(player.canPlayerEdit(x, y, z, hitSide, stack) && player.canPlayerEdit(x, y + 1, z, hitSide, stack)){ - if(((BlockPlant)this.plant).canPlaceBlockOn(world.getBlock(x, y, z)) && world.isAirBlock(x, y + 1, z)){ - world.setBlock(x, y + 1, z, this.plant); - stack.stackSize--; - return true; - } - } - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - if(this.type == EnumPlantType.Water){ - MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, true); - if(pos != null){ - if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ - int i = pos.blockX; - int j = pos.blockY; - int k = pos.blockZ; - - if(player.canPlayerEdit(i, j, k, pos.sideHit, stack)){ - if(world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0 && world.isAirBlock(i, j + 1, k)){ - BlockSnapshot snap = BlockSnapshot.getBlockSnapshot(world, i, j+1, k); - world.setBlock(i, j + 1, k, this.plant); - if(ForgeEventFactory.onPlayerBlockPlace(player, snap, ForgeDirection.UP).isCanceled()){ - snap.restore(true, false); - return super.onItemRightClick(stack, world, player); - } - stack.stackSize--; - } - } - } - } - } - return super.onItemRightClick(stack, world, player); - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare; @@ -107,11 +55,6 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } - @Override - public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z){ - return this.type; - } - @Override public Block getPlant(IBlockAccess world, int x, int y, int z){ return this.plant; @@ -131,34 +74,4 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta public String getOredictName(){ return this.getName(); } - - @Override - public Item getSeed(){ - return this; - } - - @Override - public boolean canBePlanted(ItemStack stack, boolean forFermenting){ - return true; - } - - @Override - public ReplacementBlock getPlantedBlock(World world, int x, int y, int z, ItemStack stack){ - return new ReplacementBlock(this.plant); - } - - @Override - public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack){ - return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((BlockPlant)this.plant).canPlaceBlockOn(world.getBlock(x, y-1, z)); - } - - @Override - public void prePlant(World world, int x, int y, int z, ItemStack stack){ - - } - - @Override - public void postPlant(World world, int x, int y, int z, ItemStack stack){ - - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java index b8c70d382..1d3acfaf8 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -6,7 +6,7 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.inventory.gui.GuiGrinder; -import ellpeck.actuallyadditions.recipe.GrinderRecipes; +import ellpeck.actuallyadditions.recipe.GrinderRecipeManualRegistry; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.gui.inventory.GuiContainer; @@ -84,8 +84,8 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadCraftingRecipes(String outputId, Object... results){ if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){ - ArrayList recipes = GrinderRecipes.recipes; - for(GrinderRecipes.GrinderRecipe recipe : recipes){ + ArrayList recipes = GrinderRecipeManualRegistry.recipes; + for(GrinderRecipeManualRegistry.GrinderRecipe recipe : recipes){ arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); } } @@ -94,16 +94,16 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadCraftingRecipes(ItemStack result){ - ArrayList recipes = GrinderRecipes.recipes; - for(GrinderRecipes.GrinderRecipe recipe : recipes){ + ArrayList recipes = GrinderRecipeManualRegistry.recipes; + for(GrinderRecipeManualRegistry.GrinderRecipe recipe : recipes){ if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); } } @Override public void loadUsageRecipes(ItemStack ingredient){ - ArrayList recipes = GrinderRecipes.recipes; - for(GrinderRecipes.GrinderRecipe recipe : recipes){ + ArrayList recipes = GrinderRecipeManualRegistry.recipes; + for(GrinderRecipeManualRegistry.GrinderRecipe recipe : recipes){ if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){ CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance); theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredient), ingredient); diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java index a6ccb00a6..d27279f5c 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java @@ -38,6 +38,7 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{ API.hideItem(new ItemStack(InitBlocks.blockCanola)); API.hideItem(new ItemStack(InitBlocks.blockFlax)); API.hideItem(new ItemStack(InitBlocks.blockCoffee)); + API.hideItem(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java index 23daabe01..e9e621138 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java @@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; import ellpeck.actuallyadditions.network.gui.PacketGuiButton; +import ellpeck.actuallyadditions.network.gui.PacketGuiNumber; import ellpeck.actuallyadditions.util.ModUtil; public class PacketHandler{ @@ -16,5 +17,6 @@ public class PacketHandler{ theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT); theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 1, Side.SERVER); theNetwork.registerMessage(PacketFluidCollectorToClient.Handler.class, PacketFluidCollectorToClient.class, 2, Side.CLIENT); + theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 3, Side.SERVER); } } diff --git a/src/main/java/ellpeck/actuallyadditions/network/PacketTileEntityFeeder.java b/src/main/java/ellpeck/actuallyadditions/network/PacketTileEntityFeeder.java index 94fc10258..221667edb 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/PacketTileEntityFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/network/PacketTileEntityFeeder.java @@ -60,10 +60,12 @@ public class PacketTileEntityFeeder implements IMessage{ if(tile instanceof TileEntityFeeder){ TileEntityFeeder tileFeeder = (TileEntityFeeder)tile; tileFeeder.feedAnimal((EntityAnimal)world.getEntityByID(message.animalID)); - } - if(Minecraft.getMinecraft().currentScreen instanceof GuiFeeder){ - ((GuiFeeder)Minecraft.getMinecraft().currentScreen).loveCounter++; + if(Minecraft.getMinecraft().currentScreen instanceof GuiFeeder){ + if(((GuiFeeder)Minecraft.getMinecraft().currentScreen).tileFeeder == tileFeeder){ + ((GuiFeeder)Minecraft.getMinecraft().currentScreen).loveCounter++; + } + } } return null; diff --git a/src/main/java/ellpeck/actuallyadditions/network/gui/INumberReactor.java b/src/main/java/ellpeck/actuallyadditions/network/gui/INumberReactor.java new file mode 100644 index 000000000..98c70a6db --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/network/gui/INumberReactor.java @@ -0,0 +1,8 @@ +package ellpeck.actuallyadditions.network.gui; + +import net.minecraft.entity.player.EntityPlayer; + +public interface INumberReactor{ + + void onNumberReceived(int text, int textID, EntityPlayer player); +} diff --git a/src/main/java/ellpeck/actuallyadditions/network/gui/PacketGuiNumber.java b/src/main/java/ellpeck/actuallyadditions/network/gui/PacketGuiNumber.java new file mode 100644 index 000000000..2ab2d332d --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/network/gui/PacketGuiNumber.java @@ -0,0 +1,74 @@ +package ellpeck.actuallyadditions.network.gui; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + +public class PacketGuiNumber implements IMessage{ + + private int tileX; + private int tileY; + private int tileZ; + private int worldID; + private int text; + private int textID; + private int playerID; + + @SuppressWarnings("unused") + public PacketGuiNumber(){ + + } + + public PacketGuiNumber(int x, int y, int z, World world, int text, int textID, EntityPlayer player){ + this.tileX = x; + this.tileY = y; + this.tileZ = z; + this.worldID = world.provider.dimensionId; + this.text = text; + this.textID = textID; + this.playerID = player.getEntityId(); + } + + @Override + public void fromBytes(ByteBuf buf){ + this.tileX = buf.readInt(); + this.tileY = buf.readInt(); + this.tileZ = buf.readInt(); + this.worldID = buf.readInt(); + this.text = buf.readInt(); + this.textID = buf.readInt(); + this.playerID = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf){ + buf.writeInt(this.tileX); + buf.writeInt(this.tileY); + buf.writeInt(this.tileZ); + buf.writeInt(this.worldID); + buf.writeInt(this.text); + buf.writeInt(this.textID); + buf.writeInt(this.playerID); + } + + public static class Handler implements IMessageHandler{ + + @Override + public IMessage onMessage(PacketGuiNumber message, MessageContext ctx){ + World world = DimensionManager.getWorld(message.worldID); + TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ); + + if(tile instanceof INumberReactor){ + INumberReactor reactor = (INumberReactor)tile; + reactor.onNumberReceived(message.text, message.textID, (EntityPlayer)world.getEntityByID(message.playerID)); + } + + return null; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeAutoRegistry.java similarity index 93% rename from src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java rename to src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeAutoRegistry.java index f61a6e74f..d0415530f 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeAutoRegistry.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.Level; import java.util.ArrayList; -public class GrinderRecipeRegistry{ +public class GrinderRecipeAutoRegistry{ public static ArrayList searchCases = new ArrayList(); public static ArrayList exceptions = new ArrayList(); @@ -52,8 +52,8 @@ public class GrinderRecipeRegistry{ ItemStack input = theInput.copy(); ItemStack output = theDust.copy(); output.stackSize = resultAmount; - if(!GrinderRecipes.hasRecipe(input, output)){ - GrinderRecipes.registerRecipe(input, output, null, 0); + if(!GrinderRecipeManualRegistry.hasRecipe(input, output)){ + GrinderRecipeManualRegistry.registerRecipe(input, output, null, 0); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeManualRegistry.java similarity index 98% rename from src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java rename to src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeManualRegistry.java index 89131880d..f4b73cc4f 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeManualRegistry.java @@ -5,7 +5,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -public class GrinderRecipes{ +public class GrinderRecipeManualRegistry{ public static ArrayList recipes = new ArrayList(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index 75a9950e6..be3b7c1ab 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -10,19 +10,25 @@ import ellpeck.actuallyadditions.items.ItemCoffee; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.network.gui.IButtonReactor; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.*; -public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver{ +public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver, IFluidHandler{ public static final int SLOT_COFFEE_BEANS = 0; public static final int SLOT_INPUT = 1; public static final int SLOT_OUTPUT = 2; + public static final int SLOT_WATER_INPUT = 11; + public static final int SLOT_WATER_OUTPUT = 12; public EnergyStorage storage = new EnergyStorage(300000); + public FluidTank tank = new FluidTank(4*FluidContainerRegistry.BUCKET_VOLUME); public static int energyUsePerTick = ConfigIntValues.COFFEE_MACHINE_ENERGY_USED.getValue(); + public final int waterUsedPerCoffee = 500; public final int coffeeCacheMaxAmount = 300; public final int coffeeCacheAddPerItem = ConfigIntValues.COFFEE_CACHE_ADDED_PER_ITEM.getValue(); @@ -33,7 +39,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public int brewTime; public TileEntityCoffeeMachine(){ - super(11, "coffeeMachine"); + super(13, "coffeeMachine"); } @Override @@ -55,18 +61,27 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements this.coffeeCacheAmount += this.coffeeCacheAddPerItem; } } + + if(this.slots[SLOT_WATER_INPUT] != null && FluidContainerRegistry.containsFluid(this.slots[SLOT_WATER_INPUT], new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME)) && (this.slots[SLOT_WATER_OUTPUT] == null || (this.slots[SLOT_WATER_OUTPUT].stackSize < this.slots[SLOT_WATER_OUTPUT].getMaxStackSize()))){ + if(FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()){ + if(this.slots[SLOT_WATER_OUTPUT] == null) this.slots[SLOT_WATER_OUTPUT] = new ItemStack(Items.bucket); + else this.slots[SLOT_WATER_OUTPUT].stackSize++; + this.slots[SLOT_WATER_INPUT] = null; + this.tank.fill(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true); + } + } } public void brew(){ if(!worldObj.isRemote){ - if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= this.coffeeCacheUsePerItem){ + if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= this.coffeeCacheUsePerItem && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= this.waterUsedPerCoffee){ if(this.storage.getEnergyStored() >= energyUsePerTick){ this.brewTime++; this.storage.extractEnergy(energyUsePerTick, false); if(this.brewTime >= this.maxBrewTime){ this.brewTime = 0; ItemStack output = new ItemStack(InitItems.itemCoffee); - for(int i = 3; i < this.slots.length; i++){ + for(int i = 3; i < this.slots.length-2; i++){ if(this.slots[i] != null){ ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[i]); if(ingredient != null){ @@ -81,6 +96,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements this.slots[SLOT_INPUT].stackSize--; if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null; this.coffeeCacheAmount -= this.coffeeCacheUsePerItem; + this.tank.drain(this.waterUsedPerCoffee, true); } } } @@ -93,6 +109,11 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements return this.coffeeCacheAmount * i / this.coffeeCacheMaxAmount; } + @SideOnly(Side.CLIENT) + public int getWaterScaled(int i){ + return this.tank.getFluidAmount() * i / this.tank.getCapacity(); + } + @SideOnly(Side.CLIENT) public int getEnergyScaled(int i){ return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN); @@ -107,6 +128,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public void writeToNBT(NBTTagCompound compound){ super.writeToNBT(compound); this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); compound.setInteger("Cache", this.coffeeCacheAmount); compound.setInteger("Time", this.brewTime); } @@ -115,6 +137,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.storage.readFromNBT(compound); + this.tank.readFromNBT(compound); this.coffeeCacheAmount = compound.getInteger("Cache"); this.brewTime = compound.getInteger("Time"); } @@ -131,7 +154,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements @Override public boolean canExtractItem(int slot, ItemStack stack, int side){ - return slot == SLOT_OUTPUT || (slot >= 3 && ItemCoffee.getIngredientFromStack(stack) == null); + return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT; } @Override @@ -160,4 +183,34 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public boolean canConnectEnergy(ForgeDirection from){ return true; } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ + return resource.getFluid() == FluidRegistry.WATER && from != ForgeDirection.DOWN ? this.tank.fill(resource, doFill) : 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){ + return null; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid){ + return true; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid){ + return false; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from){ + return new FluidTankInfo[]{this.tank.getInfo()}; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java index 7d9c0dd33..e0951f09c 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java @@ -2,8 +2,6 @@ package ellpeck.actuallyadditions.tile; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; public class TileEntityGiantChest extends TileEntityInventoryBase{ @@ -11,36 +9,6 @@ public class TileEntityGiantChest extends TileEntityInventoryBase{ super(9*13, "giantChest"); } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - NBTTagList tagList = new NBTTagList(); - for(int currentIndex = 0; currentIndex < slots.length; ++currentIndex){ - if (slots[currentIndex] != null){ - NBTTagCompound tagCompound = new NBTTagCompound(); - //Too many slots to get saved as Byte - tagCompound.setShort("Slot", (short)currentIndex); - slots[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - compound.setTag("Items", tagList); - } - - @Override - public void readFromNBT(NBTTagCompound compound){ - super.readFromNBT(compound); - NBTTagList tagList = compound.getTagList("Items", 10); - for (int i = 0; i < tagList.tagCount(); ++i){ - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - //Too many slots to get saved as Byte - short slotIndex = tagCompound.getShort("Slot"); - if (slotIndex >= 0 && slotIndex < slots.length){ - slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } - @Override public boolean canUpdate(){ return false; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 8eb4df417..21dbf34cf 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -5,7 +5,7 @@ import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.values.ConfigIntValues; -import ellpeck.actuallyadditions.recipe.GrinderRecipes; +import ellpeck.actuallyadditions.recipe.GrinderRecipeManualRegistry; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -122,8 +122,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){ if(this.slots[theInput] != null){ - ItemStack outputOne = GrinderRecipes.getOutput(this.slots[theInput], false); - ItemStack outputTwo = GrinderRecipes.getOutput(this.slots[theInput], true); + ItemStack outputOne = GrinderRecipeManualRegistry.getOutput(this.slots[theInput], false); + ItemStack outputTwo = GrinderRecipeManualRegistry.getOutput(this.slots[theInput], true); if(this.slots[theInput] != null){ if(outputOne != null){ if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){ @@ -136,14 +136,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput){ - ItemStack outputOnFirst = GrinderRecipes.getOutput(this.slots[theInput], false); + ItemStack outputOnFirst = GrinderRecipeManualRegistry.getOutput(this.slots[theInput], false); if(outputOnFirst != null){ if(this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy(); else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize; } - int chance = GrinderRecipes.getSecondChance(this.slots[theInput]); - ItemStack outputOnSecond = GrinderRecipes.getOutput(this.slots[theInput], true); + int chance = GrinderRecipeManualRegistry.getSecondChance(this.slots[theInput]); + ItemStack outputOnSecond = GrinderRecipeManualRegistry.getOutput(this.slots[theInput], true); if(outputOnSecond != null){ int rand = new Random().nextInt(100) + 1; if(rand <= chance){ @@ -189,7 +189,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg @Override public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.getOutput(stack, false) != null; + return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipeManualRegistry.getOutput(stack, false) != null; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 7f8e91165..7f307175f 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -1,6 +1,7 @@ package ellpeck.actuallyadditions.tile; import ellpeck.actuallyadditions.network.gui.IButtonReactor; +import ellpeck.actuallyadditions.network.gui.INumberReactor; import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -9,7 +10,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor{ +public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor{ + + @Override + public void onNumberReceived(int text, int textID, EntityPlayer player){ + if(text != -1){ + if(textID == 0) this.slotToPutStart = text; + if(textID == 1) this.slotToPutEnd = text; + if(textID == 2) this.slotToPullStart = text; + if(textID == 3) this.slotToPullEnd = text; + } + this.markDirty(); + } public static class TileEntityInputterAdvanced extends TileEntityInputter{ @@ -25,15 +37,20 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt public static final int WHITELIST_PULL_BUTTON_ID = 87; public static final int WHITELIST_PUT_BUTTON_ID = 88; + public static final int OKAY_BUTTON_ID = 133; public int sideToPut = -1; - public int slotToPut = -1; - public int placeToPutSlotAmount; + + public int slotToPutStart; + public int slotToPutEnd; + public TileEntity placeToPut; public int sideToPull = -1; - public int slotToPull = -1; - public int placeToPullSlotAmount; + + public int slotToPullStart; + public int slotToPullEnd; + public TileEntity placeToPull; public boolean isAdvanced; @@ -56,24 +73,27 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.initVars(); if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ - if(!(this.sideToPull == this.sideToPut && this.slotToPull == this.slotToPut)){ - if(sideToPull != -1) this.pull(); - if(sideToPut != -1) this.put(); + if(!(this.sideToPull == this.sideToPut && this.slotToPullStart == this.slotToPutStart && this.slotToPullEnd == this.slotToPutEnd)){ + if(sideToPull != -1 && this.placeToPull instanceof IInventory) this.pull(); + if(sideToPut != -1 && this.placeToPut instanceof IInventory) this.put(); } } } } public void pull(){ - if(this.placeToPullSlotAmount > 0){ - IInventory theInventory = (IInventory)placeToPull; - int theSlotToPull = this.slotToPull; + IInventory theInventory = (IInventory)placeToPull; + if(theInventory.getSizeInventory() > 0){ + int theSlotToPull = this.slotToPullStart; int maxSize = theInventory.getInventoryStackLimit(); ISidedInventory theSided = null; if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; + boolean can = false; ItemStack theStack = null; - for(int i = (theSlotToPull != -1 ? theSlotToPull : 0); i < (theSlotToPull != -1 ? theSlotToPull+1 : placeToPullSlotAmount); i++){ + for(int i = theSlotToPull; i < this.slotToPullEnd; i++){ + if(i >= theInventory.getSizeInventory()) return; + ItemStack tempStack = theInventory.getStackInSlot(i); if(tempStack != null){ if(tempStack.getMaxStackSize() < this.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize(); @@ -85,6 +105,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if(theSided.canExtractItem(i, tempStack, j)){ theStack = tempStack; theSlotToPull = i; + can = true; break; } } @@ -92,11 +113,12 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt else{ theStack = tempStack; theSlotToPull = i; - break; + can = true; } } + if(can) break; } - if(theStack != null){ + if(can){ if(this.slots[0] != null){ if(theStack.isItemEqual(this.slots[0])){ if(theStack.stackSize <= maxSize - this.slots[0].stackSize){ @@ -121,9 +143,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } public void put(){ - if(this.placeToPutSlotAmount > 0){ - IInventory theInventory = (IInventory)placeToPut; - int theSlotToPut = this.slotToPut; + IInventory theInventory = (IInventory)placeToPut; + if(theInventory.getSizeInventory() > 0){ + int theSlotToPut = this.slotToPutStart; int maxSize = theInventory.getInventoryStackLimit(); ISidedInventory theSided = null; if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; @@ -131,7 +153,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if(this.slots[0] != null){ ItemStack theStack = null; - for(int i = (theSlotToPut != -1 ? theSlotToPut : 0); i < (theSlotToPut != -1 ? theSlotToPut+1 : placeToPutSlotAmount); i++){ + for(int i = theSlotToPut; i < this.slotToPutEnd; i++){ + if(i >= theInventory.getSizeInventory()) return; + ItemStack tempStack = theInventory.getStackInSlot(i); if(tempStack != null){ if(tempStack.getMaxStackSize() < theInventory.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize(); @@ -152,9 +176,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt theStack = tempStack; theSlotToPut = i; can = true; - break; } } + if(can) break; } if(can){ if(theStack != null){ @@ -198,20 +222,11 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.placeToPull = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPull), this.worldObj, this.xCoord, this.yCoord, this.zCoord); this.placeToPut = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPut), this.worldObj, this.xCoord, this.yCoord, this.zCoord); - if(this.placeToPull != null && this.placeToPull instanceof IInventory){ - this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory(); + if(this.placeToPull instanceof IInventory){ + if(this.slotToPullEnd <= 0) this.slotToPullEnd = ((IInventory)this.placeToPull).getSizeInventory(); } - else{ - this.placeToPullSlotAmount = 0; - this.slotToPull = -1; - } - - if(this.placeToPut != null && this.placeToPut instanceof IInventory){ - this.placeToPutSlotAmount = ((IInventory)this.placeToPut).getSizeInventory(); - } - else{ - this.placeToPutSlotAmount = 0; - this.slotToPut = -1; + if(this.placeToPut instanceof IInventory){ + if(this.slotToPutEnd <= 0) this.slotToPutEnd = ((IInventory)this.placeToPut).getSizeInventory(); } } @@ -226,33 +241,38 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt return; } + if(buttonID == 0 || buttonID == 1){ + this.slotToPutStart = 0; + this.slotToPutEnd = 0; + } + if(buttonID == 2 || buttonID == 3){ + this.slotToPullStart = 0; + this.slotToPullEnd = 0; + } + if(buttonID == 0) this.sideToPut++; if(buttonID == 1) this.sideToPut--; - if(buttonID == 2) this.slotToPut++; - if(buttonID == 3) this.slotToPut--; - if(buttonID == 4) this.sideToPull++; - if(buttonID == 5) this.sideToPull--; - if(buttonID == 6) this.slotToPull++; - if(buttonID == 7) this.slotToPull--; + if(buttonID == 2) this.sideToPull++; + if(buttonID == 3) this.sideToPull--; if(this.sideToPut >= 6) this.sideToPut = -1; else if(this.sideToPut < -1) this.sideToPut = 5; else if(this.sideToPull >= 6) this.sideToPull = -1; else if(this.sideToPull < -1) this.sideToPull = 5; - else if(this.slotToPut >= this.placeToPutSlotAmount) this.slotToPut = -1; - else if(this.slotToPut < -1) this.slotToPut = this.placeToPutSlotAmount-1; - else if(this.slotToPull >= this.placeToPullSlotAmount) this.slotToPull = -1; - else if(this.slotToPull < -1) this.slotToPull = this.placeToPullSlotAmount-1; + + this.markDirty(); } @Override public void writeToNBT(NBTTagCompound compound){ super.writeToNBT(compound); compound.setInteger("SideToPut", this.sideToPut); - compound.setInteger("SlotToPut", this.slotToPut); + compound.setInteger("SlotToPut", this.slotToPutStart); + compound.setInteger("SlotToPutEnd", this.slotToPutEnd); compound.setInteger("SideToPull", this.sideToPull); - compound.setInteger("SlotToPull", this.slotToPull); + compound.setInteger("SlotToPull", this.slotToPullStart); + compound.setInteger("SlotToPullEnd", this.slotToPullEnd); compound.setBoolean("PullWhitelist", this.isPullWhitelist); compound.setBoolean("PutWhitelist", this.isPutWhitelist); } @@ -260,14 +280,16 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt @Override public void readFromNBT(NBTTagCompound compound){ this.sideToPut = compound.getInteger("SideToPut"); - this.slotToPut = compound.getInteger("SlotToPut"); + this.slotToPutStart = compound.getInteger("SlotToPut"); + this.slotToPutEnd = compound.getInteger("SlotToPutEnd"); this.sideToPull = compound.getInteger("SideToPull"); - this.slotToPull = compound.getInteger("SlotToPull"); + this.slotToPullStart = compound.getInteger("SlotToPull"); + this.slotToPullEnd = compound.getInteger("SlotToPullEnd"); this.isPullWhitelist = compound.getBoolean("PullWhitelist"); this.isPutWhitelist = compound.getBoolean("PutWhitelist"); super.readFromNBT(compound); } - + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return i == 0; @@ -282,4 +304,4 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == 0; } -} +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java index ff35bbba2..b3fac963e 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java @@ -43,27 +43,31 @@ public class BlockUtil{ public static final ArrayList wailaRegisterList = new ArrayList(); - public static void register(Block block, Class itemBlock, Enum[] list){ - block.setCreativeTab(CreativeTab.instance); + public static void register(Block block, Class itemBlock, boolean addTab, Enum[] list){ + if(addTab) block.setCreativeTab(CreativeTab.instance); block.setBlockName(createUnlocalizedName(block)); GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName()); - for(Enum current : list){ - if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal())); + if(list != null){ + for(Enum current : list){ + if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal())); + } + } + else{ + if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD)); } wailaRegisterList.add(block); } + public static void register(Block block, Class itemBlock, Enum[] list){ + register(block, itemBlock, true, list); + } + public static void register(Block block, Class itemBlock){ register(block, itemBlock, true); } public static void register(Block block, Class itemBlock, boolean addTab){ - if(addTab) block.setCreativeTab(CreativeTab.instance); - block.setBlockName(createUnlocalizedName(block)); - GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName()); - if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD)); - - wailaRegisterList.add(block); + register(block, itemBlock, addTab, null); } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/CompatUtil.java b/src/main/java/ellpeck/actuallyadditions/util/CompatUtil.java new file mode 100644 index 000000000..e62396a11 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/CompatUtil.java @@ -0,0 +1,27 @@ +package ellpeck.actuallyadditions.util; + +import cpw.mods.fml.common.event.FMLInterModComms; +import ellpeck.actuallyadditions.items.ItemSeed; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class CompatUtil{ + + public static void registerMFRPlant(Block block){ + FMLInterModComms.sendMessage("MineFactoryReloaded", "registerHarvestable_Crop", new ItemStack(block, 1, 7)); + + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("plant", Block.blockRegistry.getNameForObject(block)); + FMLInterModComms.sendMessage("MineFactoryReloaded", "registerFertilizable_Crop", compound); + } + + public static void registerMFRSeed(Item item){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("seed", Item.itemRegistry.getNameForObject(item)); + compound.setString("crop", Block.blockRegistry.getNameForObject(((ItemSeed)item).plant)); + FMLInterModComms.sendMessage("MineFactoryReloaded", "registerPlantable_Crop", compound); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java index b38dd0e51..df6eecfff 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -32,18 +32,24 @@ public class ItemUtil{ } public static void register(Item item, boolean addTab){ - if(addTab) item.setCreativeTab(CreativeTab.instance); - item.setUnlocalizedName(createUnlocalizedName(item)); - GameRegistry.registerItem(item, ((INameableItem)item).getName()); - if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), new ItemStack(item, 1, Util.WILDCARD)); + register(item, addTab, null); } public static void register(Item item, Enum[] list){ - item.setCreativeTab(CreativeTab.instance); + register(item, true, list); + } + + public static void register(Item item, boolean addTab, Enum[] list){ + if(addTab) item.setCreativeTab(CreativeTab.instance); item.setUnlocalizedName(createUnlocalizedName(item)); GameRegistry.registerItem(item, ((INameableItem)item).getName()); - for(Enum current : list){ - if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(item, 1, current.ordinal())); + if(list != null){ + for(Enum current : list){ + if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(item, 1, current.ordinal())); + } + } + else{ + if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), new ItemStack(item, 1, Util.WILDCARD)); } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 2bfa54782..b0cb19646 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger; public class ModUtil{ - public static final String VERSION = "1.7.10-0.0.6.0"; + public static final String VERSION = "1.7.10-0.0.6.1"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 97924e489..f374926bc 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.util; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -15,6 +16,8 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; import org.apache.logging.log4j.Level; +import java.util.ArrayList; + public class WorldUtil{ public static ChunkCoordinates getCoordsFromSide(ForgeDirection side, int x, int y, int z){ @@ -123,4 +126,14 @@ public class WorldUtil{ } } + public static ArrayList getMaterialsAround(World world, int x, int y, int z){ + ArrayList blocks = new ArrayList(); + blocks.add(world.getBlock(x+1, y, z).getMaterial()); + blocks.add(world.getBlock(x-1, y, z).getMaterial()); + blocks.add(world.getBlock(x, y, z+1).getMaterial()); + blocks.add(world.getBlock(x, y, z-1).getMaterial()); + + return blocks; + } + } diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java b/src/main/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java deleted file mode 100644 index 804d2999a..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java +++ /dev/null @@ -1,113 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - -/** - * @author PowerCrystals - * - * Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist. - * - */ -public class FactoryRegistry -{ - /* - * This may be called at any time during pre-init, init or post-init, assuming all blocks and items - * that are being accessed from the registry have been appropriately registered. - * Possible messages: - * - * // Registration: - * addLaserPreferredOre | NBTTag with an ItemStack saved on it, with the color on the "value" attribute, - * | A ValuedItem with item and value set. - * registerAutoSpawnerBlacklist | The String identifier of an entity, - * | A subclass of EntityLivingBase. - * registerFertilizable | An instance of IFactoryFertilizable. - * registerFertilizer | An instance of IFactoryFertilizer. - * registerFruitLog | The String identifier of a block. - * registerGrindable | An instance of IFactoryGrindable. - * registerGrinderBlacklist | A subclass of EntityLivingBase. - * registerHarvestable | An instance of IFactoryHarvestable. - * registerLaserOre | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, - * | A ValuedItem with item and value set. - * registerLiquidDrinkHandler | A ValuedItem with key and object set; ILiquidDrinkHandler expected. - * registerMobEggHandler | An instance of IMobEggHandler. - * registerPickableFruit | An instance of IFactoryFruit. - * registerPlantable | An instance of IFactoryPlantable. - * registerRanchable | An instance of IFactoryRanchable. - * registerRedNetLogicCircuit | An instance of IRedNetLogicCircuit. - * registerRubberTreeBiome | The biomeName field of a biome to white list for rubber trees to spawn in. - * registerSafariNetBlacklist | A subclass of EntityLivingBase. - * registerSafariNetHandler | An instance of ISafariNetHandler. - * registerSludgeDrop | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, - * | A ValuedItem with item and value set. - * registerSpawnHandler | An instance of IMobSpawnHandler. - * registerVillagerTradeMob | An instance of IRandomMobProvider. - * - * // Simple implementations: - * { Harvestables - * registerHarvestable_Standard | The String identifier of a block. - * registerHarvestable_Log | The String identifier of a block. - * registerHarvestable_Leaves | The String identifier of a block. - * registerHarvestable_Vine | The String identifier of a block. - * registerHarvestable_Shrub | The String identifier of a block. - * registerHarvestable_Mushroom | The String identifier of a block. - * registerHarvestable_Crop | An ItemStack of a block, with a damage value indicating the meta value to harvest at. - * | A ValuedItem with value and object set; Block expected. - * registerHarvestable_Gourd | An NBTTag with the stem and fruit attributes, both String identifiers of blocks. - * } - * { Plantables - * registerPlantable_Standard | An NBTTag with the seed (Item, String identifier), and - * crop (Block, String identifier) attributes set, optionally - * also having the meta (Integer, accepted metadata value of the seed item) attribute set. - * No special checks for location, just sustainability. - * registerPlantable_Crop | An NBTTag with the seed (Item, String identifier), and - * crop (Block, String identifier) attributes set, optionally - * also having the meta (Integer, accepted metadata value of the seed item) attribute set. - * Will automatically hoe dirt and grass into farmland when planting. - * registerPlantable_Sapling | An NBTTag with the sapling (Block, String identifier), and optionally - * the seed (Item, String identifier) attributes set. - * } - * { Fertilizer - * registerFertilizer_Standard | An NBTTag with the fert (Item, String identifier), meta (Integer), and - * type (Integer, index into FertilizerType.values()) attributes set. - * } - * { Fertilizables - * registerFertilizable_Grass | The String identifier of a block. Will bonemeal the block and expect - * tall grass be planted above and around it, must be IGrowable. Works with - * the GrowPlant and Grass type fertilizers, not recommended for crop plants. - * registerFertilizable_Gourd | The String identifier of a block. Must be IGrowable, and expects identical - * behavior to vanilla stems. Works with the GrowPlant fertilizers. - * registerFertilizable_Crop | An NBTTag with the plant (Block, String identifier, IGrowable), and - * meta (Integer, max growth phase) attributes set, optionally also having - * the type (Integer, index into FertilizerType) attribute set. - * registerFertilizable_Cocoa | An NBTTag with the plant (Block, String identifier), and optionally also - * the type (Integer, index into FertilizerType) attributes set. - * Expects metadata of the block to exactly match cocoa pods. - * registerFertilizable_Standard | An NBTTag with the plant (Block, String identifier, IGrowable), and - * optionally also the type (Integer, index into FertilizerType) attributes set. - * Expects the block to change when successfully grown (e.g., saplings). - * } - */ - public static void sendMessage(String message, Object value) - { - if (!Loader.isModLoaded("MineFactoryReloaded") || - Loader.instance().activeModContainer() == null) - return; - try - { - Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class); - m.setAccessible(true); - Constructor c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class); - c.setAccessible(true); - m.invoke(null, Loader.instance().activeModContainer(), "MineFactoryReloaded", c.newInstance(message, value)); - } - catch(Exception e) - { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/FertilizerType.java b/src/main/java/powercrystals/minefactoryreloaded/api/FertilizerType.java deleted file mode 100644 index 43af2b656..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/FertilizerType.java +++ /dev/null @@ -1,29 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -/** - * Determines what kind of action a given fertilizer can perform. Your - * IFactoryFertilizable instances should check this before performing any action - * to maintain future compatibility. - * - * @author PowerCrystals - */ -public enum FertilizerType { - - /** - * The fertilizer will fertilize nothing. - */ - None, - /** - * The fertilizer will fertilize grass. - */ - Grass, - /** - * The fertilizer will grow a plant. - */ - GrowPlant, - /** - * The fertilizer will grow magical crops. - */ - GrowMagicalCrop, - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/HarvestType.java b/src/main/java/powercrystals/minefactoryreloaded/api/HarvestType.java deleted file mode 100644 index 85ef23835..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/HarvestType.java +++ /dev/null @@ -1,56 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -/** - * Determines what algorithm the Harvester uses when it encounters this - * IFactoryHarvestable in the world. - * - * @author PowerCrystals - */ -public enum HarvestType { - - /** - * Just break the single block - no special action needed. e.g. Carrots, - * flowers, wheat. - */ - Normal, - /** - * Search for harvestable blocks adjacent to this block but leave this - * block. e.g. Pumpkin, melon - */ - Gourd, - /** - * Search for identical blocks above. - */ - Column, - /** - * Search for identical blocks above but leave the bottom one for the - * future. e.g. Cactus, sugarcane. - */ - LeaveBottom, - /** - * This block is the base of a tree and the harvester should enter - * tree-cutting mode. - */ - Tree, - /** - * This block is the base of the tree and the harvester should enter - * tree-cutting mode. - * The tree is searched for in the negative y axis instead. - */ - TreeFlipped, - /** - * This block is part of a tree as above, but leaves are cut before logs. - * The tree is searched for in the current mode. - *

- * If not in tree-cutting mode, tree-cutting mode will be entered as though - * the type was Tree. - */ - TreeLeaf, - /** - * This block is part of a tree as above, but fruits are cut before logs. - * e.g. cocoa - * The tree is not searched for. - */ - TreeFruit - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java b/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java deleted file mode 100644 index 2ec1f76b3..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java +++ /dev/null @@ -1,35 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; - -public interface IDeepStorageUnit { - - /** - * @return A populated ItemStack with stackSize for the full amount of - * materials in the DSU.
- * May have a stackSize > getMaxStackSize(). May have a stackSize of - * 0 (indicating locked contents). - */ - ItemStack getStoredItemType(); - - /** - * Sets the total amount of the item currently being stored, or zero if all - * items are to be removed. - */ - void setStoredItemCount(int amount); - - /** - * Sets the type of the stored item and initializes the number of stored - * items to amount. - *

- * Will overwrite any existing stored items. - */ - void setStoredItemType(ItemStack type, int amount); - - /** - * @return The maximum number of items the DSU can hold.
- * May change based on the current type stored. - */ - int getMaxStoredCount(); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizable.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizable.java deleted file mode 100644 index a4b8c8975..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizable.java +++ /dev/null @@ -1,58 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -import java.util.Random; - -/** - * Defines a fertilizable block, and the process to fertilize it. You can assume - * that you will never have to check that block matches the one returned by - * getPlant(). - * - * @author PowerCrystals - */ -public interface IFactoryFertilizable { - - /** - * @return The block this instance is managing. - */ - public Block getPlant(); - - /** - * @param world - * The world this block belongs to. - * @param x - * The X coordinate of this block. - * @param y - * The Y coordinate of this block. - * @param z - * The Z coordinate of this block. - * @param fertilizerType - * The kind of fertilizer being used. - * - * @return True if the block at (x,y,z) can be fertilized with the given - * type of fertilizer. - */ - public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType); - - /** - * @param world - * The world this block belongs to. - * @param rand - * A Random instance to use when fertilizing, if necessary. - * @param x - * The X coordinate of this block. - * @param y - * The Y coordinate of this block. - * @param z - * The Z coordinate of this block. - * @param fertilizerType - * The kind of fertilizer being used. - * - * @return True if fertilization was successful. If false, the Fertilizer - * will not consume a fertilizer item and will not drain power. - */ - public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizer.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizer.java deleted file mode 100644 index 2f201e68e..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFertilizer.java +++ /dev/null @@ -1,32 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Defines a fertilizer item for use in the Fertilizer. - * - * @author PowerCrystals - */ -public interface IFactoryFertilizer { - - /** - * @return The ID of this fertilizer item. - */ - Item getFertilizer(); - - /** - * @return The type of fertilizer this is. - */ - FertilizerType getFertilizerType(ItemStack stack); - - /** - * Called when a fertilization is successful. If you set the ItemStack size - * to 0, it will be deleted by the fertilizer. - * - * @param fertilizer - * The ItemStack used to fertilize. - */ - void consume(ItemStack fertilizer); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFruit.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFruit.java deleted file mode 100644 index 2251ee94c..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryFruit.java +++ /dev/null @@ -1,106 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.List; -import java.util.Random; - -/** - * Defines a fruit entry for the Fruit Picker. - * - * @author powercrystals - * - */ -public interface IFactoryFruit { - - /** - * @return The block this fruit has in the world. - */ - public Block getPlant(); - - /** - * Used to determine if this fruit can be picked (is it ripe yet, etc) - * - * @param world - * The world where the fruit is being picked - * @param x - * The x-coordinate of the fruit - * @param y - * The y-coordinate of the fruit - * @param z - * The z-coordinate of the fruit - * - * @return True if the fruit can be picked - */ - public boolean canBePicked(World world, int x, int y, int z); - - /** - * @deprecated This method is no longer called. ReplacementBlock now handles - * interaction. - */ - @Deprecated - public boolean breakBlock(); - - /** - * Called by the Fruit Picker to determine what block to replace the picked - * block with. At the time this method is called, the fruit still exists. - * - * @param world - * The world where the fruit is being picked - * @param x - * The x-coordinate of the fruit - * @param y - * The y-coordinate of the fruit - * @param z - * The z-coordinate of the fruit - * - * @return The block to replace the fruit block with, or null for air. - */ - public ReplacementBlock getReplacementBlock(World world, int x, int y, int z); - - /** - * Called by the Fruit Picker to determine what drops to generate. At the - * time this method is called, the fruit still exists. - * - * @param world - * The world where the fruit is being picked - * @param x - * The x-coordinate of the fruit - * @param y - * The y-coordinate of the fruit - * @param z - * The z-coordinate of the fruit - */ - public List getDrops(World world, Random rand, int x, int y, int z); - - /** - * Called by the Fruit Picker after getDrops, prior to the block being - * replaced/removed. - * - * @param world - * The world where the fruit is being picked - * @param x - * The x-coordinate of the fruit - * @param y - * The y-coordinate of the fruit - * @param z - * The z-coordinate of the fruit - */ - public void prePick(World world, int x, int y, int z); - - /** - * Called by the Fruit Picker after the fruit is picked. - * - * @param world - * The world where the fruit is being picked - * @param x - * The x-coordinate of the fruit - * @param y - * The y-coordinate of the fruit - * @param z - * The z-coordinate of the fruit - */ - public void postPick(World world, int x, int y, int z); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java deleted file mode 100644 index 0ef2149fe..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java +++ /dev/null @@ -1,44 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.world.World; - -import java.util.List; -import java.util.Random; - -/** - * Defines a grindable entity for the Grinder. - * - * @author PowerCrystals - */ -public interface IFactoryGrindable { - - /** - * @return The class that this grindable instance is handling. This must be - * a subtype of EntityLivingBase or the entity will never - * be noticed by the Grinder. - */ - public Class getGrindableEntity(); - - /** - * @param world - * The world this entity is in. - * @param entity - * The entity instance being ground. - * @param random - * A Random instance. - * - * @return The drops generated when this entity is killed. Only one of these - * will be chosen. - */ - public List grind(World world, EntityLivingBase entity, Random random); - - /** - * @param entity - * The entity instance being ground. - * - * @return Whether this entity has been fully processed or not. (e.g., it is - * already dead) - */ - public boolean processEntity(EntityLivingBase entity); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java deleted file mode 100644 index 2d691aa95..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java +++ /dev/null @@ -1,106 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.List; -import java.util.Map; -import java.util.Random; - -/** - * Defines a harvestable block for the Harvester. - * - * @author PowerCrystals - */ -public interface IFactoryHarvestable { - - /** - * @return The block this harvestable instance is managing. - */ - public Block getPlant(); - - /** - * @return The type of harvest the Harvester should perform on this block. - */ - public HarvestType getHarvestType(); - - /** - * Used to determine if the harvester should replace this block with air. - * - * @return Whether or not the Harvester should break the block when - * harvesting. If false, no changes will be performed by the - * Harvester itself. - */ - public boolean breakBlock(); - - /** - * Used to determine if this crop can be harvested (is it at a stage that - * drops crops, etc.) - * - * @param world - * The world this block is in. - * @param harvesterSettings - * The harvester's current settings. Do not modify these. - * @param x - * The X coordinate of the block being harvested. - * @param y - * The Y coordinate of the block being harvested. - * @param z - * The Z coordinate of the block being harvested. - * - * @return True if this block can be harvested. - */ - public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z); - - /** - * @param world - * The world this block is in. - * @param rand - * A Random instance to use when generating drops. - * @param harvesterSettings - * The harvester's current settings. Do not modify these. - * @param x - * The X coordinate of the block being harvested. - * @param y - * The Y coordinate of the block being harvested. - * @param z - * The Z coordinate of the block being harvested. - * - * @return The drops generated by breaking this block. For a default - * implementation, calling Block.getDrops() is usually - * sufficient. - */ - public List getDrops(World world, Random rand, Map harvesterSettings, int x, int y, int z); - - /** - * Called before the block is going to be harvested, after getDrops. Usually - * empty. - * - * @param world - * The world this block is in. - * @param x - * The X coordinate of the block being harvested. - * @param y - * The Y coordinate of the block being harvested. - * @param z - * The Z coordinate of the block being harvested. - */ - public void preHarvest(World world, int x, int y, int z); - - /** - * Called after the block is going to be harvested. Used to re-till soil, - * for example. - * - * @param world - * The world this block is in. - * @param x - * The X coordinate of the block being harvested. - * @param y - * The Y coordinate of the block being harvested. - * @param z - * The Z coordinate of the block being harvested. - */ - public void postHarvest(World world, int x, int y, int z); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserSource.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserSource.java deleted file mode 100644 index 4eab9eb66..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserSource.java +++ /dev/null @@ -1,24 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Defines a target for the laser blocks. TileEntities that implement this - * interface will sustain the beam. - * - * @author skyboy - */ -public interface IFactoryLaserSource { - - /** - * Used to determine if laser blocks can remain in the world when emitted - * from from - * - * @param from - * The direction the laser is oriented - * - * @return True if the beam should be sustained from this side - */ - public boolean canFormBeamFrom(ForgeDirection from); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserTarget.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserTarget.java deleted file mode 100644 index 7fcc41137..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryLaserTarget.java +++ /dev/null @@ -1,36 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Defines a target for the Laser Drill Precharger - * - * @author skyboy - */ -public interface IFactoryLaserTarget { - - /** - * Used to be determined if a laser can be formed on from - * - * @param from - * The direction the laser is coming from - * - * @return True if the precharger can form a beam from this side - */ - public boolean canFormBeamWith(ForgeDirection from); - - /** - * Used to add energy to the tile. - * - * @param from - * The direction the energy is coming from - * @param energy - * The amount of energy being transferred - * @param simulate - * true if this transaction will only be simulated - * - * @return The amount of energy not consumed - */ - public int addEnergy(ForgeDirection from, int energy, boolean simulate); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryPlantable.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryPlantable.java deleted file mode 100644 index 1d620b37e..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryPlantable.java +++ /dev/null @@ -1,94 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Defines a plantable object for use in the Planter. - * - * @author PowerCrystals - */ -public interface IFactoryPlantable { - - /** - * @return The item this plantable is managing. - */ - public Item getSeed(); - - /** - * @param stack - * The stack being planted. - * @param forFermenting - * True if this stack will be converted to biofuel - * - * @return True if this plantable can be planted (useful for metadata - * items). - */ - public boolean canBePlanted(ItemStack stack, boolean forFermenting); - - /** - * @param world - * The world instance this block or item will be placed into. - * @param x - * The destination X coordinate. - * @param y - * The destination Y coordinate. - * @param z - * The destination Z coordinate. - * @param stack - * The stack being planted. - * - * @return The block that will be placed into the world. - */ - public ReplacementBlock getPlantedBlock(World world, int x, int y, int z, ItemStack stack); - - /** - * @param world - * The world instance this block or item will be placed into. - * @param x - * The destination X coordinate. - * @param y - * The destination Y coordinate. - * @param z - * The destination Z coordinate. - * @param stack - * The stack being planted. - * - * @return True if this plantable can be placed at the provided coordinates. - */ - public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack); - - /** - * Called before planting is performed. Used to till soil, for example. - * - * @param world - * The world instance this block or item will be placed into. - * @param x - * The destination X coordinate. - * @param y - * The destination Y coordinate. - * @param z - * The destination Z coordinate. - * @param stack - * The stack being planted. - */ - public void prePlant(World world, int x, int y, int z, ItemStack stack); - - /** - * Called after planting is performed. Usually empty. - * - * @param world - * The world instance this block or item will be placed into. - * @param x - * The destination X coordinate. - * @param y - * The destination Y coordinate. - * @param z - * The destination Z coordinate. - * @param stack - * The stack being planted. - */ - public void postPlant(World world, int x, int y, int z, ItemStack stack); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryRanchable.java b/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryRanchable.java deleted file mode 100644 index 21fc61abc..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IFactoryRanchable.java +++ /dev/null @@ -1,34 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.inventory.IInventory; -import net.minecraft.world.World; - -import java.util.List; - -/** - * Defines a ranchable entity for use in the Rancher. - * - * @author PowerCrystals - */ -public interface IFactoryRanchable { - - /** - * @return The entity being ranched. Must be a subtype of EntityLivingBase. - */ - public Class getRanchableEntity(); - - /** - * @param world - * The world this entity is in. - * @param entity - * The entity instance being ranched. - * @param rancher - * The rancher instance doing the ranching. Used to access the - * Rancher's inventory when milking cows, for example. - * - * @return A list of drops. All Items be dropped, fluids not matching the tank's contents will be discarded. - */ - public List ranch(World world, EntityLivingBase entity, IInventory rancher); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java b/src/main/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java deleted file mode 100644 index d8d58866a..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityLivingBase; - -public interface ILiquidDrinkHandler { - - /** - * Called when an entity has consumed the fluid this manages. - * - * @param entity - * The entity that has consumed the fluid this - * ILiquidDrinkHandler manages - */ - public void onDrink(EntityLivingBase entity); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IMFRHammer.java b/src/main/java/powercrystals/minefactoryreloaded/api/IMFRHammer.java deleted file mode 100644 index 4f951dae0..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IMFRHammer.java +++ /dev/null @@ -1,11 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -/** - * Defines a tool that can rotate MFR machines. Implement on an Item class. - * Requires no additional work on your part. - * - * @author PowerCrystals - */ -public interface IMFRHammer { - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IMobEggHandler.java b/src/main/java/powercrystals/minefactoryreloaded/api/IMobEggHandler.java deleted file mode 100644 index 4801feb9f..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IMobEggHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityList.EntityEggInfo; -import net.minecraft.item.ItemStack; - -/** - * Defines a class that MFR will use to local egg info for a given mob. This is - * used to color the Safari Net based on the captured mob. - * - * @author PowerCrystals - */ -public interface IMobEggHandler { - - /** - * @param safariNet - * The Safari Net that is looking for egg info. - * - * @return An EntityEggInfo, or null if this instance cannot handle this - * mob. - */ - public EntityEggInfo getEgg(ItemStack safariNet); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IMobSpawnHandler.java b/src/main/java/powercrystals/minefactoryreloaded/api/IMobSpawnHandler.java deleted file mode 100644 index 65d2b3031..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IMobSpawnHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityLivingBase; - -/** - * Defines a handler for mob spawns from the autospawner. Added primarily to - * solve item duping on exact spawn & entity inventories - * - * @author skyboy - */ -public interface IMobSpawnHandler { - - /** - * @return The class that this instance is handling. - */ - public Class getMobClass(); - - /** - * Called when a mob has been spawned normally. - * - * @param entity - * The entity instance being spawned. Typically your regular - * spawn code 100% handles this - */ - public void onMobSpawn(EntityLivingBase entity); - - /** - * Called when an exact copy of an entity has been made. - * - * @param entity - * The entity instance being exact-copied. Clear your inventories - * & etc. here - */ - public void onMobExactSpawn(EntityLivingBase entity); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/INeedleAmmo.java b/src/main/java/powercrystals/minefactoryreloaded/api/INeedleAmmo.java deleted file mode 100644 index 38e648205..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/INeedleAmmo.java +++ /dev/null @@ -1,16 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface INeedleAmmo { - - public boolean onHitEntity(ItemStack stac, EntityPlayer owner, Entity hit, double distance); - - public void onHitBlock(ItemStack stac, EntityPlayer owner, World world, int x, int y, int z, int side, double distance); - - public float getSpread(ItemStack stack); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IRandomMobProvider.java b/src/main/java/powercrystals/minefactoryreloaded/api/IRandomMobProvider.java deleted file mode 100644 index e72db202c..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IRandomMobProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.world.World; - -import java.util.List; - -public interface IRandomMobProvider { - - /** - * Called to provide random entities to be spawned by mystery SafariNets - * - * @param world - * The world object the entities will be spawned in. - * @return A list of RandomMob instances of entities that are all ready to - * be spawned in the world with no additional method calls. - */ - public List getRandomMobs(World world); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/ISafariNetHandler.java b/src/main/java/powercrystals/minefactoryreloaded/api/ISafariNetHandler.java deleted file mode 100644 index cb9a0d7ff..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/ISafariNetHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import java.util.List; - -/** - * Defines an object that can display information about a captured mob in a - * Safari net. - * - * @author PowerCrystals - */ -public interface ISafariNetHandler { - - /** - * @return The class of mob that this handler applies to. - */ - public Class validFor(); - - /** - * Called to add information regarding a mob contained in a SafariNet. - * - * @param safariNetStack - * The Safari Net that is requesting information. - * @param player - * The player holding the Safari Net. - * @param infoList - * The current list of information strings. Add yours to this. - * @param advancedTooltips - * True if the advanced tooltips option is on. - */ - public void addInformation(ItemStack safariNetStack, EntityPlayer player, List infoList, boolean advancedTooltips); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/ISyringe.java b/src/main/java/powercrystals/minefactoryreloaded/api/ISyringe.java deleted file mode 100644 index b3cbfba9d..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/ISyringe.java +++ /dev/null @@ -1,64 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Defines a syringe for use in the Vet machine. - * - * @author PowerCrystals - */ -public interface ISyringe { - - /** - * Called when the vet is deciding if it should use this syringe. - * - * @param world - * The world instance. - * @param entity - * The entity being injected. - * @param syringe - * The syringe ItemStack. - * - * @return True if the entity can be injected by this syringe. - */ - public boolean canInject(World world, EntityLivingBase entity, ItemStack syringe); - - /** - * Called to perform an injection. - * - * @param world - * The world instance. - * @param entity - * The entity being injected. - * @param syringe - * The syringe ItemStack. - * - * @return True if injection was successful. - */ - public boolean inject(World world, EntityLivingBase entity, ItemStack syringe); - - /** - * Called to check if a syringe is empty - * - * @param syringe - * The syringe ItemStack. - * - * @return True if the syringe is empty - */ - public boolean isEmpty(ItemStack syringe); - - /** - * Called to get the empty syringe - *

- * Note: this will replace the syringe, max stacksize should be 1 - * - * @param syringe - * The syringe ItemStack. - * - * @return An empty syringe ItemStack - */ - public ItemStack getEmptySyringe(ItemStack syringe); - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/MobDrop.java b/src/main/java/powercrystals/minefactoryreloaded/api/MobDrop.java deleted file mode 100644 index 7f5dd7cc9..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/MobDrop.java +++ /dev/null @@ -1,21 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandom; - -public class MobDrop extends WeightedRandom.Item -{ - private ItemStack _stack; - - public MobDrop(int weight, ItemStack stack) - { - super(weight); - _stack = stack; - } - - public ItemStack getStack() - { - if(_stack == null) return null; - return _stack.copy(); - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/RanchedItem.java b/src/main/java/powercrystals/minefactoryreloaded/api/RanchedItem.java deleted file mode 100644 index 86791cc54..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/RanchedItem.java +++ /dev/null @@ -1,68 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * @author skyboy026 - * - * Defines an ItemStack or a FluidStack that is the result of an entity being ranched - */ -public final class RanchedItem { - private final ItemStack item; - private final FluidStack fluid; - - public RanchedItem(Block item, int amount, int meta) - { - this(new ItemStack(item, amount, meta)); - } - - public RanchedItem(Block item, int amount) - { - this(new ItemStack(item, amount)); - } - - public RanchedItem(Block item) - { - this(new ItemStack(item)); - } - - public RanchedItem(Item item, int amount, int meta) - { - this(new ItemStack(item, amount, meta)); - } - - public RanchedItem(Item item, int amount) - { - this(new ItemStack(item, amount)); - } - - public RanchedItem(Item item) - { - this(new ItemStack(item)); - } - - public RanchedItem(ItemStack item) - { - this.item = item; - fluid = null; - } - - public RanchedItem(FluidStack fluid) - { - this.fluid = fluid; - item = null; - } - - public boolean hasFluid() - { - return item == null & fluid != null; - } - - public Object getResult() - { - return item == null ? fluid : item; - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/RandomMob.java b/src/main/java/powercrystals/minefactoryreloaded/api/RandomMob.java deleted file mode 100644 index 2ffa56b1a..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/RandomMob.java +++ /dev/null @@ -1,28 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.entity.Entity; -import net.minecraft.util.WeightedRandom; - -public class RandomMob extends WeightedRandom.Item -{ - private Entity _mob; - public final boolean shouldInit; - - public RandomMob(Entity savedMob, int weight, boolean init) - { - super(weight); - _mob = savedMob; - shouldInit = init; - } - - public RandomMob(Entity savedMob, int weight) - { - this(savedMob, weight, true); - } - - public Entity getMob() - { - if(_mob == null) return null; - return _mob; - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java b/src/main/java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java deleted file mode 100644 index 88cd7a86f..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java +++ /dev/null @@ -1,137 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class ReplacementBlock -{ - protected byte _hasMeta; - protected int _meta; - protected final Block _block; - protected final NBTTagCompound _tileTag; - - /** - * Called to replace a block in the world. - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return True if the block was set successfully - */ - public boolean replaceBlock(World world, int x, int y, int z, ItemStack stack) - { - int meta = getMeta(world, x, y, z, stack); - if (world.setBlock(x, y, z, _block, meta, 3)) - { - if (hasTag(stack) && _block.hasTileEntity(meta)) - { - TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null) - tile.readFromNBT(getTag(world, x, y, z, stack)); - } - return true; - } - return false; - } - - /** - * Called to get the metadata of the replacement block in the world. - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return The metadata of the block - */ - protected int getMeta(World world, int x, int y, int z, ItemStack stack) - { - int m = 0; - if (_hasMeta > 0) - { - if (_hasMeta > 1) - return _meta; - m = stack.getItemDamage(); - Item item = stack.getItem(); - if (item instanceof ItemBlock) - m = ((ItemBlock)item).getMetadata(m); - } - return m; - } - - /** - * Called to set the metdata of this ReplacementBlock to a fixed value - * @param meta The metadata of the block - * @return This instance - */ - public ReplacementBlock setMeta(int meta) - { - if (meta >= 0) - { - _hasMeta = 2; - _meta = meta; - } - return this; - } - - /** - * Called to set the metdata of this ReplacementBlock to a value read from an ItemStack - * @param meta The metadata of the block - * @return This instance - */ - public ReplacementBlock setMeta(boolean hasMeta) - { - _hasMeta = (byte) (hasMeta ? 1 : 0); - return this; - } - - /** - * Called to get the NBTTagCompound a TileEntity will read its state from - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return The NBTTagCompound a TileEntity will read its state from - */ - protected NBTTagCompound getTag(World world, int x, int y, int z, ItemStack stack) - { - return _tileTag; - } - - /** - * Called to see if a TileEntity should have its state set - * @param stack The ItemStack being used to replace the block (may be null) - * @return True if the TileEntity should have its state set - */ - protected boolean hasTag(ItemStack stack) - { - return _tileTag != null; - } - - public ReplacementBlock(Item block) - { - this(Block.getBlockFromItem(block)); - } - - public ReplacementBlock(Item block, NBTTagCompound tag) - { - this(Block.getBlockFromItem(block), tag); - } - - public ReplacementBlock(Block block) - { - this(block, null); - } - - public ReplacementBlock(Block block, NBTTagCompound tag) - { - _block = block; - _tileTag = tag; - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/ValuedItem.java b/src/main/java/powercrystals/minefactoryreloaded/api/ValuedItem.java deleted file mode 100644 index 3d075fa3b..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/ValuedItem.java +++ /dev/null @@ -1,72 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; - -public class ValuedItem -{ - public final int value; - public final ItemStack item; - public final String key; - public final Object object; - - public ValuedItem(int v, ItemStack i) - { - value = v; - item = i; - key = null; - object = null; - } - - public ValuedItem(String v, Object i) - { - value = -1; - item = null; - key = v; - object = i; - } - - /** - * Presently unused but included so that if they do get used in the future, - * people including this in their jar and loading before MFR don't destroy everyone - */ - - public ValuedItem(int v, Object i) - { - value = v; - item = null; - key = null; - object = i; - } - - public ValuedItem(String v, ItemStack i) - { - value = -1; - item = i; - key = v; - object = null; - } - - public ValuedItem(int v, String k, ItemStack i) - { - value = v; - item = i; - key = k; - object = null; - } - - public ValuedItem(int v, String k, Object i) - { - value = v; - item = null; - key = k; - object = i; - } - - public ValuedItem(int v, String k, ItemStack i, Object o) - { - value = v; - item = i; - key = k; - object = o; - } -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInfo.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInfo.java deleted file mode 100644 index b6b8a23df..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.List; - -/** - * Defines a Block that can print information about itself using the RedNet Meter. This must be implemented on your Block class. - */ -public interface IRedNetInfo -{ - /** - * This function appends information to a list provided to it. - * - * @param world Reference to the world. - * @param x X coordinate of the block. - * @param y Y coordinate of the block. - * @param z Z coordinate of the block. - * @param side The side of the block that is being queried. - * @param player Player doing the querying - this can be NULL. - * @param info The list that the information should be appended to. - */ - public void getRedNetInfo(IBlockAccess world, int x, int y, int z, - ForgeDirection side, EntityPlayer player, List info); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInputNode.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInputNode.java deleted file mode 100644 index a0f8b7094..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetInputNode.java +++ /dev/null @@ -1,51 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection; - -/** - * Defines a Block that can connect to RedNet cables. This must be implemented on your Block class. - *

- * Note that when you implement this, the RedNet network makes several assumptions about your code - - * It will not clamp values to 0 <= x <= 15. This means you must be able to accept any possible integer - * without crashing, even negatives. It will also assume that calling the onInput(s)Changed() methods - * are sufficient, and will not issue block updates. In Single mode, it will call onInputChanged. - *

- * RedNet cables have their subnets indicated to the user by colored bands on the cable. - * The color of a given subnet is the same as the wool with metadata equal to the subnet number. - *

- * For reference:
- * 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray, - * 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black - */ -public interface IRedNetInputNode extends IRedNetConnection -{ - /** - * Called when the input values to this block change. Only called if your block is connected in "All" mode. - * Do not issue a network value update from inside this method call; it will be ignored. Issue your updates - * on the next tick. - * - * @param world The world this block is in. - * @param x This block's X coordinate. - * @param y This block's Y coordinate. - * @param z This block's Z coordinate. - * @param side The side the input values are being changed on. - * @param inputValues The new set of input values. This array will be 16 elements long. Do not alter or cache. - */ - public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues); - - /** - * Called when the input value to this block changes. Only called if your block is connected in "Single" mode. - * Do not issue a network value update from inside this method call; it will be ignored. Issue your updates - * on the next tick. - * - * @param world The world this block is in. - * @param x This block's X coordinate. - * @param y This block's Y coordinate. - * @param z This block's Z coordinate. - * @param side The side the input values are being changed on. - * @param inputValue The new input value - */ - public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicCircuit.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicCircuit.java deleted file mode 100644 index 981ce06b6..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicCircuit.java +++ /dev/null @@ -1,19 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -import net.minecraft.nbt.NBTTagCompound; - -public interface IRedNetLogicCircuit -{ - public byte getInputCount(); - - public byte getOutputCount(); - - public int[] recalculateOutputValues(long worldTime, int[] inputValues); - - public String getUnlocalizedName(); - public String getInputPinLabel(int pin); - public String getOutputPinLabel(int pin); - - public void readFromNBT(NBTTagCompound tag); - public void writeToNBT(NBTTagCompound tag); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicPoint.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicPoint.java deleted file mode 100644 index dd05969e9..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetLogicPoint.java +++ /dev/null @@ -1,36 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -/** - * - * @author skyboy - */ -public interface IRedNetLogicPoint -{ - /** - * - * @param out - * @return - */ - public void transformOutput(int[] out); - - /** - * - * @param out - * @return - */ - public void transformOutput(int out); - - /** - * - * @param in - * @return - */ - public int[] transformInput(int[] in); - - /** - * - * @param in - * @return - */ - public int transformInput(int in); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetNetworkContainer.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetNetworkContainer.java deleted file mode 100644 index c9fb0bf81..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetNetworkContainer.java +++ /dev/null @@ -1,32 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * - * You should not implement this yourself. Instead, use this to look for cables to notify from your IRedNetOmniNode as this does not - * require a block update. This will be implemented on the cable's Block class. - * - */ -public interface IRedNetNetworkContainer -{ - /** - * Tells the network to recalculate all subnets. - * @param world The world this cable is in. - * @param x The x-coordinate of this cable. - * @param x The y-coordinate of this cable. - * @param x The z-coordinate of this cable. - */ - public void updateNetwork(World world, int x, int y, int z, ForgeDirection from); - - /** - * Tells the network to recalculate a specific subnet. - * @param world The world this cable is in. - * @param x The x-coordinate of this cable. - * @param x The y-coordinate of this cable. - * @param x The z-coordinate of this cable. - * @param subnet The subnet to recalculate. - */ - public void updateNetwork(World world, int x, int y, int z, int subnet, ForgeDirection from); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOmniNode.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOmniNode.java deleted file mode 100644 index f2bdf397c..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOmniNode.java +++ /dev/null @@ -1,22 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -/** - * Defines a Block that can connect to RedNet cables. This must be implemented on your Block class. - *

- * Note that when you implement this, the RedNet network makes several assumptions about your code - - * It will not clamp values to 0 <= x <= 15. This means you must be able to accept any possible integer - * without crashing, even negatives. It will also assume that calling the onInput(s)Changed() methods - * are sufficient, and will not issue block updates. It will never call the vanilla redstone output - * methods, and will only query the methods contained in this interface. - *

- * RedNet cables have their subnets indicated to the user by colored bands on the cable. - * The color of a given subnet is the same as the wool with metadata equal to the subnet number. - *

- * For reference:
- * 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray, - * 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black - */ -public interface IRedNetOmniNode extends IRedNetInputNode, IRedNetOutputNode -{ - // this is merely provided for convenience -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOutputNode.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOutputNode.java deleted file mode 100644 index 8a0b41568..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/IRedNetOutputNode.java +++ /dev/null @@ -1,50 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet; - -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection; - -/** - * Defines a Block that can connect to RedNet cables. This must be implemented on your Block class. - *

- * Note that when you implement this, the RedNet network makes several assumptions about your code - - * It will never call the vanilla redstone output methods, querying only the methods contained in - * this interface, and will not issue block updates. - *

- * RedNet cables have their subnets indicated to the user by colored bands on the cable. - * The color of a given subnet is the same as the wool with metadata equal to the subnet number. - *

- * For reference:
- * 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray, - * 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black - */ -public interface IRedNetOutputNode extends IRedNetConnection -{ - /** - * Returns the output values of this RedNet node. - * This array must be 16 elements long. - * Only called if your block is connected in "All" mode. - * - * @param world The world this block is in. - * @param x This block's X coordinate. - * @param y This block's Y coordinate. - * @param z This block's Z coordinate. - * @param side The side the output values are required for. - * @return The output values. - */ - public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side); - - /** - * Returns the output value of this RedNet node for a given subnet. - * Must be the same as getOutputValues(world, x, y, z, side)[subnet]. - * - * @param world The world this block is in. - * @param x This block's X coordinate. - * @param y This block's Y coordinate. - * @param z This block's Z coordinate. - * @param side The side the output value is required for. - * @param subnet The subnet to get the output value for (0-15). - * @return The output value. - */ - public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetConnection.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetConnection.java deleted file mode 100644 index 003800d8f..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetConnection.java +++ /dev/null @@ -1,26 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet.connectivity; - -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Defines a Block that can connect to RedNet cables. This must be implemented on your Block class. - */ -public interface IRedNetConnection -{ - /** - * Returns the connection type of this Block. If this value must be changed - * while the block is alive, it must notify neighbors of a change. - *

- * For nodes that want to interact with rednet, - * see IRedNetInputNode, IRedNetOutputNode, and IRedNetOmniNode - * - * @param world The world this block is in. - * @param x This block's X coordinate. - * @param y This block's Y coordinate. - * @param z This block's Z coordinate. - * @param side The side that connection information is required for. - * @return The connection type. - */ - public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side); -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetDecorative.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetDecorative.java deleted file mode 100644 index 89de12b13..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetDecorative.java +++ /dev/null @@ -1,11 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet.connectivity; - -/** - * This must be implemented on your Block class. - *

- * RedNet cables will treat your block similar to a vanilla block that's not redstone active. - */ -public interface IRedNetDecorative -{ - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetNoConnection.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetNoConnection.java deleted file mode 100644 index 16225a74f..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedNetNoConnection.java +++ /dev/null @@ -1,13 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet.connectivity; - -/** - * This must be implemented on your Block class. - *

- * RedNet cables will not connect to your block. - *
- * This behavior can be overridden in subclasses by IRedNetConnection - */ -public interface IRedNetNoConnection -{ - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedstoneAlike.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedstoneAlike.java deleted file mode 100644 index f3784cfbf..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/IRedstoneAlike.java +++ /dev/null @@ -1,10 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet.connectivity; - -/** - * This must be implemented on your Block class. - *

- * RedNet cables will treat your block similar to a redstone dust, and subtract one from the power value. - */ -public interface IRedstoneAlike { - -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/RedNetConnectionType.java b/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/RedNetConnectionType.java deleted file mode 100644 index 08ba24c1e..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/rednet/connectivity/RedNetConnectionType.java +++ /dev/null @@ -1,86 +0,0 @@ -package powercrystals.minefactoryreloaded.api.rednet.connectivity; - -import java.util.HashMap; -import java.util.Map; - -/** - * Defines how RedNet cable connects to a block - *

- * None: RedNet will never connect to this block (if this is all you want: use IRedNetNoConnection) - *

- * CableSingle: Connections will use the cable renderer with a single band, best used for whole blocks - *
- * PlateSingle: Connections will use the plate renderer with a single band, used for conveyers and rails - *

- * CableAll: Connections permit access to all 16 bands - *
- * PlateAll: Connections permit access to all 16 bands - *

- * Forced connection modes are best used for decoration blocks: RedNet will not connect normally, - * but will if the user forces it. Typically, IRedNetDecorative is desired for this instead - *

- * ForcedCableSingle: Connections permit access to a single band, only when the cable is in forced connection mode - *
- * ForcedPlateSingle: Connections permit access to a single band, only when the cable is in forced connection mode - *

- * ForcedCableAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode - *
- * ForcedPlateAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode - *

- * The decorative nodes are for when you want rednet to decide how to connect to your block, - * but also need to receive full updates from the network. - *

- * DecorativeSingle: Connections permit access to a single band, using standard connection logic - *
- * DecorativeAll: Connections permit access to all 16 bands, using standard connection logic - *
- * ForcedDecorativeSingle: Connections permit access to a single band, only when the cable is in forced connection mode - *
- * ForcedDecorativeAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode - */ -public enum RedNetConnectionType -{ - None, // 0; 0000000 - CableSingle, // 11; 0001011 - PlateSingle, // 13; 0001101 - CableAll, // 19; 0010011 - PlateAll, // 21; 0010101 - ForcedCableSingle, // 43; 0101011 - ForcedPlateSingle, // 45; 0101101 - ForcedCableAll, // 51; 0110011 - ForcedPlateAll, // 53; 0110101 - DecorativeSingle, // NA; 0001001 - DecorativeAll, // NA; 0010001 - ForcedDecorativeSingle, // NA; 0101001 - ForcedDecorativeAll; // NA; 0110001 - - public final boolean isConnected = this.ordinal() != 0; // 0 bit (mask: 1) - public final boolean isSingleSubnet = this.name().endsWith("Single"); // 3 bit (mask: 8) - public final boolean isAllSubnets = this.name().endsWith("All"); // 4 bit (mask: 16) - public final boolean isPlate = this.name().contains("Plate"); // 2 bit (mask: 4) - public final boolean isCable = this.name().contains("Cable"); // 1 bit (mask: 2) - public final boolean isConnectionForced = this.name().startsWith("Forced"); // 5 bit (mask: 32) - public final boolean isDecorative = this.name().contains("Decorative"); - public final short flags = toFlags(isConnected, isCable, isPlate, - isSingleSubnet, isAllSubnets, isConnectionForced); - - public static final RedNetConnectionType fromFlags(short flags) - { - return connections.get(flags); - } - - private static final short toFlags(boolean ...flags) - { - short ret = 0; - for (int i = flags.length; i --> 0;) - ret |= (flags[i] ? 1 : 0) << i; - return ret; - } - - private static final Map connections = new HashMap(); - - static { - for (RedNetConnectionType type : RedNetConnectionType.values()) - connections.put(type.flags, type); - } -} diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 45416c690..e2594c3db 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -44,7 +44,7 @@ tooltip.actuallyadditions.itemMiscRiceDough.desc=It's Dough, but made from Rice item.actuallyadditions.itemFoodRiceBread.name=Rice Bread tooltip.actuallyadditions.itemFoodRiceBread.desc=It's like Bread, but ricey! item.actuallyadditions.itemRiceSeed.name=Rice Seeds -tooltip.actuallyadditions.itemRiceSeed.desc=Grows on Water! +tooltip.actuallyadditions.itemRiceSeed.desc=Grows on Farmland! Makes delicious Rice! item.actuallyadditions.itemMiscTinyCoal.name=Tiny Coal tooltip.actuallyadditions.itemMiscTinyCoal.desc=Crafted from Coal, smelts one Item @@ -127,7 +127,7 @@ tooltip.actuallyadditions.itemCoffee.desc.1=Brewed in a Coffee Machine! See Effe tooltip.actuallyadditions.itemCoffee.desc.2=You can drink me %s times! item.actuallyadditions.itemCoffeeSeed.name=Coffee Seeds -tooltip.actuallyadditions.itemCoffeeSeed.desc=Grows Coffee on Grass Blocks +tooltip.actuallyadditions.itemCoffeeSeed.desc=Grows Coffee on Farmland tile.actuallyadditions.blockCoffee.name=Coffee Plant tooltip.actuallyadditions.blockCoffee.desc=Grows Coffee! Noms! @@ -135,12 +135,21 @@ tooltip.actuallyadditions.blockCoffee.desc=Grows Coffee! Noms! item.actuallyadditions.itemCoffeeBeans.name=Coffee Beans tooltip.actuallyadditions.itemCoffeeBeans.desc=Used in a Coffee Machine... delicious! +tile.actuallyadditions.blockWildCanola.name=Wild Canola +tile.actuallyadditions.blockWildRice.name=Wild Rice +tile.actuallyadditions.blockWildCoffee.name=Wild Coffee +tile.actuallyadditions.blockWildFlax.name=Wild Flax +tooltip.actuallyadditions.blockWildCanola.desc=Grows in the Wild... Gets you Canola Seeds! +tooltip.actuallyadditions.blockWildRice.desc=Grows in the Wild... Gets you Rice Seeds! +tooltip.actuallyadditions.blockWildCoffee.desc=Grows in the Wild... Gets you Coffee Seeds! +tooltip.actuallyadditions.blockWildFlax.desc=Grows in the Wild... Gets you Flax Seeds! + item.actuallyadditions.itemCanolaSeed.name=Canola Seeds -tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Grass! +tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Farmland! Makes Canola! item.actuallyadditions.itemMiscCanola.name=Canola tooltip.actuallyadditions.itemMiscCanola.desc=Used to make Oil in a Canola Press tile.actuallyadditions.blockCanola.name=Canola Plant -tooltip.actuallyadditions.blockCanola.desc=It's growing... kind of.. +tooltip.actuallyadditions.blockCanola.desc=It's growing... making Canola.. slowly! item.actuallyadditions.itemResonantRice.name=Resonant Rice tooltip.actuallyadditions.itemResonantRice.desc=Don't know what it does... maybe if you right-click it? @@ -182,17 +191,17 @@ tile.actuallyadditions.blockInputter.add.11.name=Extra-Long Solidifying Dissocia tile.actuallyadditions.blockInputter.add.12.name=Energetic Solo Dancer tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger -tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO +tile.actuallyadditions.blockInputter.add.15.name=Ending Serious Daughter -item.actuallyadditions.itemDrillUpgradeSpeed.name=Drill Speed I Augment -item.actuallyadditions.itemDrillUpgradeSpeedII.name=Drill Speed II Augment -item.actuallyadditions.itemDrillUpgradeSpeedIII.name=Drill Speed III Augment +item.actuallyadditions.itemDrillUpgradeSpeed.name=Drill Speed Augment I +item.actuallyadditions.itemDrillUpgradeSpeedII.name=Drill Speed Augment II +item.actuallyadditions.itemDrillUpgradeSpeedIII.name=Drill Speed Augment III item.actuallyadditions.itemDrillUpgradeSilkTouch.name=Drill Silk Touch Augment -item.actuallyadditions.itemDrillUpgradeFortune.name=Drill Fortune I Augment -item.actuallyadditions.itemDrillUpgradeFortuneII.name=Drill Fortune II Augment +item.actuallyadditions.itemDrillUpgradeFortune.name=Drill Fortune Augment I +item.actuallyadditions.itemDrillUpgradeFortuneII.name=Drill Fortune Augment II (That gives you Fortune III as it says in the tooltip...) item.actuallyadditions.itemDrillUpgradeBlockPlacing.name=Drill Block Placing Augment -item.actuallyadditions.itemDrillUpgradeThreeByThree.name=Drill Three By Three Mining Augment -item.actuallyadditions.itemDrillUpgradeFiveByFive.name=Drill Five By Five Mining Augment +item.actuallyadditions.itemDrillUpgradeThreeByThree.name=Drill Mining Augment I +item.actuallyadditions.itemDrillUpgradeFiveByFive.name=Drill Mining Augment II tooltip.actuallyadditions.itemDrillUpgradeSpeed.desc=Makes the Drill faster! tooltip.actuallyadditions.itemDrillUpgradeSpeedII.desc=Makes the Drill even faster! Requires Tier 1. @@ -350,8 +359,9 @@ tooltip.actuallyadditions.blockInputter.desc.2=Acts like a more advanced Hopper tooltip.actuallyadditions.blockInputter.desc.3=Turn me off with Redstone! tooltip.actuallyadditions.blockInputter.desc.4=Configurable: tooltip.actuallyadditions.blockInputter.desc.5=-Side to Output to and Input from -tooltip.actuallyadditions.blockInputter.desc.6=-Slot in the other Inventory to Output to and Input from -tooltip.actuallyadditions.blockInputterAdvanced.desc=Has an Input and Output Filter! +tooltip.actuallyadditions.blockInputter.desc.6=-A Range of Slots in the other Inventory to Output to and Input from +tooltip.actuallyadditions.blockInputter.desc.7=-> Just input the Minimum and Maximum Slots into the input Fields! +tooltip.actuallyadditions.blockInputterAdvanced.desc=Has an Input and Output Filter! (White- and Blacklist!) tooltip.actuallyadditions.blockFishingNet.desc=Catches Fish automatically when placed above Water tooltip.actuallyadditions.blockFurnaceSolar.desc=Produces RF in Daylight tooltip.actuallyadditions.blockHeatCollector.desc.1=Produces RF @@ -454,12 +464,12 @@ info.actuallyadditions.gui.east=East info.actuallyadditions.gui.south=South info.actuallyadditions.gui.west=West info.actuallyadditions.gui.all=All -info.actuallyadditions.gui.slot=Slot info.actuallyadditions.gui.put=Put info.actuallyadditions.gui.pull=Pull info.actuallyadditions.gui.whitelist=Whitelist info.actuallyadditions.gui.blacklist=Blacklist info.actuallyadditions.gui.coffee=Coffee +info.actuallyadditions.gui.ok=Ok tooltip.actuallyadditions.uses.desc=Uses tooltip.actuallyadditions.produces.desc=Produces diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiCoffeeMachine.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiCoffeeMachine.png index 9a2081ca2..338f8beb8 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiCoffeeMachine.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiCoffeeMachine.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiInputter.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputter.png index 11b8583ad..a6cb89c47 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiInputter.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputter.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png index ff204cabc..8dc118cc9 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png differ diff --git a/update/changelog.txt b/update/changelog.txt index e4b0687d2..336016a25 100644 --- a/update/changelog.txt +++ b/update/changelog.txt @@ -1 +1 @@ -Drills, Drill Upgrades, Energizer, Enervator, Batteries \ No newline at end of file +Coffee Machine needs Water, ESD Revamp, Plants grow on Farmland \ No newline at end of file diff --git a/update/newestVersion.txt b/update/newestVersion.txt index 4846cf078..6bdb112d2 100644 --- a/update/newestVersion.txt +++ b/update/newestVersion.txt @@ -1 +1 @@ -1.7.10-0.0.6.0 \ No newline at end of file +1.7.10-0.0.6.1 \ No newline at end of file