From 09d67f95a43312fd0d541a185a75359ec4d2845c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 30 Mar 2015 18:42:14 +0200 Subject: [PATCH 1/3] Update done! --- .../blocks/render/RenderItems.java | 2 +- .../event/RenderPlayerEventAA.java | 45 ++++++++++++++++++ .../gadget/ModelStandardBlock.java | 30 ++++++++++++ .../actuallyadditions/gadget/ModelTorch.java | 27 +++++++++++ .../gadget/RenderSpecial.java | 46 +++++++++++++++++++ .../actuallyadditions/proxy/ClientProxy.java | 10 +++- 6 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java index 202ad6a4e..6c7e9fc1b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java @@ -28,7 +28,7 @@ public class RenderItems implements IItemRenderer{ } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data){ + public void renderItem(ItemRenderType type, ItemStack stack, Object... data){ switch(type){ case INVENTORY: GL11.glPushMatrix(); diff --git a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java new file mode 100644 index 000000000..42fba23ef --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -0,0 +1,45 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; +import ellpeck.actuallyadditions.gadget.ModelStandardBlock; +import ellpeck.actuallyadditions.gadget.ModelTorch; +import ellpeck.actuallyadditions.gadget.RenderSpecial; +import net.minecraftforge.client.event.RenderPlayerEvent; + +import java.util.UUID; + +public class RenderPlayerEventAA{ + + private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("ESD")); + private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch()); + private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Derp")); + private RenderSpecial glenRender = new RenderSpecial(new ModelFurnaceSolar()); + + @SubscribeEvent + public void RenderPlayerEvent(RenderPlayerEvent.Pre event){ + //Ellpeck + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){ + ellpeckRender.render(0.3F, 1F); + return; + } + + //Paktosan + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){ + paktoRender.render(0.3F, 1F); + return; + } + + //TwoOfEight + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){ + glenRender.render(0.3F, 1F); + return; + } + + //dqmhose + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ + hoseRender.render(0.5F, 1.25F); + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java new file mode 100644 index 000000000..ceccb05fd --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java @@ -0,0 +1,30 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import net.minecraft.client.model.ModelRenderer; + +public class ModelStandardBlock extends ModelBaseAA{ + + public ModelRenderer s; + + private String name; + + public ModelStandardBlock(String name){ + this.name = name; + this.textureWidth = 64; + this.textureHeight = 64; + this.s = new ModelRenderer(this, 0, 0); + this.s.setRotationPoint(-8.0F, 8.0F, -8.0F); + this.s.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16, 0.0F); + } + + @Override + public void render(float f){ + this.s.render(f); + } + + @Override + public String getName(){ + return "model" + this.name; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java new file mode 100644 index 000000000..548328e4f --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java @@ -0,0 +1,27 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import net.minecraft.client.model.ModelRenderer; + +public class ModelTorch extends ModelBaseAA{ + + public ModelRenderer s; + + public ModelTorch(){ + this.textureWidth = 64; + this.textureHeight = 32; + this.s = new ModelRenderer(this, 0, 0); + this.s.setRotationPoint(-1.0F, 14.0F, -1.0F); + this.s.addBox(0.0F, 0.0F, 0.0F, 2, 10, 2, 0.0F); + } + + @Override + public void render(float f){ + this.s.render(f); + } + + @Override + public String getName(){ + return "modelTorch"; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java new file mode 100644 index 000000000..0addb0ada --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -0,0 +1,46 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderSpecial{ + + private double bobbing; + private double rotation; + + ModelBaseAA theModel; + ResourceLocation theTexture; + + public RenderSpecial(ModelBaseAA model){ + this.theModel = model; + this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + (model instanceof ModelFurnaceSolar ? "" : "special/") + this.theModel.getName() + ".png"); + } + + public void render(float size, float offsetUp){ + + if(bobbing >= 0.5) bobbing = 0; + else bobbing+=0.01; + + if(rotation >= 360) rotation = 0; + else rotation+=1; + + GL11.glPushMatrix(); + GL11.glTranslatef(0F, offsetUp, 0F); + GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); + GL11.glScalef(size, size, size); + + if(bobbing <= 0.25)GL11.glTranslated(0, bobbing, 0); + else GL11.glTranslated(0, 0.5 - bobbing, 0); + + GL11.glRotated(rotation, 0, 1, 0); + + Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); + theModel.render(0.0625F); + GL11.glPopMatrix(); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java index ec1c2ddaf..f6066a752 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java @@ -4,9 +4,11 @@ package ellpeck.actuallyadditions.proxy; import cpw.mods.fml.client.registry.ClientRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.render.*; +import ellpeck.actuallyadditions.event.RenderPlayerEventAA; import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.Item; import net.minecraftforge.client.MinecraftForgeClient; @@ -15,11 +17,13 @@ public class ClientProxy implements IProxy{ @Override public void preInit(){ - + Util.logInfo("PreInitializing ClientProxy..."); } @Override public void init(){ + Util.logInfo("Initializing ClientProxy..."); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost())); @@ -28,10 +32,12 @@ public class ClientProxy implements IProxy{ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar())); + + Util.registerEvent(new RenderPlayerEventAA()); } @Override public void postInit(){ - + Util.logInfo("PostInitializing ClientProxy..."); } } From 0d090f1d2c1813fce9a2494103d74915e86fd908 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 31 Mar 2015 20:37:55 +0200 Subject: [PATCH 2/3] Rings of Awesome & Heat Collector! --- build.gradle | 2 +- .../ellpeck/actuallyadditions/PLANNED.txt | 7 - .../blocks/BlockHeatCollector.java | 97 ++++++++++++++ .../actuallyadditions/blocks/InitBlocks.java | 4 + .../config/ConfigValues.java | 20 +++ .../config/ConfigurationHandler.java | 1 + .../crafting/BlockCrafting.java | 26 +++- .../crafting/ItemCrafting.java | 20 +++ .../creative/CreativeTab.java | 4 + .../event/RenderPlayerEventAA.java | 49 +++---- .../actuallyadditions/gadget/ModelTorch.java | 2 +- .../gadget/RenderSpecial.java | 41 ++++-- .../actuallyadditions/items/InitItems.java | 9 ++ .../items/ItemPotionRing.java | 121 ++++++++++++++++++ .../items/metalists/TheMiscItems.java | 3 +- .../items/metalists/ThePotionRings.java | 61 +++++++++ .../tile/TileEntityBase.java | 1 + .../tile/TileEntityFurnaceSolar.java | 64 ++++----- .../tile/TileEntityHeatCollector.java | 65 ++++++++++ .../actuallyadditions/util/ModUtil.java | 2 +- .../ellpeck/actuallyadditions/util/Util.java | 2 +- .../assets/actuallyadditions/lang/en_US.lang | 31 ++++- .../blocks/blockHeatCollectorBottom.png | Bin 0 -> 377 bytes .../blocks/blockHeatCollectorSide.png | Bin 0 -> 278 bytes .../textures/blocks/blockHeatCollectorTop.png | Bin 0 -> 523 bytes .../blocks/models/modelFishingNet.png | Bin 0 -> 222 bytes .../blocks/models/modelFurnaceSolar.png | Bin 0 -> 1146 bytes .../blocks/models/special/modelEllpeck.png | Bin 0 -> 718 bytes .../blocks/models/special/modelGlenthor.png | Bin 0 -> 825 bytes .../blocks/models/special/modelHose.png | Bin 0 -> 326 bytes .../blocks/models/special/modelPakto.png | Bin 0 -> 450 bytes .../textures/gui/guiTorchBox.png | Bin 0 -> 1836 bytes .../textures/items/itemLeafBlower.png | Bin 0 -> 422 bytes .../textures/items/itemLeafBlowerAdvanced.png | Bin 0 -> 348 bytes .../textures/items/itemMiscRing.png | Bin 0 -> 267 bytes .../textures/items/itemPotionRing.png | Bin 0 -> 261 bytes .../textures/items/itemPotionRingAdvanced.png | Bin 0 -> 304 bytes src/main/resources/mcmod.info | 4 +- 38 files changed, 549 insertions(+), 87 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java create mode 100644 src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java create mode 100644 src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java create mode 100644 src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorBottom.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorSide.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorTop.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFishingNet.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFurnaceSolar.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelGlenthor.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelHose.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelPakto.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiTorchBox.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemMiscRing.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemPotionRing.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemPotionRingAdvanced.png diff --git a/build.gradle b/build.gradle index e1df25fcd..e3f012ecc 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-0.0.2.3" +version = "1.7.10-0.0.3.2" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index 53d310489..fbd8f76fd 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -8,10 +8,6 @@ -Advanced ESD -Has a Filter --Heat Collector - -Powers Furnaces when next to them - -Needs Warmth Sources around it - -Instant Teleport Device -Teleports Players to where they look (Much like the Bukkit Compass) @@ -50,9 +46,6 @@ -Cobblestone and Stone Signs --Potion Rings - -Give certain Potion Effects when held - -Binoculars -Allow you to see farther and closer -With Night Vision Addon diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java new file mode 100644 index 000000000..d36d826c0 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java @@ -0,0 +1,97 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.tile.TileEntityHeatCollector; +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.World; + +import java.util.List; + +public class BlockHeatCollector extends BlockContainerBase implements IName{ + + private IIcon topIcon; + private IIcon bottomIcon; + + public BlockHeatCollector(){ + super(Material.rock); + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return new TileEntityHeatCollector(); + } + + @Override + public IIcon getIcon(int side, int metadata){ + return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Side"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom"); + } + + @Override + public String getName(){ + return "blockHeatCollector"; + } + + 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.rare; + } + + @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()){ + for(int i = 0; i < 3; i++){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1))); + } + } + else list.add(ItemUtil.shiftForInfo()); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index e504131d9..201dce8fe 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -17,6 +17,7 @@ public class InitBlocks{ public static Block blockInputter; public static Block blockFishingNet; public static Block blockFurnaceSolar; + public static Block blockHeatCollector; public static void init(){ Util.logInfo("Initializing Blocks..."); @@ -50,5 +51,8 @@ public class InitBlocks{ blockFurnaceSolar = new BlockFurnaceSolar(); BlockUtil.register(blockFurnaceSolar, BlockFurnaceSolar.TheItemBlock.class); + + blockHeatCollector = new BlockHeatCollector(); + BlockUtil.register(blockHeatCollector, BlockHeatCollector.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 7b6ba2e6d..bd2d95cc6 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -2,12 +2,14 @@ package ellpeck.actuallyadditions.config; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.items.metalists.ThePotionRings; import net.minecraftforge.common.config.Configuration; public class ConfigValues{ public static boolean[] enabledFoodRecipes = new boolean[TheFoods.values().length]; public static boolean[] enabledMiscRecipes = new boolean[TheMiscItems.values().length]; + public static boolean[] enablePotionRingRecipes = new boolean[ThePotionRings.values().length]; public static boolean enableCompostRecipe; public static boolean enableKnifeRecipe; public static boolean enableCrusherRecipe; @@ -69,6 +71,13 @@ public class ConfigValues{ 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 void defineConfigValues(Configuration config){ for(int i = 0; i < enabledFoodRecipes.length; i++){ @@ -78,6 +87,10 @@ public class ConfigValues{ 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"); + } + enableLeafBlowerRecipe = config.getBoolean("Leaf Blower", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Leaf Blower is Enabled"); enableLeafBlowerAdvancedRecipe = config.getBoolean("Advanced Leaf Blower", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Advanced Leaf Blower is Enabled"); leafBlowerDropItems = config.getBoolean("Leaf Blower: Drops Items", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks' Drops drop"); @@ -110,6 +123,10 @@ public class ConfigValues{ enableFeederRecipe = config.getBoolean("Feeder", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Feeder is Enabled"); enableCrafterRecipe = config.getBoolean("Crafting Table On A Stick", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Crafting Table On A Stick is Enabled"); + enableSolarRecipe = config.getBoolean("Solar Panel", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Solar Panel is Enabled"); + 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"); @@ -138,5 +155,8 @@ public class ConfigValues{ grinderCrushTime = config.getInt("Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item"); 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"); + + 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!)"); } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java index 8c2680c1b..55b7665b0 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java @@ -15,6 +15,7 @@ public class ConfigurationHandler{ public static final String CATEGORY_MACHINE_VALUES = "machine values"; public static final String CATEGORY_MOB_DROPS = "mob drops"; public static final String CATEGORY_WORLD_GEN = "world gen"; + public static final String CATEGORY_POTION_RING_CRAFTING = "ring crafting"; public static void init(File configFile){ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 8c974698c..9096f5001 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -28,10 +28,28 @@ public class BlockCrafting{ 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); //Fishing Net - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFishingNet), - "SSS", "SDS", "SSS", - 'D', new ItemStack(Items.diamond), - 'S', new ItemStack(Items.string)); + if(ConfigValues.enableFishingNetRecipe) + GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFishingNet), + "SSS", "SDS", "SSS", + 'D', new ItemStack(Items.diamond), + 'S', new ItemStack(Items.string)); + + //Solar Panel + if(ConfigValues.enableSolarRecipe) + GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceSolar), + "IBI", "BDB", "IBI", + 'D', new ItemStack(Blocks.diamond_block), + 'I', new ItemStack(Items.iron_ingot), + 'B', new ItemStack(Blocks.iron_bars)); + + //Heat Collector + if(ConfigValues.enableHeatCollectorRecipe) + GameRegistry.addRecipe(new ItemStack(InitBlocks.blockHeatCollector), + "BRB", "LDL", "BRB", + 'D', new ItemStack(Blocks.diamond_block), + 'R', new ItemStack(Items.repeater), + 'L', new ItemStack(Items.lava_bucket), + 'B', new ItemStack(Blocks.iron_bars)); //Quartz Pillar GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 176200aec..20f7ce775 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -7,6 +7,7 @@ import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.items.metalists.ThePotionRings; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; @@ -69,6 +70,9 @@ public class ItemCrafting{ if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()]) initMashedFoodRecipes(); + //Rings + initPotionRingRecipes(); + //Ingots from Dusts GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()), new ItemStack(Items.iron_ingot), 1F); @@ -89,6 +93,22 @@ public class ItemCrafting{ } + public static void initPotionRingRecipes(){ + GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()), + "IGI", "GDG", "IGI", + 'G', new ItemStack(Items.gold_ingot), + 'I', new ItemStack(Items.iron_ingot), + 'D', new ItemStack(Items.glowstone_dust)); + + for(int i = 0; i < ThePotionRings.values().length; i++){ + if(ConfigValues.enablePotionRingRecipes[i]){ + ItemStack mainStack = ThePotionRings.values()[i].craftingItem; + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, i), mainStack, mainStack, mainStack, mainStack, new ItemStack(Blocks.diamond_block), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())); + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, i), new ItemStack(InitItems.itemPotionRing, 1, i), new ItemStack(Items.nether_star)); + } + } + } + public static void initMashedFoodRecipes(){ for(Object nextIterator : Item.itemRegistry){ if(nextIterator instanceof ItemFood){ diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 7ab1eea9a..bc58317c8 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -32,6 +32,7 @@ public class CreativeTab extends CreativeTabs{ this.addBlock(InitBlocks.blockFurnaceDouble); this.addBlock(InitBlocks.blockFurnaceSolar); this.addBlock(InitBlocks.blockFishingNet); + this.addBlock(InitBlocks.blockHeatCollector); this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockFeeder); @@ -59,6 +60,9 @@ public class CreativeTab extends CreativeTabs{ this.addItem(InitItems.itemAxeObsidian); this.addItem(InitItems.itemShovelObsidian); this.addItem(InitItems.itemHoeObsidian); + + this.addItem(InitItems.itemPotionRing); + this.addItem(InitItems.itemPotionRingAdvanced); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java index 42fba23ef..12e46eb73 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -1,7 +1,7 @@ package ellpeck.actuallyadditions.event; +import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; import ellpeck.actuallyadditions.gadget.ModelStandardBlock; import ellpeck.actuallyadditions.gadget.ModelTorch; import ellpeck.actuallyadditions.gadget.RenderSpecial; @@ -11,35 +11,36 @@ import java.util.UUID; public class RenderPlayerEventAA{ - private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("ESD")); + private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("Ellpeck")); private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch()); - private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Derp")); - private RenderSpecial glenRender = new RenderSpecial(new ModelFurnaceSolar()); + private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Pakto")); + private RenderSpecial glenRender = new RenderSpecial(new ModelStandardBlock("Glenthor")); - @SubscribeEvent + @SubscribeEvent(priority = EventPriority.HIGHEST) public void RenderPlayerEvent(RenderPlayerEvent.Pre event){ - //Ellpeck - if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){ - ellpeckRender.render(0.3F, 1F); - return; - } + if(!event.entityPlayer.isInvisible()){ + //Ellpeck + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){ + ellpeckRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F); + return; + } - //Paktosan - if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){ - paktoRender.render(0.3F, 1F); - return; - } + //Paktosan + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){ + paktoRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F); + return; + } - //TwoOfEight - if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){ - glenRender.render(0.3F, 1F); - return; - } + //TwoOfEight + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){ + glenRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F); + return; + } - //dqmhose - if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ - hoseRender.render(0.5F, 1.25F); + //dqmhose + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ + hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.25F); + } } } - } diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java index 548328e4f..c9193955a 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java @@ -22,6 +22,6 @@ public class ModelTorch extends ModelBaseAA{ @Override public String getName(){ - return "modelTorch"; + return "modelHose"; } } diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java index 0addb0ada..cbcba3fdb 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -1,42 +1,55 @@ package ellpeck.actuallyadditions.gadget; import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; -import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; import org.lwjgl.opengl.GL11; public class RenderSpecial{ - private double bobbing; - private double rotation; + private double lastTimeForBobbing; ModelBaseAA theModel; ResourceLocation theTexture; public RenderSpecial(ModelBaseAA model){ this.theModel = model; - this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + (model instanceof ModelFurnaceSolar ? "" : "special/") + this.theModel.getName() + ".png"); + this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/special/" + this.theModel.getName() + ".png"); } - public void render(float size, float offsetUp){ + public void render(EntityPlayer player, float renderTick, float size, float offsetUp){ + int bobHeight = 70; + double rotationModifier = 3; - if(bobbing >= 0.5) bobbing = 0; - else bobbing+=0.01; - - if(rotation >= 360) rotation = 0; - else rotation+=1; + long time = player.worldObj.getTotalWorldTime(); + if(time-bobHeight >= lastTimeForBobbing){ + this.lastTimeForBobbing = time; + } GL11.glPushMatrix(); - GL11.glTranslatef(0F, offsetUp, 0F); + + if(player != Minecraft.getMinecraft().thePlayer){ + Vec3 clientPos = Minecraft.getMinecraft().thePlayer.getPosition(renderTick); + Vec3 playerPos = player.getPosition(renderTick); + GL11.glTranslated(playerPos.xCoord-clientPos.xCoord, playerPos.yCoord-clientPos.yCoord+1.6225, playerPos.zCoord-clientPos.zCoord); + } + + GL11.glTranslated(0F, offsetUp+0.15D, 0F); + GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); GL11.glScalef(size, size, size); - if(bobbing <= 0.25)GL11.glTranslated(0, bobbing, 0); - else GL11.glTranslated(0, 0.5 - bobbing, 0); + if(!(time-(bobHeight/2) < lastTimeForBobbing)){ + GL11.glTranslated(0, ((double)time-this.lastTimeForBobbing)/100, 0); + } + else{ + GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0); + } - GL11.glRotated(rotation, 0, 1, 0); + GL11.glRotated(time * rotationModifier, 0, 1, 0); Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); theModel.render(0.0625F); diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index f03124c42..4b6d7a67b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -22,6 +22,9 @@ public class InitItems{ public static Item itemLeafBlower; public static Item itemLeafBlowerAdvanced; + public static Item itemPotionRing; + public static Item itemPotionRingAdvanced; + public static Item itemPickaxeEmerald; public static Item itemAxeEmerald; public static Item itemShovelEmerald; @@ -64,6 +67,12 @@ public class InitItems{ itemLeafBlowerAdvanced = new ItemLeafBlower(true); ItemUtil.register(itemLeafBlowerAdvanced); + itemPotionRing = new ItemPotionRing(false); + ItemUtil.register(itemPotionRing); + + itemPotionRingAdvanced = new ItemPotionRing(true); + ItemUtil.register(itemPotionRingAdvanced); + itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare); itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare); itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java new file mode 100644 index 000000000..1b217d314 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java @@ -0,0 +1,121 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.metalists.ThePotionRings; +import ellpeck.actuallyadditions.util.*; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +import java.util.List; + +public class ItemPotionRing extends Item implements IName{ + + public static final ThePotionRings[] allRings = ThePotionRings.values(); + + private boolean isAdvanced; + + public ItemPotionRing(boolean isAdvanced){ + this.setHasSubtypes(true); + this.setMaxStackSize(1); + this.isAdvanced = isAdvanced; + } + + @Override + @SuppressWarnings("unchecked") + public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){ + super.onUpdate(stack, world, player, par4, par5); + + if(player instanceof EntityPlayer){ + EntityPlayer thePlayer = (EntityPlayer)player; + ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem(); + + ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()]; + if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){ + if(!((ItemPotionRing)stack.getItem()).isAdvanced){ + if(equippedStack != null && stack.isItemEqual(equippedStack)){ + thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true)); + } + } + else thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true)); + } + } + } + + @Override + public String getName(){ + return this.isAdvanced ? "itemPotionRingAdvanced" : "itemPotionRing"; + } + + @Override + public int getMetadata(int damage){ + return damage; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return allRings[stack.getItemDamage()].rarity; + } + + @SuppressWarnings("all") + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list){ + for(int j = 0; j < allRings.length; j++){ + list.add(new ItemStack(this, 1, j)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName() + allRings[stack.getItemDamage()].name; + } + + @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 + "." + this.getName() + ".desc.1")); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.2")); + if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){ + list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.1")); + list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.2")); + } + } + else list.add(ItemUtil.shiftForInfo()); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass){ + return this.itemIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass){ + return allRings[stack.getItemDamage()].color; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconReg){ + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + } + + @Override + public String getItemStackDisplayName(ItemStack stack){ + String standardName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"); + String name = allRings[stack.getItemDamage()].getName(); + String effect = StatCollector.translateToLocal("effect." + ModUtil.MOD_ID_LOWER + "." + name.substring(0, 1).toLowerCase() + name.substring(1) + ".name"); + return standardName + " " + effect; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java index 4ba6712e8..7e7c84d91 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java @@ -10,7 +10,8 @@ public enum TheMiscItems implements IName{ KNIFE_BLADE("KnifeBlade", EnumRarity.common), KNIFE_HANDLE("KnifeHandle", EnumRarity.common), DOUGH("Dough", EnumRarity.common), - QUARTZ("BlackQuartz", EnumRarity.epic); + QUARTZ("BlackQuartz", EnumRarity.epic), + RING("Ring", EnumRarity.uncommon); public final String name; public final EnumRarity rarity; diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java new file mode 100644 index 000000000..26cd4c2b6 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java @@ -0,0 +1,61 @@ +package ellpeck.actuallyadditions.items.metalists; + +import ellpeck.actuallyadditions.util.IName; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; + +public enum ThePotionRings implements IName{ + + SPEED("Speed", 8171462, 1, 0, 3, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)), + //TODO Slowness + HASTE("Haste", 14270531, 3, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)), + //TODO Mining Fatigue + STRENGTH("Strength", 9643043, 5, 0, 3, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)), + //Health (Not Happening) + //TODO Damage + JUMP_BOOST("JumpBoost", 7889559, 8, 0, 3, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)), + //TODO Nausea + REGEN("Regen", 13458603, 10, 0, 3, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)), + RESISTANCE("Resistance", 10044730, 11, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)), + FIRE_RESISTANCE("FireResistance", 14981690, 12, 0, 0, 10, false, EnumRarity.uncommon, new ItemStack(Items.magma_cream)), + WATER_BREATHING("WaterBreathing", 3035801, 13, 0, 0, 10, false, EnumRarity.rare, new ItemStack(Items.fish, 1, 3)), + INVISIBILITY("Invisibility", 8356754, 14, 0, 0, 10, false, EnumRarity.epic, new ItemStack(Items.fermented_spider_eye)), + //TODO Blindness + NIGHT_VISION("NightVision", 2039713, 16, 0, 0, 300, false, EnumRarity.rare, new ItemStack(Items.golden_carrot)), + //TODO Hunger + //TODO Weakness + //TODO Poison + //TODO Withering + //Health Boost (Not Happening) + //Absorption (Not Happening) + SATURATION("Saturation", 16262179, 23, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.cooked_beef)); + + public final String name; + public final int color; + public final EnumRarity rarity; + public final int effectID; + public final int normalAmplifier; + public final int advancedAmplifier; + public final int activeTime; + public final boolean needsWaitBeforeActivating; + public final ItemStack craftingItem; + + ThePotionRings(String name, int color, int effectID, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, EnumRarity rarity, ItemStack craftingItem){ + this.name = name; + this.color = color; + this.rarity = rarity; + this.effectID = effectID; + this.normalAmplifier = normalAmplifier; + this.advancedAmplifier = advancedAmplifier; + this.activeTime = activeTime; + this.needsWaitBeforeActivating = needsWaitBeforeActivating; + this.craftingItem = craftingItem; + } + + @Override + public String getName(){ + return this.name; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 41dc14b35..dfb3aac43 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -37,6 +37,7 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityInputter.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputter"); 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"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java index e58f9ec02..289440488 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -12,38 +12,42 @@ public class TileEntityFurnaceSolar extends TileEntityBase{ if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){ TileEntity tileBelow = TileEntityInputter.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord); - if(tileBelow instanceof TileEntityFurnace){ - TileEntityFurnace furnaceBelow = (TileEntityFurnace)tileBelow; - int burnTimeBefore = furnaceBelow.furnaceBurnTime; - furnaceBelow.furnaceBurnTime = 42; - furnaceBelow.currentItemBurnTime = 42; - if(burnTimeBefore == 0){ - BlockFurnace.updateFurnaceBlockState(true, this.worldObj, furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord); - } - return; - } + givePowerTo(tileBelow); + } + } + } - if(tileBelow instanceof TileEntityFurnaceDouble){ - TileEntityFurnaceDouble doubleBelow = (TileEntityFurnaceDouble)tileBelow; - int coalTimeBefore = doubleBelow.coalTime; - doubleBelow.coalTime = 42; - doubleBelow.coalTimeLeft = 42; - if(coalTimeBefore == 0){ - int metaBefore = worldObj.getBlockMetadata(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord); - worldObj.setBlockMetadataWithNotify(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord, metaBefore+4, 2); - } - return; - } + public static void givePowerTo(TileEntity tile){ + if(tile instanceof TileEntityFurnace){ + TileEntityFurnace furnaceBelow = (TileEntityFurnace)tile; + int burnTimeBefore = furnaceBelow.furnaceBurnTime; + furnaceBelow.furnaceBurnTime = 42; + furnaceBelow.currentItemBurnTime = 42; + if(burnTimeBefore == 0){ + BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord); + } + return; + } - if(tileBelow instanceof TileEntityGrinder){ - TileEntityGrinder grinderBelow = (TileEntityGrinder)tileBelow; - int coalTimeBefore = grinderBelow.coalTime; - grinderBelow.coalTime = 42; - grinderBelow.coalTimeLeft = 42; - if(coalTimeBefore == 0){ - worldObj.setBlockMetadataWithNotify(grinderBelow.xCoord, grinderBelow.yCoord, grinderBelow.zCoord, 1, 2); - } - } + 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/TileEntityHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java new file mode 100644 index 000000000..f1b5c3e98 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java @@ -0,0 +1,65 @@ +package ellpeck.actuallyadditions.tile; + +import ellpeck.actuallyadditions.config.ConfigValues; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.Random; + +public class TileEntityHeatCollector extends TileEntityBase{ + + private int randomChance = ConfigValues.heatCollectorRandomChance; + private int blocksNeeded = ConfigValues.heatCollectorBlocksNeeded; + + @Override + public void updateEntity(){ + if(!worldObj.isRemote){ + ArrayList blocksAround = new ArrayList(); + + for(int i = 1; i <= 5; i++){ + ChunkCoordinates coords = getBlockFromSide(i, xCoord, yCoord, zCoord); + if(coords != null){ + Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ); + if(block != null && block.getMaterial() == Material.lava && worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ) == 0){ + blocksAround.add(i); + } + } + } + + if(blocksAround.size() >= blocksNeeded){ + TileEntity tileAbove = TileEntityInputter.getTileEntityFromSide(0, worldObj, xCoord, yCoord, zCoord); + + TileEntityFurnaceSolar.givePowerTo(tileAbove); + + Random rand = new Random(); + if(rand.nextInt(randomChance) == 0){ + int randomSide = blocksAround.get(rand.nextInt(blocksAround.size())); + breakBlockAtSide(randomSide, worldObj, xCoord, yCoord, zCoord); + } + } + } + } + + public static ChunkCoordinates getBlockFromSide(int side, int x, int y, int z){ + if(side == 0) return new ChunkCoordinates(x, y + 1, z); + if(side == 1) return new ChunkCoordinates(x, y - 1, z); + if(side == 2) return new ChunkCoordinates(x, y, z - 1); + if(side == 3) return new ChunkCoordinates(x - 1, y, z); + if(side == 4) return new ChunkCoordinates(x, y, z + 1); + if(side == 5) return new ChunkCoordinates(x + 1, y, z); + else return null; + } + + public static void breakBlockAtSide(int side, World world, int x, int y, int z){ + if(side == 0) world.setBlockToAir(x, y + 1, z); + if(side == 1) world.setBlockToAir(x, y - 1, z); + if(side == 2) world.setBlockToAir(x, y, z - 1); + if(side == 3) world.setBlockToAir(x - 1, y, z); + if(side == 4) world.setBlockToAir(x, y, z + 1); + if(side == 5) world.setBlockToAir(x + 1, y, z); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 74892fe40..6be15ffe3 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.2.3"; + public static final String VERSION = "1.7.10-0.0.3.2"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/java/ellpeck/actuallyadditions/util/Util.java b/src/main/java/ellpeck/actuallyadditions/util/Util.java index 80f06406d..64e5b464a 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/Util.java +++ b/src/main/java/ellpeck/actuallyadditions/util/Util.java @@ -15,7 +15,7 @@ public class Util{ } public static void registerEvent(Object o){ - FMLCommonHandler.instance().bus().register(o); MinecraftForge.EVENT_BUS.register(o); + FMLCommonHandler.instance().bus().register(o); } } \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index fc171cbe9..b881c0a2a 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -13,6 +13,7 @@ tile.actuallyadditions.blockGrinderDouble.name=Double Crusher 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.blockInputter.name=ESD tile.actuallyadditions.blockInputter.add.0.name=Ellpeck's Slot Device @@ -36,6 +37,7 @@ item.actuallyadditions.itemMiscPaperCone.name=Paper Cone item.actuallyadditions.itemMiscKnifeBlade.name=Knife Blade item.actuallyadditions.itemMiscKnifeHandle.name=Knife Handle item.actuallyadditions.itemMiscBlackQuartz.name=Black Quartz +item.actuallyadditions.itemMiscRing.name=Ring item.actuallyadditions.itemLeafBlower.name=Leaf Blower item.actuallyadditions.itemLeafBlowerAdvanced.name=Advanced Leaf Blower @@ -69,6 +71,9 @@ item.actuallyadditions.itemFoodCarrotJuice.name=Carrot Juice item.actuallyadditions.itemFoodPumpkinStew.name=Pumpkin Stew item.actuallyadditions.itemFoodCheese.name=Cheese +item.actuallyadditions.itemPotionRing.name=Ring of +item.actuallyadditions.itemPotionRingAdvanced.name=Advanced Ring of + item.actuallyadditions.itemSpecialUnknownSubstance.name=Unknown Substance item.actuallyadditions.itemSpecialSolidifiedExperience.name=Solidified Experience item.actuallyadditions.itemSpecialBloodFragment.name=Blood Fragment @@ -113,6 +118,9 @@ tooltip.actuallyadditions.blockInputter.desc.4=-Side to Output to and Input from tooltip.actuallyadditions.blockInputter.desc.5=-Slot in the other Inventory to Output to and Input from tooltip.actuallyadditions.blockFishingNet.desc=Catches Fish automatically when placed above Water tooltip.actuallyadditions.blockFurnaceSolar.desc=Powers Furnaces and Crushers below it in Daylight +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.itemMiscMashedFood.desc=Used to make Fertilizer tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost. @@ -121,6 +129,15 @@ tooltip.actuallyadditions.itemMiscPaperCone.desc=Used to store foodstuffs! tooltip.actuallyadditions.itemMiscKnifeBlade.desc=Sharp like a tooth! A whale's tooth! tooltip.actuallyadditions.itemMiscKnifeHandle.desc=Fits comfortably in your hand. tooltip.actuallyadditions.itemMiscBlackQuartz.desc=Used in the Quartz Enchanter! +tooltip.actuallyadditions.itemMiscRing.desc=Used for crafting Effect Rings + +tooltip.actuallyadditions.itemPotionRing.desc.1=Gives Potion Effect of Level 1 +tooltip.actuallyadditions.itemPotionRing.desc.2=Needs to be held in Hand +tooltip.actuallyadditions.itemPotionRing.desc.off.1=Crafting Recipe of this particular Potion Effect is turned OFF by default +tooltip.actuallyadditions.itemPotionRing.desc.off.2=as it is extremely overpowered! Turn it on in the Config File if needed. + +tooltip.actuallyadditions.itemPotionRingAdvanced.desc.1=Gives Potion Effect of a High Level +tooltip.actuallyadditions.itemPotionRingAdvanced.desc.2=Can be anywhere in the Inventory tooltip.actuallyadditions.itemLeafBlower.desc.1=Destroys Grass and Flowers around you tooltip.actuallyadditions.itemLeafBlowerAdvanced.desc.1=Destroys Grass, Flowers and Leaves around you @@ -211,4 +228,16 @@ 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 \ No newline at end of file +info.actuallyadditions.gui.pull=Pull + +effect.actuallyadditions.speed.name=Speed +effect.actuallyadditions.haste.name=Haste +effect.actuallyadditions.strength.name=Strength +effect.actuallyadditions.jumpBoost.name=Jump Boost +effect.actuallyadditions.regen.name=Regeneration +effect.actuallyadditions.resistance.name=Resistance +effect.actuallyadditions.fireResistance.name=Fire Resistance +effect.actuallyadditions.waterBreathing.name=Water Breathing +effect.actuallyadditions.invisibility.name=Invisibility +effect.actuallyadditions.nightVision.name=Night Vision +effect.actuallyadditions.saturation.name=Saturation \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorBottom.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorBottom.png new file mode 100644 index 0000000000000000000000000000000000000000..4473aff9275af41e30e97a0a3b93f0777ecff904 GIT binary patch literal 377 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#KC_%48$a`H-7=t%Y-UJAiF1B#Zfaf$kjuc}T$GwvlA5AWo>`Ki;O^-gkfN8$ z4itay>EaloaenGV!@R==Jg)V+jEjyleN$V%(=%`4+3?r8M$g0|m-;%p1vaphBzRr# z65KMUW4-&w*RPXf!D0UP7HgTe~DWM4f20D@s literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorSide.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorSide.png new file mode 100644 index 0000000000000000000000000000000000000000..54c117a616439adaf9f05594bb1f3102e1c2269e GIT binary patch literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#KC>JnzwyHW&l5l)+02lL66gHf+|;}hAeVu`xhOTUBsE2$JhLQ2!QIn0AVn{g z9Vp)8>EaloasF+PA=eQHjyWs5d6t|n|1|y2e(p7!UKbrbD5O{3DDpC|E0N1RF#X0h z-_X!fnd5rPGMOe6mz5hEZ`R{5|7dQLG@$gP`m=Z2QzK{0?C8@`V#r#%c58>l zrYS*6O*5mjU9LzTaDN%?;q|i0>HVQIf{L$q$t7Pux?VPA-t+D)%Y^ghe`W2{Sg2CI RT`ULWU{6;+mvv4FO#mh3U^)N* literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorTop.png new file mode 100644 index 0000000000000000000000000000000000000000..068d3a908d73742a40026c39e503f1828dfe1d20 GIT binary patch literal 523 zcmV+m0`&cfP) zQK_>jopTVo5R$-9l`FW&%HE-7Nv0sYUL%cv!x`XxaQKI`+wDRKAq4OJRCHYjU>Js! zl8A`NRG1I~-mMUV``>Unom3S-N{N~0GyvzlpVNKcU*7EjEG&(sK3s2`XTsjx(D(h- z@7srPN51Qfhf0*V`v81Q1AasemKW zQXgeJuD8tGNFy&|=EG_;!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPVk-lnPW6yKyYOfu~3n4>4#n)=kQ$nksS#@OODr>fmTeoBQDS}vdeP2NJa zfq{ub0YpqV|6kC7fw79c!aktZk{xIu3|NR3GE1zsnQ${rGY%x?>FVdQ&MBb@09KAZ AM*si- literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFurnaceSolar.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFurnaceSolar.png new file mode 100644 index 0000000000000000000000000000000000000000..8f7871c3f1bb421b0931207479c0a9f49b6d3fe4 GIT binary patch literal 1146 zcmV-=1cm#FP)VGd000McNliru-vb^1Cl2MO!9)N61P4h( zK~!ko?U+Gp<3<$6e>2i3iCUU3kT0-3`4D3W&Ly|@QrJT2F*zisKq2&7v^W<-3;hI} zLNC4NVq2V1j}EN@#JaG-vdnfYrpPxI!zzup_cf-)Ek zY!Cz_N#d~Ka7e4wA_xKik|d$u@6&F#0m$diYwO;x!-61SdwW|f^8Nmz1_*+HFTeg7 zA=fbG36s7cy>4j+$Tya^dEc4@tU(A55Yy)#)@B%!AiXt;p`*11Kq=+=`B*7c z8s}|pyrqT!K$botWk{wUu~y>=Fxh)N^%-gM;IJ%>k$y<3AFxK(o}ktmr4&Mll3^wW z6z;j!`dK_+VFUF0eU!KZn|~$zcJ?E$zxf{0sf*3Q`u%?CWQ&_^G#ZRXqtb?(&8EYO z-msAOF1ouF0!Dd*iL3|)VA$>=9)@De+3IWIx2kh_fyOX}T zxdGtd;K1n_jYbZ8&Jb9b1cM+z2#L*}Fh;x0V$HNkOJte<87Ab&47q)*U#ENN9FQal znSO_mJ|HHonG&NH0@iuO1lz!v6l=9hW~yYDyZG$iMwGbXMUdcdIK<}`%m>U7-W2o1 zELJ4J{FIA?my=)-Z#J7;US5{wFP#JjgMt0(+h5$+Wbdb$;HycDNkx{%_}orNP$-1- z(NEDwN$~RWvZSZcXmEXfUGj$G<70Mqc9u(mb1f^U2@w_{)%4^g2m#h0qzkM z@X(!d?hQvrN6&Kd&zcF=XNM9YJfu`Jn2-wTZOo0~YDm;2N-u^4bGNTbnv9X&26jq# zo`6)pMS3CDXsp$9H&8s`ysx#c%?@8gB2+A8^XzbMZ?DAi=jZ3H94?l`b>qDBE#h_M zG_W`a30#LT=By}Z;C1rt33 zJ=4@yqf`b4CVNj8$B>G+x6{3|4m$|A)N;J9W%-{g)KSlUa+}ymrSJPsx#Z8_>N=rR zq2THyZnE~`iUp_cD(_U^TJb*aQq^9+(@%}wmhG0we_I@j5DaKWFurcEbV*iv|etIE#&)ZBmK1EXNq(WHsa$5L8MC6%L2ckDQ#{7309 zJBxCb-TdcecJt4_EZX^`#%k_9mhV?iJ-YI#n@9diUx%e!|H|CkCA;qysja)7oi*#( zXQ|?>%);y+u5J8#I#wu!F7)bH8q|JRas5dyp921mzyI2WZ=M#P@}r@EN!Z9?-r2NF ztGUk}NHK>96t9xYjXAAvRO4XdB+z2va_JPu`|ZUAYi*6vIR7%3{;9jq-BPU9x$wkB zMxVlMmWK~dkJsIQ|GSgZ50jGz%5`l_4s4c?m#UlsH2grfN2tpV9t9C+j^}?Sz5iZ) zZ}D5p<9isge*&Eq(#(~_aPe0SFLQ9n`q#U19M-Nsb^Qa-I~mTM3ukdGi3;gIFr~@1 z_S=JlE1!x>+9@zGv*dcJ3cA0jIjs;`4e@#iFXyA0O>PEh#|~{>UcD6*Qc*&R9ZzkN z8^Y91%N+dwC((5$`*xsDZTfCi{#pO|?dLu7WQ*&%^XET5swz|S+vfeV+s`Y_@7tZ< z{qtMpy|dfTf6m)iJFgt1a5hlUUF=Hg{?FuLVQO?x5a7T!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33J=4@yqf`b4rtO|C zjv*CsZ)cp%iV75IeQ(^M(4nAqUHU|~$&%bjVqGjznh{GBECkh?gb#LF6ux4fBIflX ze%8MhKC9Oo4%?l5_t)=y`jST)1 z#G5&4-AA3mR!?1XJ=^`5O>&=9*2M*P!`|ntQ)x#=>i?$e*?$s7xMfQDGipHTeo*^_{E=Wnh1xc>Rf$G-op&;GwHn7iG2 z1@EpICQ_e29nC-f=ySy5+!u;>uEdmu{|sw4PoH_m&T7)_Zsng7|1bF|z;wLv)&lO7 z^n!agKdrIqwXgkoe4^p`8H?L)E%0XtdxmG9<-|N6U+r``Gc(dO^(AMLgQc`nK%qda#0l`PYh*I!@C zFj;al$7}V~NhZFkr;RM_?8;Kk7(ZLFP>lCh>~;02UaqUIzB*>V#j}I$?Yh^w>>2YN ybNAMAWk_GR_WM7V1P@#D!2|Nn{1`ISV`@iy0XB4ude`@%$AjKtYKT*NBqf{Irtt#G+J&g2c?c61}|C5(N`I z13lB!R-;s)n(dx0jv*P&Z?7409dZz9dAPT=l`APRQBYKnySJl5Bcj87!$$_kEdn-8 ztsZaogyk7eGPwOy?}JgivA{nq&Npowt_<@S=ilbryoA$k9lwJ6%Nm))TlrU>vmVjU z*EQb%X!`bPGvmKsX8OH_J$vTQucxlf;E&n>6ncM}ZMCQPHKWh3e_JG2zB>?=R`>LJ z?$_1Pr_ZeabjQE_?W;fkx1agbWo{4DCYoP&%}7`f1_~8g!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPVk-l*+)s=-}z% z7*Y}Uc7|i$AqO6o=gDK%gIY}n?xIooEvP1$@kCq4h0jYG^0 zy|m3U=jNDgo_sc~Y}3uh3|kD6zp)zEIn`Zw;Pr~(%Lf>7*WUT=&o8bT#b@W*?*FYd zN76X(ma1m;J{48de%yjYXzpzs-n!-zcrWggDa@qd-KVL%7g(b0*HmSXx zG{rP?`jR!CyDJ!q)#g-A`}2 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiTorchBox.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiTorchBox.png new file mode 100644 index 0000000000000000000000000000000000000000..6712947b3b372e05eaf1ce6181edc287a647d19e GIT binary patch literal 1836 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP~62^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;uryEak-ar*5fL%+ig0*ZH# zbg?MxZ~bhOzBTG$pLA&G()WiHStiC_toFZN$`lY9YGmxh!BoKga-{~tjdsQ*xwk{6 zsjfOzaq+{p&Yn32-}+9o&Tl?GyIj2YOpk=Jq1%;4tAoFec+US|m(0PoO>TwOs#9lA zYkqq8rb@WdBA)*cL!Qyh6Gb~!j_uGr@r|prDLj#bO@eWTq^9b!%bLr)zEzxE*1q~V z&*t?Hn`O?VZ4S9^s^oOpQK$!8;-MT+OLG}_)Usv|~%rc^UqO%k1f`LL3C9V-A!TD(= z<%vb93~dIox?sjWt-KsCEOT^vI!{F50PwV$r)NjRpVz`0`8s(QH>q*eR~SuI3@U@Wm0X l1S!Xz!jjHQGZ`f$7?OQv9#i_X-x}x(22WQ%mvv4FO#pydc*Xz# literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemMiscRing.png b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscRing.png new file mode 100644 index 0000000000000000000000000000000000000000..4d27341ed89c1f2990c85a0fcbab3a08dc8b8ba3 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DkxL735kHCP2GC{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPVk-lnPYS>FMGa zV&Q*w;#pn?2a%R|RU!7?R|i~~_4vFNu)1cj2>(_+|6ZtbMoQB4+4*Iyf5TJf_1t?{ z8pGh6o_t^D+OM#SVl21BT7Sf~Fs9EuGcU4Z{Zhu|)i!lvI6;>1s;*b z3=Dh+K$tP>S|=w^P@=>&q9iy!t)x7$D3zfgF*C13FE6!3!9>qM&os5wC>5xt+0(@_ z#KQmV#M_(=20X5t|Fg+1kuK@^_wBmqD)B0XjO^Nm3WXap=4h|_J6*u(>(#vTjv7lt zF8mC-5a$vV^;P_tS%jLzmv3T!xb25wnzk@^>>UragSkNGFnGH9xvX!lvI6;>1s;*b z3=DkxL735kHCP2GC{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPVk-lnPX{&eO#) z#KM1R;7P&53IdBgW-S)5TEMff<}OobPG_W6(_?ZG%}mKXnh)00MkpO*7u{8{cF|e~Ze2#7dBPd%-e>-OcsFz3VWslTTeo=` zY-egH=I*}mPjAK6dE8a+^Y8bse=xu4xhPw1h3F0Y#+Ce;|7{yS9KXw|tJ=VIW5IXB ve+Rm@d3=#dwpQA_wB*+L2^S}Ca`e&6S3j3^P6 Date: Thu, 2 Apr 2015 12:06:42 +0200 Subject: [PATCH 3/3] 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