diff --git a/build.gradle b/build.gradle index e1df25fcd..861847365 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.3" 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/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/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/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 e504131d9..45e4b03ef 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -17,6 +17,8 @@ public class InitBlocks{ public static Block blockInputter; public static Block blockFishingNet; public static Block blockFurnaceSolar; + public static Block blockHeatCollector; + public static Block blockItemRepairer; public static void init(){ Util.logInfo("Initializing Blocks..."); @@ -50,5 +52,11 @@ public class InitBlocks{ blockFurnaceSolar = new BlockFurnaceSolar(); BlockUtil.register(blockFurnaceSolar, BlockFurnaceSolar.TheItemBlock.class); + + 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/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/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index 7b6ba2e6d..ee78813af 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -2,14 +2,18 @@ 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 enableLeafBlowerRecipe; + public static boolean enableLeafBlowerAdvancedRecipe; public static boolean enableCrusherRecipe; public static boolean enableCrusherDoubleRecipe; public static boolean enableFurnaceDoubleRecipe; @@ -17,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; @@ -61,13 +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 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){ @@ -77,6 +80,9 @@ 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"); + } 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"); @@ -101,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"); @@ -110,16 +117,20 @@ 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"); - 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"); + 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"); - 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"); + 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"); - 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"); + 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"); - itemKnifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with"); + 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"); + + 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"); @@ -138,5 +149,9 @@ 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"); + + 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, 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/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..bdc1bde90 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -28,10 +28,36 @@ 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)); + + //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), + "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..0a03afdb3 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -32,6 +32,8 @@ public class CreativeTab extends CreativeTabs{ this.addBlock(InitBlocks.blockFurnaceDouble); this.addBlock(InitBlocks.blockFurnaceSolar); this.addBlock(InitBlocks.blockFishingNet); + this.addBlock(InitBlocks.blockHeatCollector); + this.addBlock(InitBlocks.blockItemRepairer); this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockFeeder); @@ -59,6 +61,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 new file mode 100644 index 000000000..12e46eb73 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -0,0 +1,46 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +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("Ellpeck")); + private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch()); + private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Pakto")); + private RenderSpecial glenRender = new RenderSpecial(new ModelStandardBlock("Glenthor")); + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void RenderPlayerEvent(RenderPlayerEvent.Pre event){ + 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(event.entityPlayer, event.partialRenderTick, 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(event.entityPlayer, event.partialRenderTick, 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..c9193955a --- /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 "modelHose"; + } +} 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..bd81aa449 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -0,0 +1,59 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +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 lastTimeForBobbing; + + ModelBaseAA theModel; + ResourceLocation theTexture; + + public RenderSpecial(ModelBaseAA model){ + this.theModel = model; + this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/special/" + this.theModel.getName() + ".png"); + } + + public void render(EntityPlayer player, float renderTick, float size, float offsetUp){ + int bobHeight = 70; + double rotationModifier = 2; + + long time = player.worldObj.getTotalWorldTime(); + if(time-bobHeight >= lastTimeForBobbing){ + this.lastTimeForBobbing = time; + } + + GL11.glPushMatrix(); + + 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(!(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((double)time*rotationModifier, 0, 1, 0); + + Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); + theModel.render(0.0625F); + GL11.glPopMatrix(); + } + +} 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/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/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/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/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..."); } } 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 41dc14b35..47bdcbbc8 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -37,6 +37,8 @@ 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"); + 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 e58f9ec02..c17758a26 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -12,38 +12,29 @@ 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; - } - - 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); - } - } + 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; + furnaceBelow.furnaceBurnTime = 42; + furnaceBelow.currentItemBurnTime = 42; + if(burnTimeBefore == 0){ + BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord); } } } 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/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/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 74892fe40..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.2.3"; + 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/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..ba9638d5b 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -13,6 +13,8 @@ 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.blockItemRepairer.name=Item Repairer tile.actuallyadditions.blockInputter.name=ESD tile.actuallyadditions.blockInputter.add.0.name=Ellpeck's Slot Device @@ -36,6 +38,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 +72,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 +119,10 @@ 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.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. @@ -121,6 +131,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 +230,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 000000000..4473aff92 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorBottom.png differ 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 000000000..54c117a61 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorSide.png differ 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 000000000..068d3a908 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockHeatCollectorTop.png differ 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 000000000..4de84a0eb Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairer.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerBottom.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerBottom.png new file mode 100644 index 000000000..705b5b13c Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerBottom.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerOn.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerOn.png new file mode 100644 index 000000000..04b071e53 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerOn.png differ 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 000000000..c6e1d0f28 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFishingNet.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFishingNet.png new file mode 100644 index 000000000..57361be8e Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFishingNet.png differ 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 000000000..8f7871c3f Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelFurnaceSolar.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png new file mode 100644 index 000000000..cd769c4ca Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelGlenthor.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelGlenthor.png new file mode 100644 index 000000000..d037667fe Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelGlenthor.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelHose.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelHose.png new file mode 100644 index 000000000..0f3c64e7f Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelHose.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelPakto.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelPakto.png new file mode 100644 index 000000000..5e0bff016 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelPakto.png differ 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 000000000..a00a0fc68 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/guiRepairer.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png new file mode 100644 index 000000000..65503eabd Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png new file mode 100644 index 000000000..0f64f1940 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png differ 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 000000000..4d27341ed Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscRing.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRing.png b/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRing.png new file mode 100644 index 000000000..fb6271b76 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRing.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRingAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRingAdvanced.png new file mode 100644 index 000000000..cc344ca4b Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemPotionRingAdvanced.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 6ba8234b4..f7dcf1a26 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,15 +2,15 @@ { "modid": "ActuallyAdditions", "name": "Actually Additions", - "description": "A bunch of random stuff added to your Game to make it even more fun, exciting and add some more variety!", - "version": "0.0.2.3", + "description": "Actually Additions is a mod that adds a lot of Random Things and Gadgets to your Minecraft, including better Furnaces, Crushers that double your Ores, Automation, a bunch of food and lots more!", + "version": "0.0.3.3", "mcversion": "1.7.10", "url": "https://github.com/Ellpeck/ActuallyAdditions", "updateUrl": "", "authorList": [ "Ellpeck" ], - "credits": "GlenthorLP for all of the awesome Graphics", + "credits": "xdqmhose, GlenthorLP, Paktosan", "logoFile": "assets/actuallyadditions/textures/logo.png", "screenshots": [ ],