From 9eb6f3a88c8c472d333ee9b774364ddfea65ac7d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 2 Apr 2015 12:06:42 +0200 Subject: [PATCH] Item Repairer & Bug Fixes --- build.gradle | 2 +- .../blocks/BlockCompost.java | 2 +- .../blocks/BlockItemRepairer.java | 132 +++++++++++++++++ .../actuallyadditions/blocks/InitBlocks.java | 4 + .../config/ConfigValues.java | 101 +++++++------ .../crafting/BlockCrafting.java | 8 ++ .../creative/CreativeTab.java | 1 + .../gadget/RenderSpecial.java | 4 +- .../inventory/ContainerRepairer.java | 117 +++++++++++++++ .../inventory/GuiHandler.java | 7 + .../inventory/GuiRepairer.java | 50 +++++++ .../actuallyadditions/items/ItemKnife.java | 2 +- .../tile/IPowerAcceptor.java | 12 ++ .../tile/TileEntityBase.java | 1 + .../tile/TileEntityCompost.java | 4 +- .../tile/TileEntityFeeder.java | 6 +- .../tile/TileEntityFishingNet.java | 2 +- .../tile/TileEntityFurnaceDouble.java | 23 ++- .../tile/TileEntityFurnaceSolar.java | 33 ++--- .../tile/TileEntityGrinder.java | 22 ++- .../tile/TileEntityItemRepairer.java | 136 ++++++++++++++++++ .../actuallyadditions/util/ModUtil.java | 2 +- .../assets/actuallyadditions/lang/en_US.lang | 2 + .../textures/blocks/blockItemRepairer.png | Bin 0 -> 556 bytes .../blocks/blockItemRepairerBottom.png | Bin 0 -> 668 bytes .../textures/blocks/blockItemRepairerOn.png | Bin 0 -> 807 bytes .../textures/blocks/blockItemRepairerTop.png | Bin 0 -> 758 bytes .../textures/gui/guiRepairer.png | Bin 0 -> 2145 bytes .../textures/gui/guiTorchBox.png | Bin 1836 -> 0 bytes src/main/resources/mcmod.info | 6 +- 30 files changed, 586 insertions(+), 93 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/tile/IPowerAcceptor.java create mode 100644 src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairer.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerBottom.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerOn.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerTop.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiRepairer.png delete mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiTorchBox.png diff --git a/build.gradle b/build.gradle index e3f012ecc..861847365 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-0.0.3.2" +version = "1.7.10-0.0.3.3" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index f4592931e..a146016b4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -44,7 +44,7 @@ public class BlockCompost extends BlockContainerBase implements IName{ ItemStack stackPlayer = player.getCurrentEquippedItem(); TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(x, y, z); //Add items to be composted - if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigValues.tileEntityCompostAmountNeededToConvert))){ + if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigValues.compostAmountNeededToConvert))){ if(tile.slots[0] == null) tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal()); else tile.slots[0].stackSize++; if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java new file mode 100644 index 000000000..23a1a4b5e --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -0,0 +1,132 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; +import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +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.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.List; +import java.util.Random; + +public class BlockItemRepairer extends BlockContainerBase implements IName{ + + private IIcon topIcon; + private IIcon onIcon; + private IIcon bottomIcon; + + public BlockItemRepairer(){ + super(Material.rock); + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + this.setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return new TileEntityItemRepairer(); + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z){ + return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0; + } + + @Override + public IIcon getIcon(int side, int meta){ + if(side == 1 && meta != 1) return this.topIcon; + if(side == 1) return this.onIcon; + if(side == 0) return this.bottomIcon; + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand){ + + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "On"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom"); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(!world.isRemote){ + TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z); + if (repairer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.REPAIRER_ID, world, x, y, z); + return true; + } + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int par6){ + this.dropInventory(world, x, y, z); + super.breakBlock(world, x, y, z, block, par6); + } + + @Override + public String getName(){ + return "blockItemRepairer"; + } + + 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.epic; + } + + @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) { + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); + } + else list.add(ItemUtil.shiftForInfo()); + } + + @Override + public int getMetadata(int meta){ + return meta; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 201dce8fe..45e4b03ef 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -18,6 +18,7 @@ public class InitBlocks{ public static Block blockFishingNet; public static Block blockFurnaceSolar; public static Block blockHeatCollector; + public static Block blockItemRepairer; public static void init(){ Util.logInfo("Initializing Blocks..."); @@ -54,5 +55,8 @@ public class InitBlocks{ blockHeatCollector = new BlockHeatCollector(); BlockUtil.register(blockHeatCollector, BlockHeatCollector.TheItemBlock.class); + + blockItemRepairer = new BlockItemRepairer(); + BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index bd2d95cc6..ee78813af 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -12,6 +12,8 @@ public class ConfigValues{ public static boolean[] enablePotionRingRecipes = new boolean[ThePotionRings.values().length]; public static boolean enableCompostRecipe; public static boolean enableKnifeRecipe; + public static boolean enableLeafBlowerRecipe; + public static boolean enableLeafBlowerAdvancedRecipe; public static boolean enableCrusherRecipe; public static boolean enableCrusherDoubleRecipe; public static boolean enableFurnaceDoubleRecipe; @@ -19,42 +21,42 @@ public class ConfigValues{ public static boolean enableFeederRecipe; public static boolean enableCrafterRecipe; public static boolean enableInputterRecipe; - - public static int tileEntityCompostAmountNeededToConvert; - public static int tileEntityCompostConversionTimeNeeded; - - public static int tileEntityFeederReach; - public static int tileEntityFeederTimeNeeded; - public static int tileEntityFeederThreshold; - - public static int tileFishingNetTime; - - public static int itemKnifeMaxDamage; - - public static int toolEmeraldHarvestLevel; - public static int toolEmeraldMaxUses; - public static float toolEmeraldEfficiency; - public static float toolEmeraldDamage; - public static int toolEmeraldEnchantability; + public static boolean enableRepairerRecipe; + public static boolean enableSolarRecipe; + public static boolean enableFishingNetRecipe; + public static boolean enableHeatCollectorRecipe; public static boolean enableToolEmeraldRecipe; - - public static int toolObsidianHarvestLevel; - public static int toolObsidianMaxUses; - public static float toolObsidianEfficiency; - public static float toolObsidianDamage; - public static int toolObsidianEnchantability; public static boolean enableToolObsidianRecipe; + public static int knifeMaxDamage; + public static int toolEmeraldHarvestLevel; + public static int toolEmeraldMaxUses; + public static int toolEmeraldEnchantability; + public static int toolObsidianHarvestLevel; + public static int toolObsidianMaxUses; + public static int toolObsidianEnchantability; + public static float toolObsidianEfficiency; + public static float toolObsidianDamage; + public static float toolEmeraldEfficiency; + public static float toolEmeraldDamage; + + public static int compostAmountNeededToConvert; + public static int compostConversionTimeNeeded; + public static int feederReach; + public static int feederTimeNeeded; + public static int feederThreshold; + public static int fishingNetTime; public static int furnaceDoubleSmeltTime; public static int grinderDoubleCrushTime; public static int grinderCrushTime; - - public static boolean enableExperienceDrop; - public static boolean enableBloodDrop; - public static boolean enableHeartDrop; - public static boolean enableSubstanceDrop; - public static boolean enablePearlShardDrop; - public static boolean enableEmeraldShardDrop; + public static int leafBlowerRangeSides; + public static int leafBlowerRangeUp; + public static int heatCollectorRandomChance; + public static int heatCollectorBlocksNeeded; + public static int repairerSpeedSlowdown; + public static boolean leafBlowerDropItems; + public static boolean leafBlowerParticles; + public static boolean leafBlowerHasSound; public static boolean generateBlackQuartz; public static int blackQuartzBaseAmount; @@ -63,20 +65,12 @@ public class ConfigValues{ public static int blackQuartzMinHeight; public static int blackQuartzMaxHeight; - public static boolean enableLeafBlowerRecipe; - public static boolean enableLeafBlowerAdvancedRecipe; - public static int leafBlowerRangeSides; - public static int leafBlowerRangeUp; - public static boolean leafBlowerDropItems; - public static boolean leafBlowerParticles; - public static boolean leafBlowerHasSound; - - public static boolean enableSolarRecipe; - public static boolean enableFishingNetRecipe; - public static boolean enableHeatCollectorRecipe; - - public static int heatCollectorRandomChance; - public static int heatCollectorBlocksNeeded; + public static boolean enableExperienceDrop; + public static boolean enableBloodDrop; + public static boolean enableHeartDrop; + public static boolean enableSubstanceDrop; + public static boolean enablePearlShardDrop; + public static boolean enableEmeraldShardDrop; public static void defineConfigValues(Configuration config){ @@ -86,7 +80,6 @@ public class ConfigValues{ for(int i = 0; i < enabledMiscRecipes.length; i++){ enabledMiscRecipes[i] = config.getBoolean(TheMiscItems.values()[i].name, ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled"); } - for(int i = 0; i < enablePotionRingRecipes.length; i++){ enablePotionRingRecipes[i] = config.getBoolean(ThePotionRings.values()[i].name, ConfigurationHandler.CATEGORY_POTION_RING_CRAFTING, i != ThePotionRings.SATURATION.ordinal(), "If the Crafting Recipe for the Ring of " + ThePotionRings.values()[i].name + " is Enabled"); } @@ -114,6 +107,7 @@ public class ConfigValues{ enableEmeraldShardDrop = config.getBoolean("Emerald Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Emerald Shard drops from Mobs"); enableCompostRecipe = config.getBoolean("Compost", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Compost is Enabled"); + enableRepairerRecipe = config.getBoolean("Item Repairer", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Item Repairer is Enabled"); enableKnifeRecipe = config.getBoolean("Knife", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Knife is Enabled"); enableCrusherDoubleRecipe = config.getBoolean("Double Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Crusher is Enabled"); enableCrusherRecipe = config.getBoolean("Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Crusher is Enabled"); @@ -127,16 +121,16 @@ public class ConfigValues{ enableFishingNetRecipe = config.getBoolean("Fishing Net", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Fishing Net is Enabled"); enableHeatCollectorRecipe = config.getBoolean("Heat Collector", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Heat Collector is Enabled"); - tileEntityCompostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer"); - tileEntityCompostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer"); + compostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer"); + compostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer"); - tileFishingNetTime = config.getInt("Fishing Net: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish"); + fishingNetTime = config.getInt("Fishing Net: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish"); - tileEntityFeederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder"); - tileEntityFeederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder"); - tileEntityFeederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop"); + feederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder"); + feederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder"); + feederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop"); - itemKnifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with"); + knifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with"); toolEmeraldHarvestLevel = config.getInt("Emerald: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"); toolEmeraldMaxUses = config.getInt("Emerald: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used"); @@ -156,7 +150,8 @@ public class ConfigValues{ grinderDoubleCrushTime = config.getInt("Double Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item"); furnaceDoubleSmeltTime = config.getInt("Double Furnace: Smelt Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item"); + repairerSpeedSlowdown = config.getInt("Item Repairer: Speed Slowdown", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs"); heatCollectorBlocksNeeded = config.getInt("Heat Collector: Blocks Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"); - heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"); + heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 9096f5001..bdc1bde90 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -34,6 +34,14 @@ public class BlockCrafting{ 'D', new ItemStack(Items.diamond), 'S', new ItemStack(Items.string)); + //Repairer + if(ConfigValues.enableRepairerRecipe) + GameRegistry.addRecipe(new ItemStack(InitBlocks.blockItemRepairer), + "DID", "DCD", "DID", + 'D', new ItemStack(Items.diamond), + 'I', new ItemStack(Items.iron_ingot), + 'C', new ItemStack(Blocks.crafting_table)); + //Solar Panel if(ConfigValues.enableSolarRecipe) GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceSolar), diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index bc58317c8..0a03afdb3 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -33,6 +33,7 @@ public class CreativeTab extends CreativeTabs{ this.addBlock(InitBlocks.blockFurnaceSolar); this.addBlock(InitBlocks.blockFishingNet); this.addBlock(InitBlocks.blockHeatCollector); + this.addBlock(InitBlocks.blockItemRepairer); this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockFeeder); diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java index cbcba3fdb..bd81aa449 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -22,7 +22,7 @@ public class RenderSpecial{ public void render(EntityPlayer player, float renderTick, float size, float offsetUp){ int bobHeight = 70; - double rotationModifier = 3; + double rotationModifier = 2; long time = player.worldObj.getTotalWorldTime(); if(time-bobHeight >= lastTimeForBobbing){ @@ -49,7 +49,7 @@ public class RenderSpecial{ GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0); } - GL11.glRotated(time * rotationModifier, 0, 1, 0); + GL11.glRotated((double)time*rotationModifier, 0, 1, 0); Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); theModel.render(0.0625F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java new file mode 100644 index 000000000..b1ea0abc3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java @@ -0,0 +1,117 @@ +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.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; + +public class ContainerRepairer extends Container{ + + private TileEntityItemRepairer tileRepairer; + + private int lastCoalTime; + private int lastCoalTimeLeft; + + public ContainerRepairer(InventoryPlayer inventory, TileEntityBase tile){ + this.tileRepairer = (TileEntityItemRepairer)tile; + + this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_COAL, 80, 21)); + + this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_INPUT, 47, 53)); + this.addSlotToContainer(new SlotOutput(this.tileRepairer, TileEntityItemRepairer.SLOT_OUTPUT, 109, 53)); + + 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)); + } + } + for (int i = 0; i < 9; i++){ + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting iCraft){ + super.addCraftingToCrafters(iCraft); + iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime); + iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft); + } + + @Override + public void detectAndSendChanges(){ + super.detectAndSendChanges(); + for(Object crafter : this.crafters){ + ICrafting iCraft = (ICrafting)crafter; + + if(this.lastCoalTime != this.tileRepairer.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime); + if(this.lastCoalTimeLeft != this.tileRepairer.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft); + } + + this.lastCoalTime = this.tileRepairer.coalTime; + this.lastCoalTimeLeft = this.tileRepairer.coalTimeLeft; + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2){ + if(par1 == 0) this.tileRepairer.coalTime = par2; + if(par1 == 1) this.tileRepairer.coalTimeLeft = par2; + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.tileRepairer.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 3; + final int inventoryEnd = inventoryStart+26; + final int hotbarStart = inventoryEnd+1; + final int hotbarEnd = hotbarStart+8; + + Slot theSlot = (Slot)this.inventorySlots.get(slot); + if(theSlot.getHasStack()){ + ItemStack currentStack = theSlot.getStack(); + ItemStack newStack = currentStack.copy(); + + if(slot <= hotbarEnd && slot >= inventoryStart){ + if(TileEntityItemRepairer.canBeRepaired(currentStack)){ + this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false); + } + + if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){ + this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_COAL, TileEntityItemRepairer.SLOT_COAL+1, false); + } + } + + if(slot <= hotbarEnd && slot >= hotbarStart){ + this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false); + } + + else if(slot <= inventoryEnd && slot >= inventoryStart){ + this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false); + } + + else if(slot < inventoryStart){ + this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); + } + + if(newStack.stackSize == 0) theSlot.putStack(null); + else theSlot.onSlotChanged(); + if(newStack.stackSize == currentStack.stackSize) return null; + theSlot.onPickupFromSlot(player, newStack); + + return currentStack; + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 676aee8d0..ae06c7865 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -34,6 +34,9 @@ public class GuiHandler implements IGuiHandler{ case INPUTTER_ID: TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); return new ContainerInputter(entityPlayer.inventory, tileInputter); + case REPAIRER_ID: + TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); + return new ContainerRepairer(entityPlayer.inventory, tileRepairer); default: return null; } @@ -62,6 +65,9 @@ public class GuiHandler implements IGuiHandler{ case INPUTTER_ID: TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world); + case REPAIRER_ID: + TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); + return new GuiRepairer(entityPlayer.inventory, tileRepairer); default: return null; } @@ -74,6 +80,7 @@ public class GuiHandler implements IGuiHandler{ public static final int GRINDER_DOUBLE_ID = 4; public static final int FURNACE_DOUBLE_ID = 5; public static final int INPUTTER_ID = 6; + public static final int REPAIRER_ID = 7; public static void init(){ Util.logInfo("Initializing GuiHandler..."); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java new file mode 100644 index 000000000..7d403e042 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java @@ -0,0 +1,50 @@ +package ellpeck.actuallyadditions.inventory; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; +import ellpeck.actuallyadditions.util.AssetUtil; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiRepairer extends GuiContainer{ + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiRepairer"); + private TileEntityItemRepairer tileRepairer; + + public GuiRepairer(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerRepairer(inventory, tile)); + this.tileRepairer = (TileEntityItemRepairer)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + 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, 0, 0, 176, 86); + + this.mc.getTextureManager().bindTexture(resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + + if(this.tileRepairer.coalTime > 0){ + int i = this.tileRepairer.getCoalTimeToScale(15); + this.drawTexturedModalRect(this.guiLeft+80, this.guiTop+5+14-i, 176, 44+14-i, 14, i); + } + if(TileEntityItemRepairer.canBeRepaired(this.tileRepairer.slots[TileEntityItemRepairer.SLOT_INPUT])){ + int i = this.tileRepairer.getItemDamageToScale(22); + this.drawTexturedModalRect(this.guiLeft+73, this.guiTop+52, 176, 28, i, 16); + } + } + + @Override + public void drawScreen(int x, int y, float f){ + super.drawScreen(x, y, f); + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java index c0eac80dd..dc95fe564 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java @@ -20,7 +20,7 @@ import java.util.List; public class ItemKnife extends Item implements IName{ public ItemKnife(){ - this.setMaxDamage(ConfigValues.itemKnifeMaxDamage); + this.setMaxDamage(ConfigValues.knifeMaxDamage); this.setMaxStackSize(1); this.setContainerItem(this); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/IPowerAcceptor.java b/src/main/java/ellpeck/actuallyadditions/tile/IPowerAcceptor.java new file mode 100644 index 000000000..4c4f46d19 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/IPowerAcceptor.java @@ -0,0 +1,12 @@ +package ellpeck.actuallyadditions.tile; + +public interface IPowerAcceptor{ + + void setBlockMetadataToOn(); + + void setPower(int power); + + void setItemPower(int power); + + int getItemPower(); +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index dfb3aac43..47bdcbbc8 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -38,6 +38,7 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityFishingNet.class, ModUtil.MOD_ID_LOWER + ":tileEntityFishingNet"); GameRegistry.registerTileEntity(TileEntityFurnaceSolar.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceSolar"); GameRegistry.registerTileEntity(TileEntityHeatCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityHeatCollector"); + GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java index 121249555..fa080ce8b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java @@ -10,8 +10,8 @@ import net.minecraft.nbt.NBTTagCompound; public class TileEntityCompost extends TileEntityInventoryBase{ - public final int amountNeededToConvert = ConfigValues.tileEntityCompostAmountNeededToConvert; - public final int conversionTimeNeeded = ConfigValues.tileEntityCompostConversionTimeNeeded; + public final int amountNeededToConvert = ConfigValues.compostAmountNeededToConvert; + public final int conversionTimeNeeded = ConfigValues.compostConversionTimeNeeded; public int conversionTime; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java index d584157d0..62f282445 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java @@ -16,9 +16,9 @@ import java.util.Random; public class TileEntityFeeder extends TileEntityInventoryBase{ - public int reach = ConfigValues.tileEntityFeederReach; - public int timerGoal = ConfigValues.tileEntityFeederTimeNeeded; - public int animalThreshold = ConfigValues.tileEntityFeederThreshold; + public int reach = ConfigValues.feederReach; + public int timerGoal = ConfigValues.feederTimeNeeded; + public int animalThreshold = ConfigValues.feederThreshold; public int currentTimer; public int currentAnimalAmount; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java index 2b2a36557..29db19999 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java @@ -10,7 +10,7 @@ import java.util.Random; public class TileEntityFishingNet extends TileEntityBase{ - public int timeUntilNextDropToSet = ConfigValues.tileFishingNetTime; + public int timeUntilNextDropToSet = ConfigValues.fishingNetTime; public int timeUntilNextDrop; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 27e233207..0723921e7 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -9,7 +9,7 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; -public class TileEntityFurnaceDouble extends TileEntityInventoryBase{ +public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IPowerAcceptor{ public static final int SLOT_COAL = 0; public static final int SLOT_INPUT_1 = 1; @@ -153,4 +153,25 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase{ public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket); } + + @Override + public void setBlockMetadataToOn(){ + int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metaBefore+4, 2); + } + + @Override + public void setPower(int power){ + this.coalTimeLeft = power; + } + + @Override + public void setItemPower(int power){ + this.coalTime = power; + } + + @Override + public int getItemPower(){ + return this.coalTime; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java index 289440488..c17758a26 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -18,6 +18,16 @@ public class TileEntityFurnaceSolar extends TileEntityBase{ } public static void givePowerTo(TileEntity tile){ + if(tile instanceof IPowerAcceptor){ + IPowerAcceptor acceptor = (IPowerAcceptor)tile; + int coalTimeBefore = acceptor.getItemPower(); + acceptor.setItemPower(42); + acceptor.setPower(42); + if(coalTimeBefore == 0){ + acceptor.setBlockMetadataToOn(); + } + return; + } if(tile instanceof TileEntityFurnace){ TileEntityFurnace furnaceBelow = (TileEntityFurnace)tile; int burnTimeBefore = furnaceBelow.furnaceBurnTime; @@ -26,29 +36,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase{ if(burnTimeBefore == 0){ BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord); } - return; - } - - if(tile instanceof TileEntityFurnaceDouble){ - TileEntityFurnaceDouble doubleBelow = (TileEntityFurnaceDouble)tile; - int coalTimeBefore = doubleBelow.coalTime; - doubleBelow.coalTime = 42; - doubleBelow.coalTimeLeft = 42; - if(coalTimeBefore == 0){ - int metaBefore = tile.getWorldObj().getBlockMetadata(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord); - tile.getWorldObj().setBlockMetadataWithNotify(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord, metaBefore+4, 2); - } - return; - } - - if(tile instanceof TileEntityGrinder){ - TileEntityGrinder grinderBelow = (TileEntityGrinder)tile; - int coalTimeBefore = grinderBelow.coalTime; - grinderBelow.coalTime = 42; - grinderBelow.coalTimeLeft = 42; - if(coalTimeBefore == 0){ - tile.getWorldObj().setBlockMetadataWithNotify(grinderBelow.xCoord, grinderBelow.yCoord, grinderBelow.zCoord, 1, 2); - } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 490e6f0cc..93780d9ff 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntityFurnace; import java.util.Random; -public class TileEntityGrinder extends TileEntityInventoryBase{ +public class TileEntityGrinder extends TileEntityInventoryBase implements IPowerAcceptor{ public static final int SLOT_COAL = 0; public static final int SLOT_INPUT_1 = 1; @@ -184,4 +184,24 @@ public class TileEntityGrinder extends TileEntityInventoryBase{ public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket); } + + @Override + public void setBlockMetadataToOn(){ + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } + + @Override + public void setPower(int power){ + this.coalTimeLeft = power; + } + + @Override + public void setItemPower(int power){ + this.coalTime = power; + } + + @Override + public int getItemPower(){ + return this.coalTime; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java new file mode 100644 index 000000000..568e2d309 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java @@ -0,0 +1,136 @@ +package ellpeck.actuallyadditions.tile; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.config.ConfigValues; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityFurnace; + +public class TileEntityItemRepairer extends TileEntityInventoryBase implements IPowerAcceptor{ + + public static final int SLOT_COAL = 0; + public static final int SLOT_INPUT = 1; + public static final int SLOT_OUTPUT = 2; + + private final int speedSlowdown = ConfigValues.repairerSpeedSlowdown; + + public int coalTime; + public int coalTimeLeft; + + public int nextRepairTick; + + public TileEntityItemRepairer(){ + super(3, "tileEntityItemRepairer"); + } + + @Override + @SuppressWarnings("unchecked") + public void updateEntity(){ + if(!worldObj.isRemote){ + boolean theFlag = this.coalTimeLeft > 0; + + if(this.coalTimeLeft > 0) this.coalTimeLeft--; + + if(this.slots[SLOT_OUTPUT] == null){ + if(canBeRepaired(this.slots[SLOT_INPUT])){ + if(this.slots[SLOT_INPUT].getItemDamage() <= 0){ + this.slots[SLOT_OUTPUT] = this.slots[SLOT_INPUT].copy(); + this.slots[SLOT_INPUT] = null; + } + else{ + if(this.coalTimeLeft <= 0){ + this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]); + this.coalTimeLeft = this.coalTime; + if(this.coalTime > 0){ + this.slots[SLOT_COAL].stackSize--; + if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]); + } + } + if(this.coalTimeLeft > 0){ + this.nextRepairTick++; + if(this.nextRepairTick >= this.speedSlowdown){ + this.nextRepairTick = 0; + this.slots[SLOT_INPUT].setItemDamage(this.slots[SLOT_INPUT].getItemDamage() - 1); + } + } + } + } + } + + if(theFlag != this.coalTimeLeft > 0){ + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2); + this.markDirty(); + } + } + } + + public static boolean canBeRepaired(ItemStack stack){ + return stack != null && stack.getItem().isRepairable(); + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("CoalTime", this.coalTime); + compound.setInteger("CoalTimeLeft", this.coalTimeLeft); + compound.setInteger("NextRepairTick", this.nextRepairTick); + super.writeToNBT(compound); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + this.coalTime = compound.getInteger("CoalTime"); + this.coalTimeLeft = compound.getInteger("CoalTimeLeft"); + this.nextRepairTick = compound.getInteger("NextRepairTick"); + super.readFromNBT(compound); + } + + @SideOnly(Side.CLIENT) + public int getCoalTimeToScale(int i){ + return this.coalTimeLeft * i / this.coalTime; + } + + @SideOnly(Side.CLIENT) + public int getItemDamageToScale(int i){ + if(this.slots[SLOT_INPUT] != null){ + return (this.slots[SLOT_INPUT].getMaxDamage()-this.slots[SLOT_INPUT].getItemDamage()) * i / this.slots[SLOT_INPUT].getMaxDamage(); + } + return 0; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || i == SLOT_INPUT; + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, int side){ + return this.isItemValidForSlot(slot, stack); + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, int side){ + return slot == SLOT_OUTPUT || (slot == SLOT_COAL && stack.getItem() == Items.bucket); + } + + @Override + public void setBlockMetadataToOn(){ + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } + + @Override + public void setPower(int power){ + this.coalTimeLeft = power; + } + + @Override + public void setItemPower(int power){ + this.coalTime = power; + } + + @Override + public int getItemPower(){ + return this.coalTime; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 6be15ffe3..bd96d90b2 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.3.2"; + public static final String VERSION = "1.7.10-0.0.3.3"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index b881c0a2a..ba9638d5b 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -14,6 +14,7 @@ tile.actuallyadditions.blockFurnaceDouble.name=Double Furnace tile.actuallyadditions.blockFishingNet.name=Fishing Net tile.actuallyadditions.blockFurnaceSolar.name=Solar Panel tile.actuallyadditions.blockHeatCollector.name=Heat Collector +tile.actuallyadditions.blockItemRepairer.name=Item Repairer tile.actuallyadditions.blockInputter.name=ESD tile.actuallyadditions.blockInputter.add.0.name=Ellpeck's Slot Device @@ -121,6 +122,7 @@ tooltip.actuallyadditions.blockFurnaceSolar.desc=Powers Furnaces and Crushers be tooltip.actuallyadditions.blockHeatCollector.desc.1=Powers Furnaces and Crushers above it tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around it tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out! +tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost. diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairer.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairer.png new file mode 100644 index 0000000000000000000000000000000000000000..4de84a0eb0d48dc3c1323255a1eed979568e5b6d GIT binary patch literal 556 zcmV+{0@MA8P)WFU8GbZ8()Nlj2>E@cM*00EFmL_t(I%cYaOiWNZ+ zg}=J=Onhfe6c%Kkz|>$LK=2vdKoE>g#7DTvVzQB;AQ<~L8mwS=Swvh6`czFBOwYYD ztC(29(AAuCx_-{shmY@*|A^x9c1$oJZ8~G^%OPLK^lp(0TaYlw%maL;t|g3|1-$wl z=sN81*55CRyC5e;1Fo;X9(B?d%|K$DojqJtv{4n3a5-|vJ?KhLS9+fRx}@(qy1u9H zI>zvZYj`;u_ePXZ6=MVu!7yxj@c5LAA3IKl0gu2vkc8?)mPAqYMN8R0&Wrn3Y|nSV zYwEX3_=x*NT(wX&wJmQD5U uukxpZ*WyW$1SDw&xzJxAGZ(}~j=^t!Gb*;Y+EVra0000WFU8GbZ8()Nlj2>E@cM*00IC>L_t(I%T1F}lH(u@ zL?4oX#F?6z+-&#$$B1Ja17bhyxRyVPqSf?k!rwoCM$VbuI~F4;MgZKM);oJC0HmDx ztlm4SN{SJirirZ-q8R||w&CssptgpYAtKaT8DkL5$SED-wIc8L8&xHU01*GXkW(Ur zz;FjZRjIWiBBU5;tzkbuKLG5t(tD@&j=Q6(lv21)6Q+uYP)cE_GS4$(3`7+xr5viN z40l>JL93N} zN{9$sDcEPqvaVQ+s4DMeVYm}QAjWvn*=xmO#LRGa_ENBq#jz$Mmgzy=vh$>S`%=1hL0Yad+1|b}*RdII)FijI?b~V<%zrWdQrJVuQ))?;i z7;xGSB0TPQVvMZo3T9Vtt_=KaTL^&xhzJtGMPi&a2bfWFU8GbZ8()Nlj2>E@cM*00N6iL_t(I%Vm9+M{JwjC=NxhE`c+-*?IV{jP%4$k=L+O=Ir=yE z!14V<030aiI5IK_ zfQkyFsq6q$Ba3bk^F0Ml-+sWvg;P{2zX{?9EE7Le)Rt>4!vfXFb}S@`1tI_qCvMCz zdFc!}*I}U=puW|xGd6FlJ~~oly0U<7YC0AS&|sJbFQ%s$8!iJdJ~F_uecJ#S+f!op z$@6v}($wex)<>Bn2^-HFUp z8OOW5TW4a3p5UkW9 lw2WEx6e?9{okH5&-9LlJ1vQuQY0m%v002ovPDHLkV1mZ-S5N=| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerTop.png new file mode 100644 index 0000000000000000000000000000000000000000..c6e1d0f28ef247b1ff0cb87e3a24cff422598629 GIT binary patch literal 758 zcmVWFU8GbZ8()Nlj2>E@cM*00LS`L_t(I%Waa+OH@%5 z$3J%*-<#>ZnXw#oipC7e7J+4@kd)95l0*>;K_OeYX%)1$O`HCJpiQelXcbvOAp}tn z1e&xh2uWxr9W~z%XWn&ux5b-g-e?Cd7tZu@YJF59W8Z(h3lgW@UlO#-& z)|OTb!vGYnyT!`t3bx~5I~MtT9>=y=TQ3j=K!89Ylt7?@1R#Q|5~3bcsRaZmzJL2c zF1Jcd)6sMt(=gC94FD-6j_V>lkCOCoY@5uXbeJHZD}4RPw&$V6W7WR0Si<)eF(Y2h z=^b6wH<7weMg&(oTe;Ga;>qhz40pG4v#%3?{%n$wvmJyR)(BLMB$aMr;?Wz%`cLsI zSHP7XLW^P*x7k=(uK`t915r5&Mjkxl*0pn_5(W#oEw-07&|^BEa~8f=CT_+9pkUVs z3L2tOW~av)?9Ku(e5Rcn=Z^z0*qvqO{UW;~5^{;1opRWL?WV2w2FuV6!^a4(vc=+=H{6k=;89oHhQ!B z8N1NM_0xwL?L8V2F=V32!!B+_2FS;Dr+erIW)Bpeg07*qoM6N<$f-(R?pa1{> literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiRepairer.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiRepairer.png new file mode 100644 index 0000000000000000000000000000000000000000..a00a0fc686e33f4dab1b91195eeda9ff687b43fe GIT binary patch literal 2145 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP~61dt{?4unjB3sTkH}&M2EHvI%(&64N(U$?QQ{g=5}cn_Ql40p%21G)nOCBh zms+A=qGzCIn%ZiV3M^2Ld%8G=RK&fV(_OU4fWh@{Sls{r2lJTRS08m3R*-sUYh09( z#4XclZCzGnVf*+4pGBGCJh^uUdzv?~&Xav>d)@wvEB79*3)7$f-ks7Y&Sz>_Om=Hoi8tG;qcWvVb6yRGs`9wHk@KEd0cw@?3U?1e;M_nA2Qf)ceL6a z!4xh!>E_Yd3XIDdUCM+W#3;_4tJC;dZSJf04NI@cKDeKMDZl9ybIb34ZC~UcGVncM znB%}H!*KsFqs#+l<_{`A4*8@7R5NfH%yj(9xQq$Nsc+cGFj?}Af`iV16t-#(0gzNF z<1+7mtu+n$YQ_Z&HT`oK?taPE3pe;!{wj`1JK+252V5%b9BD?)vMe1y@)vUtkbK4L z10-)TC#V^(&_6J7`Pah!gRED?7j&{7bHD7#_G0#jIWHGVKDbdH^VIxCL zh(-FhhYwe)3NRmuUck%GCLW;2@ZWNlq4lwDhPMJtN50y(2=VAG*u`+%ET+2R>+S+= z8Bu1F!y8}sf4thS2{a>#;o4jN&7wS;KW=5}(N@^=BT-t*U`N9hhB;qb-M^oBvpxA5 zmjTbiz3U|pozJ(kIk287n^ofdzmH}ahm#Tt7^T^E=xzvWsN)d7&zBp)nAm=hHAnKn zvI9|!vlRa^3+UUusjX^w&9wS1gVX>q}m3~%~1*b>T}3>c~xh&RkNE@J$^x|PAWOi1DXhlLLS5KIZY?vEed9{c%Q_1B@1pLKY1B+L2^QA&dRf`N&DBm;)v@9e6; zXy+{Oh%9Dc;M)Sij2q3Wbbx{qC9V-A!TD(=<%vb93~dIox?sjWt- z3=B+@JY5_^D&pSWI+!KxDByarGv)7pb^k>_B4zhTxri19KhNXJGTg$S%%Us%yzHxff>}}d zi;eLG^9lW;@ZSBu&c?*vDq((NeImR!zIfkun5&UJ@a6BZ?OB(3CR9%keSFvN*{e&- zq!sdStv)vW=U!f*u^^!ET#p;VVqjSCUTrz)$~U+J^#k4ei|NGO*Q-9(nL|R!e|C7U ze8&4+nBl-chcOvyx9<#{oz`H>#E@WiU@h|ln|bH&E@Nx>d}4F?ia+n`ng0AVzp?DR sbNICnC-yQ;ury