diff --git a/.gitignore b/.gitignore index 4bde66f5a..0791be672 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /.idea /*.iml /*.ipr -/*.iws \ No newline at end of file +/*.iws +/lib \ No newline at end of file diff --git a/build.gradle b/build.gradle index 861847365..4fc4b5d1f 100644 --- a/build.gradle +++ b/build.gradle @@ -16,18 +16,44 @@ buildscript { } apply plugin: 'forge' +apply plugin: 'maven' -version = "1.7.10-0.0.3.3" +version = "1.7.10-0.0.4.3" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" minecraft { - version = "1.7.10-10.13.2.1291" + version = "1.7.10-10.13.3.1395-1710ls" runDir = "idea" } -dependencies{ +repositories { + maven { + name "Mobius" + url "http://mobiusstrip.eu/maven" + } + maven { + name "ChickenBones" + url "http://chickenbones.net/maven/" + } +} +dependencies { + compile "mcp.mobius.waila:Waila:1.5.6_1.7.10" + + /*When Compiling from Github, you will need to have this file present + because InventoryTweaks doesn't have a Maven Repo. + But no one is going to download and compile this anyway, so it doesn't really matter. */ + compile files("lib/InventoryTweaks-api-1.58-147.jar") +} + +task copyChickenBones(type: Copy, dependsOn: "extractUserDev") { + from { configurations.compile } + include "**/*Chicken*.jar", "**/*NotEnoughItems*.jar" + exclude "**/CodeChickenLib*" + into file("./run/mods") + mustRunAfter "deobfBinJar" + mustRunAfter "repackMinecraft" } processResources{ @@ -38,7 +64,7 @@ processResources{ from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - expand 'version':project.version, 'mcversion':project.minecraft.version + expand 'update':project.version, 'mcversion':project.minecraft.version } from(sourceSets.main.resources.srcDirs) { diff --git a/newestVersion.txt b/newestVersion.txt new file mode 100644 index 000000000..d4ec1fbbc --- /dev/null +++ b/newestVersion.txt @@ -0,0 +1 @@ +1.7.10-0.0.4.3 \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index 90c9dddc2..d6d0604a6 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -5,6 +5,7 @@ import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import ellpeck.actuallyadditions.achievement.InitAchievements; @@ -13,12 +14,12 @@ import ellpeck.actuallyadditions.config.ConfigurationHandler; import ellpeck.actuallyadditions.crafting.GrinderCrafting; import ellpeck.actuallyadditions.crafting.InitCrafting; import ellpeck.actuallyadditions.event.InitEvents; +import ellpeck.actuallyadditions.gen.InitVillager; import ellpeck.actuallyadditions.gen.OreGen; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.material.InitItemMaterials; import ellpeck.actuallyadditions.network.PacketHandler; -import ellpeck.actuallyadditions.oredict.OreDictRegistry; import ellpeck.actuallyadditions.proxy.IProxy; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.util.ModUtil; @@ -42,7 +43,7 @@ public class ActuallyAdditions{ InitItemMaterials.init(); InitBlocks.init(); InitItems.init(); - OreDictRegistry.init(); + InitVillager.init(); proxy.preInit(); Util.logInfo("PreInitialization Finished."); @@ -59,6 +60,7 @@ public class ActuallyAdditions{ TileEntityBase.init(); InitEvents.init(); InitCrafting.init(); + FMLInterModComms.sendMessage("Waila", "register", "ellpeck.actuallyadditions.waila.WailaDataProvider.register"); proxy.init(); Util.logInfo("Initialization Finished."); diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index fbd8f76fd..44545e5e1 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -1,13 +1,8 @@ --Redstone Control for the ESD - -Quartz Enchanter -Lets you enchant Tools with Black Quartz -Doesn't use Levels -Needs Quartz and Diamond Blocks instead of Bookcases around --Advanced ESD - -Has a Filter - -Instant Teleport Device -Teleports Players to where they look (Much like the Bukkit Compass) @@ -30,10 +25,6 @@ -Has a Recipe saved -Crafts Recipe on Shift-Right-Click if all Items are in Inventory --Repair Station - -Powered by Coal - -Repairs Items slowly - -TNT Arrows -Teleport Arrows @@ -58,5 +49,15 @@ -Decorative Lead -Can be placed between two Fences for Decoration --Greenhouse Glass - -Gives Plants below more Growth Ticks \ No newline at end of file +-Crafting Table Minecart +-Anvil Minecart +-Dropper Minecart +-Super Speed Track + +-File Jukebox + -Plays Sound Files put into your Minecraft Folder + +-RF Implementation + -Power Acceptor Block that powers Machines + -Machines still don't accept RF themselves! + -Solar Panel & Heat Collector produce RF \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java b/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java deleted file mode 100644 index 07642d0c4..000000000 --- a/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java +++ /dev/null @@ -1,15 +0,0 @@ -package ellpeck.actuallyadditions.achievement; - -import ellpeck.actuallyadditions.util.ModUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; - -public class AchievementAA extends Achievement{ - - public AchievementAA(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){ - super("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore); - /*InitAchievements.achievementList.add(this); - if(hasToHaveBefore == null) this.initIndependentStat(); - this.registerStat();*/ - } -} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java index 41fa1f9d6..0e1ef4c02 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java @@ -1,48 +1,31 @@ package ellpeck.actuallyadditions.achievement; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.stats.Achievement; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.AchievementPage; + +import java.util.ArrayList; + public class InitAchievements{ - /*public static AchievementPage theAchievementPage; + public static final int CRAFTING_ACH = 0; + public static final int SMELTING_ACH = 1; + public static final int PICKUP_ACH = 2; + + public static AchievementPage theAchievementPage; public static ArrayList achievementList = new ArrayList(); - public static Achievement achievementCraftKnifeBlade; - public static Achievement achievementCraftKnife; - - public static Achievement achievementCraftDough; - public static Achievement achievementSmeltBaguette; - public static Achievement achievementCraftSubSandwich; - - public static Achievement achievementCraftMashedFood; - public static Achievement achievementCraftCompost; - public static Achievement achievementCraftFertilizer; - - public static Achievement achievementCraftPaperCone; - public static Achievement achievementCraftFrenchFry; - public static Achievement achievementCraftFrenchFries; - public static Achievement achievementCraftFishNChips;*/ - public static void init(){ - /*Util.logInfo("Initializing Achievements..."); - - achievementCraftKnifeBlade = new AchievementAA("craftKnifeBlade", -2, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null); - achievementCraftKnife = new AchievementAA("craftKnife", 0, 0, new ItemStack(InitItems.itemKnife), achievementCraftKnifeBlade); - - achievementCraftDough = new AchievementAA("craftDough", 0, -3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), achievementCraftKnife); - achievementSmeltBaguette = new AchievementAA("smeltBaguette", 2, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), achievementCraftDough); - achievementCraftSubSandwich = new AchievementAA("craftSubSandwich", 4, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), achievementSmeltBaguette); - - achievementCraftMashedFood = new AchievementAA("craftMashedFood", 3, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), achievementCraftKnife); - achievementCraftCompost = new AchievementAA("craftCompost", 5, 0, new ItemStack(InitBlocks.blockCompost), achievementCraftMashedFood); - achievementCraftFertilizer = new AchievementAA("craftFertilizer", 7, 0, new ItemStack(InitItems.itemFertilizer), achievementCraftCompost); - - achievementCraftPaperCone = new AchievementAA("craftPaperCone", 0, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), achievementCraftKnife); - achievementCraftFrenchFry = new AchievementAA("craftFrenchFry", 2, 3, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()), achievementCraftPaperCone); - achievementCraftFrenchFries = new AchievementAA("craftFrenchFries", 4, 4, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), achievementCraftFrenchFry); - achievementCraftFishNChips = new AchievementAA("craftFishNChips", 4, 2, new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), achievementCraftFrenchFry); + Util.logInfo("Initializing Achievements..."); + for(int i = 0; i < TheAchievements.values().length; i++){ + achievementList.add(TheAchievements.values()[i].ach); + } theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()])); - AchievementPage.registerAchievementPage(theAchievementPage);*/ + AchievementPage.registerAchievementPage(theAchievementPage); } } diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java new file mode 100644 index 000000000..d2e577f6d --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java @@ -0,0 +1,41 @@ +package ellpeck.actuallyadditions.achievement; + +import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; +import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.Achievement; + +public enum TheAchievements{ + + //Special Stuff Path + PICK_UP_XP("pickUpSolidXP", 0, 0, new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()), null, InitAchievements.PICKUP_ACH), + + //Food & Fertilizer Path + CRAFT_KNIFE_BLADE("craftKnifeBlade", 0, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null), + CRAFT_KNIFE("craftKnife", 2, 2, new ItemStack(InitItems.itemKnife), CRAFT_KNIFE_BLADE.ach), + CRAFT_MASHED_FOOD("craftMashedFood", 4, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), CRAFT_KNIFE.ach), + + //Machine Path + CRAFT_WOODEN_CASE("craftWoodenCasing", 0, -3, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), null), + CRAFT_STONE_CASE("craftStoneCasing", 2, -4, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), CRAFT_WOODEN_CASE.ach), + CRAFT_COIL("craftBasicCoil", 2, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), CRAFT_WOODEN_CASE.ach), + CRAFT_ADVANCED_COIL("craftAdvancedCoil", 4, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), CRAFT_COIL.ach); + + public final Achievement ach; + public final int type; + + TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){ + this.ach = new Achievement("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore); + if(hasToHaveBefore == null) this.ach.initIndependentStat(); + this.ach.registerStat(); + this.type = type; + } + + TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){ + this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.CRAFTING_ACH); + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java new file mode 100644 index 000000000..e46eb1296 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java @@ -0,0 +1,135 @@ +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.TileEntityBreaker; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +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.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.List; + +public class BlockBreaker extends BlockContainerBase implements INameableItem{ + + private IIcon frontIcon; + private IIcon topIcon; + + private boolean isPlacer; + + public BlockBreaker(boolean isPlacer){ + super(Material.rock); + this.isPlacer = isPlacer; + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ + int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player); + world.setBlockMetadataWithNotify(x, y, z, rotation, 2); + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker(); + } + + @Override + public IIcon getIcon(int side, int meta){ + if(side == 0 || side == 1) return this.topIcon; + if(side == 3) return this.frontIcon; + return this.blockIcon; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ + int meta = world.getBlockMetadata(x, y, z); + if(side != meta && (side == 0 || side == 1)) return this.topIcon; + if(side == meta) return this.frontIcon; + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + } + + @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){ + TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z); + if (breaker != null) player.openGui(ActuallyAdditions.instance, GuiHandler.BREAKER_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 this.isPlacer ? "blockPlacer" : "blockBreaker"; + } + + 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) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java new file mode 100644 index 000000000..af10c8998 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -0,0 +1,119 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +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.world.World; + +import java.util.List; + +public class BlockCoffeeMachine extends BlockContainerBase implements INameableItem{ + + public BlockCoffeeMachine(){ + super(Material.wood); + this.setHarvestLevel("axe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeWood); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){ + if(!world.isRemote){ + + } + return true; + } + + @Override + public IIcon getIcon(int side, int metadata){ + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = Blocks.hopper.getIcon(0, 0); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @Override + public int getRenderType(){ + return RenderingRegistry.getNextAvailableRenderId(); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta){ + return null; + } + + @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 "blockCoffeeMachine"; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.uncommon; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index a146016b4..ec518b1c4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -3,15 +3,13 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.items.ItemFertilizer; import ellpeck.actuallyadditions.items.ItemMisc; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.tile.TileEntityCompost; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; -import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,12 +22,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import java.util.List; -public class BlockCompost extends BlockContainerBase implements IName{ +public class BlockCompost extends BlockContainerBase implements INameableItem{ public BlockCompost(){ super(Material.wood); @@ -44,7 +41,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.compostAmountNeededToConvert))){ + 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 < ConfigIntValues.COMPOST_AMOUNT.getValue()))){ 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--; @@ -125,6 +122,11 @@ public class BlockCompost extends BlockContainerBase implements IName{ return "blockCompost"; } + @Override + public String getOredictName(){ + return this.getName(); + } + public static class TheItemBlock extends ItemBlock{ private Block theBlock; @@ -150,12 +152,7 @@ public class BlockCompost extends BlockContainerBase implements IName{ @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.1")); - //TODO Remove second info - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.2")); - } - else list.add(ItemUtil.shiftForInfo()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java new file mode 100644 index 000000000..7779a84eb --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.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.TileEntityDropper; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +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.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.List; + +public class BlockDropper extends BlockContainerBase implements INameableItem{ + + private IIcon frontIcon; + private IIcon topIcon; + + public BlockDropper(){ + super(Material.rock); + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ + int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player); + world.setBlockMetadataWithNotify(x, y, z, rotation, 2); + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return new TileEntityDropper(); + } + + @Override + public IIcon getIcon(int side, int meta){ + if(side == 0 || side == 1) return this.topIcon; + if(side == 3) return this.frontIcon; + return this.blockIcon; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ + int meta = world.getBlockMetadata(x, y, z); + if(side != meta && (side == 0 || side == 1)) return this.topIcon; + if(side == meta) return this.frontIcon; + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + } + + @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){ + TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(x, y, z); + if (dropper != null) player.openGui(ActuallyAdditions.instance, GuiHandler.DROPPER_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 "blockDropper"; + } + + 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) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java index 7ea42f5f3..e135def6d 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java @@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFeeder; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,20 +17,24 @@ 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 BlockFeeder extends BlockContainerBase implements IName{ +public class BlockFeeder extends BlockContainerBase implements INameableItem{ private IIcon topIcon; public BlockFeeder(){ - super(Material.wood); - this.setHarvestLevel("axe", 0); + super(Material.rock); + this.setHarvestLevel("pickaxe", 0); this.setHardness(1.0F); - this.setStepSound(soundTypeWood); + this.setStepSound(soundTypeStone); + } + + @Override + public String getOredictName(){ + return this.getName(); } @Override @@ -97,8 +100,7 @@ public class BlockFeeder extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java index 3431050ca..d6cd5edcd 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java @@ -4,10 +4,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; -import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,12 +16,11 @@ 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 BlockFishingNet extends BlockContainerBase implements IName{ +public class BlockFishingNet extends BlockContainerBase implements INameableItem{ public BlockFishingNet(){ super(Material.wood); @@ -33,6 +30,11 @@ public class BlockFishingNet extends BlockContainerBase implements IName{ this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F); } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityFishingNet(); @@ -94,8 +96,7 @@ public class BlockFishingNet extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index 1cf568b08..bee306682 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -20,14 +19,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -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 BlockFurnaceDouble extends BlockContainerBase implements IName{ +public class BlockFurnaceDouble extends BlockContainerBase implements INameableItem{ private IIcon topIcon; private IIcon onIcon; @@ -42,23 +40,8 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{ } @Override - public void onBlockAdded(World world, int x, int y, int z){ - super.onBlockAdded(world, x, y, z); - - if (!world.isRemote){ - Block block1 = world.getBlock(x, y, z-1); - Block block2 = world.getBlock(x, y, z+1); - Block block3 = world.getBlock(x-1, y, z); - Block block4 = world.getBlock(x+1, y, z); - - int metaToSet = 1; - if (block1.func_149730_j() && !block2.func_149730_j()) metaToSet = 0; - if (block2.func_149730_j() && !block1.func_149730_j()) metaToSet = 1; - if (block3.func_149730_j() && !block4.func_149730_j()) metaToSet = 2; - if (block4.func_149730_j() && !block3.func_149730_j()) metaToSet = 3; - - world.setBlockMetadataWithNotify(x, y, z, metaToSet, 2); - } + public String getOredictName(){ + return this.getName(); } @Override @@ -83,6 +66,14 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{ @Override public IIcon getIcon(int side, int meta){ + if(side == 1) return this.topIcon; + if(side == 3) return this.frontIcon; + return this.blockIcon; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ + int meta = world.getBlockMetadata(x, y, z); if(side == 1) return this.topIcon; if(side == meta+2 && meta <= 3) return this.frontIcon; else if(side == meta-2 && meta > 3) return this.onIcon; @@ -179,8 +170,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java index f38b339db..3f3e8cf14 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java @@ -4,10 +4,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; -import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,12 +16,11 @@ 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 BlockFurnaceSolar extends BlockContainerBase implements IName{ +public class BlockFurnaceSolar extends BlockContainerBase implements INameableItem{ public BlockFurnaceSolar(){ super(Material.wood); @@ -33,6 +30,11 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IName{ this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F); } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityFurnaceSolar(); @@ -94,8 +96,7 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java index 6d3a0a7c9..509dca6fe 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java @@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,14 +17,14 @@ 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 BlockGiantChest extends BlockContainerBase implements IName{ +public class BlockGiantChest extends BlockContainerBase implements INameableItem{ private IIcon topIcon; + private IIcon bottomIcon; public BlockGiantChest(){ super(Material.wood); @@ -34,6 +33,11 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ this.setStepSound(soundTypeWood); } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityGiantChest(); @@ -41,7 +45,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ @Override public IIcon getIcon(int side, int metadata){ - return side == 1 ? this.topIcon : this.blockIcon; + return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon); } @Override @@ -49,6 +53,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ 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.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom"); } @Override @@ -97,8 +102,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java new file mode 100644 index 000000000..60f0291cf --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java @@ -0,0 +1,115 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Facing; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.List; + +public class BlockGreenhouseGlass extends BlockContainerBase implements INameableItem{ + + public BlockGreenhouseGlass(){ + super(Material.rock); + this.setHarvestLevel("pickaxe", 0); + this.setHardness(1.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass(){ + return 0; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return new TileEntityGreenhouseGlass(); + } + + @Override + public IIcon getIcon(int side, int metadata){ + return this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + } + + @Override + public String getName(){ + return "blockGreenhouseGlass"; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta){ + return world.getBlockMetadata(x, y, z) != world.getBlockMetadata(x-Facing.offsetsXForSide[meta], y-Facing.offsetsYForSide[meta], z-Facing.offsetsZForSide[meta]) || (world.getBlock(x, y, z) != this && super.shouldSideBeRendered(world, x, y, z, meta)); + + } + + 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) { + BlockUtil.addInformation(theBlock, list, 1, ""); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index c7dc6c77e..63b653816 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGrinder; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,14 +17,13 @@ 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 BlockGrinder extends BlockContainerBase implements IName{ +public class BlockGrinder extends BlockContainerBase implements INameableItem{ private IIcon topIcon; private IIcon onIcon; @@ -44,7 +42,7 @@ public class BlockGrinder extends BlockContainerBase implements IName{ @Override public TileEntity createNewTileEntity(World world, int par2){ - return new TileEntityGrinder(this.isDouble); + return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder(); } @Override @@ -94,6 +92,11 @@ public class BlockGrinder extends BlockContainerBase implements IName{ return true; } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public void breakBlock(World world, int x, int y, int z, Block block, int par6){ this.dropInventory(world, x, y, z); @@ -130,12 +133,7 @@ public class BlockGrinder extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(KeyUtil.isShiftPressed()){ - for(int i = 0; i < (((BlockGrinder)theBlock).isDouble ? 3 : 4); i++){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i+1))); - } - } - else list.add(ItemUtil.shiftForInfo()); + BlockUtil.addInformation(theBlock, list, ((BlockGrinder)theBlock).isDouble ? 3 : 4, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java index d36d826c0..6d12ce546 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java @@ -3,9 +3,8 @@ 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.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -16,12 +15,11 @@ 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{ +public class BlockHeatCollector extends BlockContainerBase implements INameableItem{ private IIcon topIcon; private IIcon bottomIcon; @@ -33,6 +31,11 @@ public class BlockHeatCollector extends BlockContainerBase implements IName{ this.setStepSound(soundTypeStone); } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityHeatCollector(); @@ -81,12 +84,7 @@ public class BlockHeatCollector extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 3, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 7bfe8a6d9..5f9495cde 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -21,21 +21,29 @@ import net.minecraft.world.World; import java.util.List; import java.util.Random; -public class BlockInputter extends BlockContainerBase implements IName{ +public class BlockInputter extends BlockContainerBase implements INameableItem{ - public static final int NAME_FLAVOUR_AMOUNTS = 12; + public static final int NAME_FLAVOUR_AMOUNTS = 15; - public BlockInputter(){ + public boolean isAdvanced; + + public BlockInputter(boolean isAdvanced){ super(Material.rock); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.0F); this.setStepSound(soundTypeStone); this.setTickRandomly(true); + this.isAdvanced = isAdvanced; + } + + @Override + public String getOredictName(){ + return this.getName(); } @Override public TileEntity createNewTileEntity(World world, int par2){ - return new TileEntityInputter(); + return this.isAdvanced ? new TileEntityInputter.TileEntityInputterAdvanced() : new TileEntityInputter(); } @Override @@ -53,7 +61,7 @@ public class BlockInputter extends BlockContainerBase implements IName{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z); - if (inputter != null) player.openGui(ActuallyAdditions.instance, GuiHandler.INPUTTER_ID, world, x, y, z); + if (inputter != null) player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.INPUTTER_ADVANCED_ID : GuiHandler.INPUTTER_ID, world, x, y, z); return true; } return true; @@ -67,7 +75,7 @@ public class BlockInputter extends BlockContainerBase implements IName{ @Override public String getName(){ - return "blockInputter"; + return this.isAdvanced ? "blockInputterAdvanced" : "blockInputter"; } public static class TheItemBlock extends ItemBlock{ @@ -86,7 +94,7 @@ public class BlockInputter extends BlockContainerBase implements IName{ @Override public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.rare; + return ((BlockInputter)theBlock).isAdvanced ? EnumRarity.epic : EnumRarity.rare; } @Override @@ -96,10 +104,10 @@ public class BlockInputter extends BlockContainerBase implements IName{ if(this.lastSysTime+5000 < sysTime){ this.lastSysTime = sysTime; - this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS+1); + this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS)+1; } - return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name") + " (" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".add." + this.toPick + ".name") + ")"; + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name") + " (" + StatCollector.translateToLocal("tile." + ModUtil.MOD_ID_LOWER + ".blockInputter.add." + this.toPick + ".name") + ")"; } @Override @@ -112,10 +120,11 @@ public class BlockInputter extends BlockContainerBase implements IName{ @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY)); - for(int i = 1; i < 5; i++){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1))); + list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY)); + for(int i = 1; i < 6; i++){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + (i + 1))); } + if((((BlockInputter)theBlock).isAdvanced)) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)theBlock).getName() + ".desc")); } else list.add(ItemUtil.shiftForInfo()); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 23a1a4b5e..0b41e06d8 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -5,9 +5,8 @@ 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.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,14 +17,13 @@ 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{ +public class BlockItemRepairer extends BlockContainerBase implements INameableItem{ private IIcon topIcon; private IIcon onIcon; @@ -39,6 +37,11 @@ public class BlockItemRepairer extends BlockContainerBase implements IName{ this.setTickRandomly(true); } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityItemRepairer(); @@ -118,10 +121,7 @@ public class BlockItemRepairer extends BlockContainerBase implements IName{ @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()); + BlockUtil.addInformation(theBlock, list, 1, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java index d04ae3cc7..1bb1a2594 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java @@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,19 +16,18 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import java.util.List; -public class BlockMisc extends Block implements IName{ +public class BlockMisc extends Block implements INameableItem{ public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values(); public IIcon[] textures = new IIcon[allMiscBlocks.length]; public BlockMisc(){ super(Material.rock); - this.setHarvestLevel("pickaxe", 0); - this.setHardness(1.0F); + this.setHardness(1.5F); + this.setHarvestLevel("pickaxe", 1); } @SuppressWarnings("all") @@ -63,6 +61,11 @@ public class BlockMisc extends Block implements IName{ return "blockMisc"; } + @Override + public String getOredictName(){ + return ""; + } + public static class TheItemBlock extends ItemBlock{ private Block theBlock; @@ -88,8 +91,7 @@ public class BlockMisc extends Block implements IName{ @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() + allMiscBlocks[stack.getItemDamage()].getName() + ".desc")); - else list.add(ItemUtil.shiftForInfo()); + BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 45e4b03ef..40b45453e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -15,10 +15,16 @@ public class InitBlocks{ public static Block blockGrinderDouble; public static Block blockFurnaceDouble; public static Block blockInputter; + public static Block blockInputterAdvanced; public static Block blockFishingNet; public static Block blockFurnaceSolar; public static Block blockHeatCollector; public static Block blockItemRepairer; + public static Block blockGreenhouseGlass; + + public static Block blockBreaker; + public static Block blockPlacer; + public static Block blockDropper; public static void init(){ Util.logInfo("Initializing Blocks..."); @@ -27,7 +33,7 @@ public class InitBlocks{ BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class); blockMisc = new BlockMisc(); - BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class); + BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class, BlockMisc.allMiscBlocks); blockFeeder = new BlockFeeder(); BlockUtil.register(blockFeeder, BlockFeeder.TheItemBlock.class); @@ -44,9 +50,12 @@ public class InitBlocks{ blockFurnaceDouble = new BlockFurnaceDouble(); BlockUtil.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class); - blockInputter = new BlockInputter(); + blockInputter = new BlockInputter(false); BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class); + blockInputterAdvanced = new BlockInputter(true); + BlockUtil.register(blockInputterAdvanced, BlockInputter.TheItemBlock.class); + blockFishingNet = new BlockFishingNet(); BlockUtil.register(blockFishingNet, BlockFishingNet.TheItemBlock.class); @@ -58,5 +67,17 @@ public class InitBlocks{ blockItemRepairer = new BlockItemRepairer(); BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class); + + blockGreenhouseGlass = new BlockGreenhouseGlass(); + BlockUtil.register(blockGreenhouseGlass, BlockGreenhouseGlass.TheItemBlock.class); + + blockBreaker = new BlockBreaker(false); + BlockUtil.register(blockBreaker, BlockBreaker.TheItemBlock.class); + + blockPlacer = new BlockBreaker(true); + BlockUtil.register(blockPlacer, BlockBreaker.TheItemBlock.class); + + blockDropper = new BlockDropper(); + BlockUtil.register(blockDropper, BlockDropper.TheItemBlock.class); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java index 43e4e64a7..d2c2dcdb3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java @@ -1,25 +1,34 @@ package ellpeck.actuallyadditions.blocks.metalists; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.item.EnumRarity; -public enum TheMiscBlocks implements IName{ +public enum TheMiscBlocks implements INameableItem{ - QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare), - QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare), - QUARTZ("BlackQuartz", EnumRarity.rare), - ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic); + QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare, "blockQuartzBlack"), + QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare, "blockQuartzBlack"), + QUARTZ("BlackQuartz", EnumRarity.rare, "blockQuartzBlack"), + ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic, "oreQuartzBlack"), + WOOD_CASING("WoodCasing", EnumRarity.common, "blockCasingWood"), + STONE_CASING("StoneCasing", EnumRarity.uncommon, "blockCasingStone"); public final String name; + public final String oredictName; public final EnumRarity rarity; - TheMiscBlocks(String name, EnumRarity rarity){ + TheMiscBlocks(String name, EnumRarity rarity, String oredictName){ this.name = name; this.rarity = rarity; + this.oredictName = oredictName; } @Override public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java index ac84d2e22..6dfc64af0 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.blocks.render; +import ellpeck.actuallyadditions.tile.TileEntityCompost; import net.minecraft.client.model.ModelRenderer; public class ModelCompost extends ModelBaseAA{ @@ -9,10 +10,12 @@ public class ModelCompost extends ModelBaseAA{ public ModelRenderer wallTwo; public ModelRenderer wallThree; public ModelRenderer wallFour; + public ModelRenderer[] innerRawList = new ModelRenderer[13]; + public ModelRenderer innerDone; public ModelCompost(){ this.textureWidth = 64; - this.textureHeight = 64; + this.textureHeight = 128; this.wallThree = new ModelRenderer(this, 0, 0); this.wallThree.setRotationPoint(-6.0F, 8.0F, 6.0F); this.wallThree.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F); @@ -28,6 +31,29 @@ public class ModelCompost extends ModelBaseAA{ this.floor = new ModelRenderer(this, 0, 0); this.floor.setRotationPoint(-7.0F, 23.0F, -7.0F); this.floor.addBox(0.0F, 0.0F, 0.0F, 14, 1, 14, 0.0F); + + for(int i = 0; i < this.innerRawList.length; i++){ + this.innerRawList[i] = new ModelRenderer(this, 0, 29); + this.innerRawList[i].setRotationPoint(-6.0F, 10.0F, -6.0F); + this.innerRawList[i].addBox(0.0F, 12-i, 0.0F, 12, i+1, 12, 0.0F); + } + + this.innerDone = new ModelRenderer(this, 0, 54); + this.innerDone.setRotationPoint(-6.0F, 10.0F, -6.0F); + this.innerDone.addBox(0.0F, 0.0F, 0.0F, 12, 13, 12, 0.0F); + } + + public void renderExtra(float f, TileEntityCompost tile){ + int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); + if(meta > 0 && meta <= tile.amountNeededToConvert){ + int heightToDisplay = meta*13/tile.amountNeededToConvert; + if(heightToDisplay > 13) heightToDisplay = 13; + + this.innerRawList[heightToDisplay-1].render(f); + } + if(meta == tile.amountNeededToConvert+1){ + this.innerDone.render(f); + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java index 1d4ddb04a..b500f1088 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.blocks.render; +import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -17,11 +18,14 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{ @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){ GL11.glPushMatrix(); - GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F); + GL11.glTranslatef((float)x + 0.5F, (float)y - 0.5F, (float)z + 0.5F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -2.0F, 0.0F); this.bindTexture(new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png")); theModel.render(0.0625F); + + if(tile instanceof TileEntityCompost && theModel instanceof ModelCompost) ((ModelCompost)theModel).renderExtra(0.0625F, (TileEntityCompost)tile); + GL11.glPopMatrix(); } diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java new file mode 100644 index 000000000..eab30ea58 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java @@ -0,0 +1,21 @@ +package ellpeck.actuallyadditions.config; + +public enum ConfigCategories{ + + FOOD_CRAFTING("food crafting"), + MISC_CRAFTING("misc crafting"), + BLOCKS_CRAFTING("block crafting"), + ITEMS_CRAFTING("item crafting"), + TOOL_VALUES("tool values"), + MACHINE_VALUES("machine values"), + MOB_DROPS("mob drops"), + WORLD_GEN("world gen"), + POTION_RING_CRAFTING("ring crafting"), + OTHER("other"); + + public final String name; + + ConfigCategories(String name){ + this.name = name; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index ee78813af..731e7c82e 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -1,157 +1,45 @@ package ellpeck.actuallyadditions.config; -import ellpeck.actuallyadditions.items.metalists.TheFoods; -import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.items.metalists.ThePotionRings; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; +import ellpeck.actuallyadditions.config.values.ConfigFloatValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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; - public static boolean enableGiantChestRecipe; - public static boolean enableFeederRecipe; - public static boolean enableCrafterRecipe; - public static boolean enableInputterRecipe; - public static boolean enableRepairerRecipe; - public static boolean enableSolarRecipe; - public static boolean enableFishingNetRecipe; - public static boolean enableHeatCollectorRecipe; - public static boolean enableToolEmeraldRecipe; - public static boolean enableToolObsidianRecipe; + public static ConfigCrafting[] craftingConfig = ConfigCrafting.values(); + public static boolean[] craftingValues = new boolean[craftingConfig.length]; - 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 ConfigIntValues[] intConfig = ConfigIntValues.values(); + public static int[] intValues = new int[intConfig.length]; - 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 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 ConfigFloatValues[] floatConfig = ConfigFloatValues.values(); + public static float[] floatValues = new float[floatConfig.length]; - public static boolean generateBlackQuartz; - public static int blackQuartzBaseAmount; - public static int blackQuartzAdditionalChance; - public static int blackQuartzChance; - public static int blackQuartzMinHeight; - public static int blackQuartzMaxHeight; - - 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 ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); + public static boolean[] boolValues = new boolean[boolConfig.length]; public static void defineConfigValues(Configuration config){ - for(int i = 0; i < enabledFoodRecipes.length; i++){ - enabledFoodRecipes[i] = config.getBoolean(TheFoods.values()[i].name, ConfigurationHandler.CATEGORY_FOOD_CRAFTING, true, "If the Crafting Recipe for " + TheFoods.values()[i].name + " is Enabled"); - } - 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"); + for(int i = 0; i < craftingValues.length; i++){ + ConfigCrafting currConf = craftingConfig[i]; + craftingValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the " + currConf.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"); - leafBlowerParticles = config.getBoolean("Leaf Blower: Particles", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks have particles when getting destroyed"); - leafBlowerHasSound = config.getBoolean("Leaf Blower: Sound", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower makes Sounds"); - leafBlowerRangeSides = config.getInt("Leaf Blower: Side Range", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5, 1, 25, "The Leaf Blower's Range to the Sides"); - leafBlowerRangeUp = config.getInt("Leaf Blower: Height Range", ConfigurationHandler.CATEGORY_TOOL_VALUES, 1, 1, 10, "The Leaf Blower's Range to the Top and Bottom"); + for(int i = 0; i < intValues.length; i++){ + ConfigIntValues currConf = intConfig[i]; + intValues[i] = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); + } - generateBlackQuartz = config.getBoolean("Black Quartz", ConfigurationHandler.CATEGORY_WORLD_GEN, true, "If the Black Quartz generates in the world"); - blackQuartzBaseAmount = config.getInt("Black Quartz Amount", ConfigurationHandler.CATEGORY_WORLD_GEN, 3, 1, 50, "How big a Black Quartz Vein is at least"); - blackQuartzAdditionalChance = config.getInt("Black Quartz Additional Chance", ConfigurationHandler.CATEGORY_WORLD_GEN, 3, 0, 50, "How much bigger than the Base Amount a Black Quartz Vein can get"); - blackQuartzChance = config.getInt("Black Quartz Chance", ConfigurationHandler.CATEGORY_WORLD_GEN, 25, 1, 150, "How often the Black Quartz tries to generate"); - blackQuartzMinHeight = config.getInt("Black Quartz Min Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate"); - blackQuartzMaxHeight = config.getInt("Black Quartz Max Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at"); + for(int i = 0; i < floatValues.length; i++){ + ConfigFloatValues currConf = floatConfig[i]; + floatValues[i] = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); + } - enableExperienceDrop = config.getBoolean("Solidified Experience", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Solidified Experience drops from Mobs"); - enableBloodDrop = config.getBoolean("Blood Fragments", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Blood Fragments drop from Mobs"); - enableHeartDrop = config.getBoolean("Heart Parts", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Heart Parts drop from Mobs"); - enableSubstanceDrop = config.getBoolean("Unknown Substance", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Unknown Substance drops from Mobs"); - enablePearlShardDrop = config.getBoolean("Ender Pearl Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Ender Pearl Shard drops from Mobs"); - 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"); - enableFurnaceDoubleRecipe = config.getBoolean("Double Furnace", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Furnace is Enabled"); - enableGiantChestRecipe = config.getBoolean("Giant Chest", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Giant Chest is Enabled"); - enableInputterRecipe = config.getBoolean("ESD", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the ESD is Enabled"); - 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"); - - 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"); - - 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"); - - 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"); - toolEmeraldEfficiency = config.getFloat("Emerald: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are"); - toolEmeraldDamage = config.getFloat("Emerald: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals"); - toolEmeraldEnchantability = config.getInt("Emerald: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is"); - enableToolEmeraldRecipe = config.getBoolean("Emerald Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Emerald Tools is Enabled"); - - toolObsidianHarvestLevel = config.getInt("Obsidian: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"); - toolObsidianMaxUses = config.getInt("Obsidian: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used"); - toolObsidianEfficiency = config.getFloat("Obsidian: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are"); - toolObsidianDamage = config.getFloat("Obsidian: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals"); - toolObsidianEnchantability = config.getInt("Obsidian: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is"); - enableToolObsidianRecipe = config.getBoolean("Obsidian Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Obsidian Tools is Enabled"); - - 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!)"); + for(int i = 0; i < boolValues.length; i++){ + ConfigBoolValues currConf = boolConfig[i]; + boolValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc); + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java index 55b7665b0..735f1ce90 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigurationHandler.java @@ -7,17 +7,6 @@ import java.io.File; public class ConfigurationHandler{ - public static final String CATEGORY_FOOD_CRAFTING = "food crafting"; - public static final String CATEGORY_MISC_CRAFTING = "misc crafting"; - public static final String CATEGORY_BLOCKS_CRAFTING = "block crafting"; - public static final String CATEGORY_ITEMS_CRAFTING = "items crafting"; - public static final String CATEGORY_TOOL_VALUES = "tool values"; - 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){ Util.logInfo("Grabbing Configurations..."); Configuration config = new Configuration(configFile); diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java new file mode 100644 index 000000000..9c246564c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java @@ -0,0 +1,43 @@ +package ellpeck.actuallyadditions.config.values; + +import ellpeck.actuallyadditions.config.ConfigCategories; +import ellpeck.actuallyadditions.config.ConfigValues; + +public enum ConfigBoolValues{ + + LEAF_BLOWER_ITEMS("Leaf Blower: Drops Items", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks' Drops drop"), + LEAF_BLOWER_PARTICLES("Leaf Blower: Particles", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks have particles when getting destroyed"), + LEAF_BLOWER_SOUND("Leaf Blower: Sound", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower makes Sounds"), + + JAM_VILLAGER_EXISTS("Jam Villager: Existence", ConfigCategories.WORLD_GEN, true, "If the Jam Villager and his House exist"), + + GENERATE_QUARTZ("Black Quartz", ConfigCategories.WORLD_GEN, true, "If the Black Quartz generates in the world"), + + EXPERIENCE_DROP("Solidified Experience", ConfigCategories.MOB_DROPS, true, "If the Solidified Experience drops from Mobs"), + BLOOD_DROP("Blood Fragments", ConfigCategories.MOB_DROPS, false, "If the Blood Fragments drop from Mobs"), + HEART_DROP("Heart Parts", ConfigCategories.MOB_DROPS, false, "If the Heart Parts drop from Mobs"), + SUBSTANCE_DROP("Unknown Substance", ConfigCategories.MOB_DROPS, false, "If the Unknown Substance drops from Mobs"), + PEARL_SHARD_DROP("Ender Pearl Shard", ConfigCategories.MOB_DROPS, true, "If the Ender Pearl Shard drops from Mobs"), + EMERALD_SHARD_CROP("Emerald Shard", ConfigCategories.MOB_DROPS, true, "If the Emerald Shard drops from Mobs"), + + DO_UPDATE_CHECK("Do Update Check", ConfigCategories.OTHER, true, "If Actually Additions should check for an Update on joining a World"), + + DO_CRUSHER_SPAM("Crusher Debug", ConfigCategories.OTHER, false, "Print out Crusher Recipe Initializing Debug"); + + public final String name; + public final String category; + public final boolean defaultValue; + public final String desc; + + ConfigBoolValues(String name, ConfigCategories category, boolean defaultValue, String desc){ + this.name = name; + this.category = category.name; + this.defaultValue = defaultValue; + this.desc = desc; + } + + public boolean isEnabled(){ + return ConfigValues.boolValues[this.ordinal()]; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java new file mode 100644 index 000000000..7faebfc9d --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java @@ -0,0 +1,91 @@ +package ellpeck.actuallyadditions.config.values; + +import ellpeck.actuallyadditions.config.ConfigCategories; +import ellpeck.actuallyadditions.config.ConfigValues; + +public enum ConfigCrafting{ + + COMPOST("Compost", ConfigCategories.BLOCKS_CRAFTING), + WOOD_CASING("Wood Casing", ConfigCategories.BLOCKS_CRAFTING), + STONE_CASING("Stone Casing", ConfigCategories.BLOCKS_CRAFTING), + FISHING_NET("Fishing Net", ConfigCategories.BLOCKS_CRAFTING), + REPAIRER("Repairer", ConfigCategories.BLOCKS_CRAFTING), + SOLAR_PANEL("Solar Panel", ConfigCategories.BLOCKS_CRAFTING), + HEAT_COLLECTOR("Heat Collector", ConfigCategories.BLOCKS_CRAFTING), + INPUTTER("ESD", ConfigCategories.BLOCKS_CRAFTING), + CRUSHER("Crusher", ConfigCategories.BLOCKS_CRAFTING), + DOUBLE_CRUSHER("Double Crusher", ConfigCategories.BLOCKS_CRAFTING), + DOUBLE_FURNACE("Double Furnace", ConfigCategories.BLOCKS_CRAFTING), + FEEDER("Feeder", ConfigCategories.BLOCKS_CRAFTING), + GIANT_CHEST("Storage Crate", ConfigCategories.BLOCKS_CRAFTING), + + GREENHOUSE_GLASS("Greenhouse Glass", ConfigCategories.BLOCKS_CRAFTING), + BREAKER("Breaker", ConfigCategories.BLOCKS_CRAFTING), + PLACER("Placer", ConfigCategories.BLOCKS_CRAFTING), + DROPPER("Dropper", ConfigCategories.BLOCKS_CRAFTING), + SPEED_UPGRADE("Speed Upgrade", ConfigCategories.BLOCKS_CRAFTING), + + BAGUETTE("Baguette", ConfigCategories.FOOD_CRAFTING), + PIZZA("Pizza", ConfigCategories.FOOD_CRAFTING), + HAMBURGER("Hamburger", ConfigCategories.FOOD_CRAFTING), + BIG_COOKIE("Big Cookie", ConfigCategories.FOOD_CRAFTING), + SUB("Sub Sandwich", ConfigCategories.FOOD_CRAFTING), + FRENCH_FRY("French Fry", ConfigCategories.FOOD_CRAFTING), + FRENCH_FRIES("French Fries", ConfigCategories.FOOD_CRAFTING), + FISH_N_CHIPS("Fish And Chips", ConfigCategories.FOOD_CRAFTING), + CHEESE("Cheese", ConfigCategories.FOOD_CRAFTING), + PUMPKIN_STEW("Pumpkin Stew", ConfigCategories.FOOD_CRAFTING), + CARROT_JUICE("Carrot Juice", ConfigCategories.FOOD_CRAFTING), + SPAGHETTI("Spaghetti", ConfigCategories.FOOD_CRAFTING), + NOODLE("Noodle", ConfigCategories.FOOD_CRAFTING), + CHOCOLATE("Chocolate", ConfigCategories.FOOD_CRAFTING), + CHOCOLATE_CAKE("Chocolate Cake", ConfigCategories.FOOD_CRAFTING), + TOAST("Toast", ConfigCategories.FOOD_CRAFTING), + + LEAF_BLOWER("Leaf Blower", ConfigCategories.ITEMS_CRAFTING), + LEAF_BLOWER_ADVANCED("Advanced Leaf Blower", ConfigCategories.ITEMS_CRAFTING), + COIL("Coil", ConfigCategories.ITEMS_CRAFTING), + ADV_COIL("Advanced Coil", ConfigCategories.ITEMS_CRAFTING), + KNIFE("Knife", ConfigCategories.ITEMS_CRAFTING), + STICK_CRAFTER("Crafting Table On A Stick", ConfigCategories.ITEMS_CRAFTING), + MASHED_FOOD("Mashed Food", ConfigCategories.ITEMS_CRAFTING), + + RING_SPEED("Speed Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_HASTE("Haste Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_STRENGTH("Strength Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_JUMP_BOOST("Jump Boost Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_REGEN("Regen Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_RESISTANCE("Resistance Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_FIRE_RESISTANCE("Fire Resistance Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_WATER_BREATHING("Water Breathing Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_INVISIBILITY("Invisibility Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_NIGHT_VISION("Night Vision Ring", ConfigCategories.POTION_RING_CRAFTING), + RING_SATURATION("Saturation Ring", ConfigCategories.POTION_RING_CRAFTING, false), + + DOUGH("Dough", ConfigCategories.ITEMS_CRAFTING), + PAPER_CONE("Paper Cone", ConfigCategories.ITEMS_CRAFTING), + KNIFE_HANDLE("Knife Handle", ConfigCategories.ITEMS_CRAFTING), + KNIFE_BLADE("Knife Blade", ConfigCategories.ITEMS_CRAFTING), + + TOOL_EMERALD("Emerald Tools", ConfigCategories.ITEMS_CRAFTING), + TOOL_OBSIDIAN("Obsidian Tools", ConfigCategories.ITEMS_CRAFTING); + + public final String name; + public final String category; + public final boolean defaultValue; + + ConfigCrafting(String name, ConfigCategories category){ + this(name, category, true); + } + + ConfigCrafting(String name, ConfigCategories category, boolean defaultValue){ + this.name = name; + this.category = category.name; + this.defaultValue = defaultValue; + } + + public boolean isEnabled(){ + return ConfigValues.craftingValues[this.ordinal()]; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java new file mode 100644 index 000000000..1af7ea863 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java @@ -0,0 +1,34 @@ +package ellpeck.actuallyadditions.config.values; + +import ellpeck.actuallyadditions.config.ConfigCategories; +import ellpeck.actuallyadditions.config.ConfigValues; + +public enum ConfigFloatValues{ + + EMERALD_SPEED("Emerald: Efficiency", ConfigCategories.TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are"), + EMERALD_MAX_DAMAGE("Emerald: Damage", ConfigCategories.TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals"), + + OBSIDIAN_SPEED("Obsidian: Efficiency", ConfigCategories.TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are"), + OBSIDIAN_MAX_DAMAGE("Obsidian: Damage", ConfigCategories.TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals"); + + public final String name; + public final String category; + public final float defaultValue; + public final float min; + public final float max; + public final String desc; + + ConfigFloatValues(String name, ConfigCategories category, float defaultValue, float min, float max, String desc){ + this.name = name; + this.category = category.name; + this.defaultValue = defaultValue; + this.min = min; + this.max = max; + this.desc = desc; + } + + public float getValue(){ + return ConfigValues.floatValues[this.ordinal()]; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java new file mode 100644 index 000000000..65944bf6c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -0,0 +1,71 @@ +package ellpeck.actuallyadditions.config.values; + +import ellpeck.actuallyadditions.config.ConfigCategories; +import ellpeck.actuallyadditions.config.ConfigValues; + +public enum ConfigIntValues{ + + JAM_VILLAGER_ID("Jam Villager: ID", ConfigCategories.WORLD_GEN, 493827, 100, 1000000, "The ID of the Jam Villager"), + + LEAF_BLOWER_RANGE_SIDES("Leaf Blower: Side Range", ConfigCategories.TOOL_VALUES, 5, 1, 25, "The Leaf Blower's Range to the Sides"), + LEAF_BLOWER_RANGE_UP("Leaf Blower: Range Up", ConfigCategories.TOOL_VALUES, 1, 1, 10, "The Leaf Blower's Range Up"), + + BLACK_QUARTZ_BASE_AMOUNT("Black Quartz Amount", ConfigCategories.WORLD_GEN, 3, 1, 50, "How big a Black Quartz Vein is at least"), + BLACK_QUARTZ_ADD_CHANCE("Black Quartz Additional Chance", ConfigCategories.WORLD_GEN, 3, 0, 50, "How much bigger than the Base Amount a Black Quartz Vein can get"), + BLACK_QUARTZ_CHANCE("Black Quartz Chance", ConfigCategories.WORLD_GEN, 25, 1, 150, "How often the Black Quartz tries to generate"), + BLACK_QUARTZ_MIN_HEIGHT("Black Quartz Min Height", ConfigCategories.WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate"), + BLACK_QUARTZ_MAX_HEIGHT("Black Quartz Max Height", ConfigCategories.WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at"), + + COMPOST_AMOUNT("Compost: Amount Needed To Convert", ConfigCategories.MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer"), + COMPOST_TIME("Compost: Conversion Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer"), + + FISHER_TIME("Fishing Net: Time Needed", ConfigCategories.MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish"), + + FEEDER_REACH("Feeder: Reach", ConfigCategories.MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder"), + FEEDER_TIME("Feeder: Time Needed", ConfigCategories.MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder"), + FEEDER_THRESHOLD("Feeder: Threshold", ConfigCategories.MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop"), + + KNIFE_DAMAGE("Knife: Max Uses", ConfigCategories.TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with"), + + EMERALD_HARVEST_LEVEL("Emerald: Harvest Level", ConfigCategories.TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"), + EMERALD_USES("Emerald: Max Uses", ConfigCategories.TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used"), + EMERALD_ENCHANTABILITY("Emerald: Enchantability", ConfigCategories.TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is"), + + OBSIDIAN_HARVEST_LEVEL("Obsidian: Harvest Level", ConfigCategories.TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"), + OBSIDIAN_USES("Obsidian: Max Uses", ConfigCategories.TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used"), + OBSIDIAN_ENCHANTABILITY("Obsidian: Enchantability", ConfigCategories.TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is"), + + GRINDER_CRUSH_TIME("Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item"), + GRINDER_DOUBLE_CRUSH_TIME("Double Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item"), + FURNACE_DOUBLE_SMELT_TIME("Double Furnace: Smelt Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item"), + + REPAIRER_SPEED_SLOWDOWN("Item Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs"), + HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"), + HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"), + + GLASS_TIME_NEEDED("Greenhouse Glass: Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"), + + BREAKER_TIME_NEEDED("Breaker and Placer: Time Needed", ConfigCategories.MACHINE_VALUES, 15, 1, 10000, "The Time Needed for the Breaker and the Placer to place or break a Block"), + DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item"); + + public final String name; + public final String category; + public final int defaultValue; + public final int min; + public final int max; + public final String desc; + + ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc){ + this.name = name; + this.category = category.name; + this.defaultValue = defaultValue; + this.min = min; + this.max = max; + this.desc = desc; + } + + public int getValue(){ + return ConfigValues.intValues[this.ordinal()]; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index bdc1bde90..acadece1b 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -3,117 +3,187 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.config.ConfigValues; -import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class BlockCrafting{ public static void init(){ //Compost - if(ConfigValues.enableCompostRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockCompost), - "W W", "WFW", "WWW", - 'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), - 'F', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal())); + if(ConfigCrafting.COMPOST.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCompost), + "W W", "W W", "WCW", + 'W', "plankWood", + 'C', TheMiscBlocks.WOOD_CASING.getOredictName())); + + //Wood Casing + if(ConfigCrafting.WOOD_CASING.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), + "WSW", "SRS", "WSW", + 'W', "plankWood", + 'R', "dustRedstone", + 'S', "stickWood")); + + //Stone Casing + if(ConfigCrafting.STONE_CASING.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), + "WSW", "SRS", "WSW", + 'W', "cobblestone", + 'R', "dustRedstone", + 'S', "stickWood")); //Quartz Block - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), "QQ", "QQ", - 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); + 'Q', TheMiscItems.QUARTZ.getOredictName())); //Fishing Net - if(ConfigValues.enableFishingNetRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFishingNet), + if(ConfigCrafting.FISHING_NET.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFishingNet), "SSS", "SDS", "SSS", - 'D', new ItemStack(Items.diamond), - 'S', new ItemStack(Items.string)); + 'D', "gemDiamond", + 'S', 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)); + if(ConfigCrafting.REPAIRER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockItemRepairer), + "DID", "OCO", "DID", + 'D', "gemDiamond", + 'I', "ingotIron", + 'O', TheMiscItems.COIL.getOredictName(), + 'C', TheMiscBlocks.STONE_CASING.getOredictName())); //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)); + /*if(ConfigCrafting.SOLAR_PANEL.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceSolar), + "IQI", "CDC", "IBI", + 'D', "blockDiamond", + 'I', "ingotIron", + 'Q', TheMiscBlocks.STONE_CASING.getOredictName(), + 'C', TheMiscItems.COIL_ADVANCED.getOredictName(), + '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), + /*if(ConfigCrafting.HEAT_COLLECTOR.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector), + "BRB", "CDC", "BQB", + 'D', "blockDiamond", 'R', new ItemStack(Items.repeater), + 'Q', TheMiscBlocks.STONE_CASING.getOredictName(), 'L', new ItemStack(Items.lava_bucket), - 'B', new ItemStack(Blocks.iron_bars)); + 'C', TheMiscItems.COIL_ADVANCED.getOredictName(), + 'B', new ItemStack(Blocks.iron_bars)));*/ //Quartz Pillar - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), "Q", "Q", - 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); + 'Q', TheMiscItems.QUARTZ.getOredictName())); //Chiseled Quartz - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()), "Q", "Q", - 'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal())); + 'Q', TheMiscBlocks.QUARTZ.getOredictName())); //Inputter - if(ConfigValues.enableInputterRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockInputter), - "WWW", "WHW", "WWW", - 'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), - 'H', new ItemStack(Blocks.hopper)); + if(ConfigCrafting.INPUTTER.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockInputter), + "WWW", "CHC", "WWW", + 'W', "plankWood", + 'C', TheMiscBlocks.WOOD_CASING.getOredictName(), + 'H', new ItemStack(Blocks.hopper))); + + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockInputterAdvanced), + ((INameableItem)InitBlocks.blockInputter).getOredictName(), + TheMiscItems.COIL_ADVANCED.getOredictName(), + TheMiscItems.QUARTZ.getOredictName(), + "dustRedstone")); + } //Crusher - if(ConfigValues.enableCrusherRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinder), - "CFC", "CPC", "CFC", - 'C', new ItemStack(Blocks.cobblestone), + if(ConfigCrafting.CRUSHER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGrinder), + "CFC", "DQD", "CFC", + 'C', "cobblestone", + 'D', TheMiscItems.COIL.getOredictName(), + 'Q', TheMiscBlocks.STONE_CASING.getOredictName(), 'P', new ItemStack(Blocks.piston), - 'F', new ItemStack(Items.flint)); + 'F', new ItemStack(Items.flint))); //Double Crusher - if(ConfigValues.enableCrusherDoubleRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinderDouble), - "CCC", "RPR", "CCC", - 'C', new ItemStack(Blocks.cobblestone), - 'R', new ItemStack(InitBlocks.blockGrinder), - 'P', new ItemStack(Blocks.piston)); + if(ConfigCrafting.DOUBLE_CRUSHER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGrinderDouble), + "CDC", "RFR", "CDC", + 'C', "cobblestone", + 'D', TheMiscItems.COIL_ADVANCED.getOredictName(), + 'R', ((INameableItem)InitBlocks.blockGrinder).getOredictName(), + 'F', TheMiscBlocks.STONE_CASING.getOredictName(), + 'P', new ItemStack(Blocks.piston))); //Double Furnace - if(ConfigValues.enableFurnaceDoubleRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceDouble), - "CCC", "RPR", "CCC", - 'C', new ItemStack(Blocks.cobblestone), + if(ConfigCrafting.COMPOST.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceDouble), + "CDC", "RFR", "CDC", + 'C', "cobblestone", + 'D', TheMiscItems.COIL.getOredictName(), 'R', new ItemStack(Blocks.furnace), - 'P', new ItemStack(Items.brick)); + 'F', TheMiscBlocks.STONE_CASING.getOredictName(), + 'P', "ingotBrick")); //Feeder - if(ConfigValues.enableFeederRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFeeder), - "WCW", "WHW", "WCW", - 'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), + if(ConfigCrafting.DOUBLE_FURNACE.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFeeder), + "WCW", "DHD", "WCW", + 'W', "plankWood", + 'D', TheMiscItems.COIL.getOredictName(), 'C', new ItemStack(Items.golden_carrot), - 'H', new ItemStack(Items.wheat)); + 'H', TheMiscBlocks.WOOD_CASING.getOredictName())); //Giant Chest - if(ConfigValues.enableGiantChestRecipe) - GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGiantChest), - "CWC", "W W", "CWC", + if(ConfigCrafting.GIANT_CHEST.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChest), + "CWC", "WDW", "CWC", 'C', new ItemStack(Blocks.chest), - 'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD)); + 'D', TheMiscBlocks.WOOD_CASING.getOredictName(), + 'W', "plankWood")); + + //Greenhouse Glass + if(ConfigCrafting.GREENHOUSE_GLASS.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass), + "GSG", "SDS", "GSG", + 'G', "blockGlass", + 'D', "gemDiamond", + 'S', "treeSapling")); + + //Placer + if(ConfigCrafting.PLACER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPlacer), + "CCC", "CRP", "CCC", + 'C', "cobblestone", + 'R', TheMiscItems.COIL.getOredictName(), + 'P', Blocks.piston)); + + //Breaker + if(ConfigCrafting.BREAKER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockBreaker), + "CCC", "CRP", "CCC", + 'C', "cobblestone", + 'R', TheMiscItems.COIL.getOredictName(), + 'P', Items.diamond_pickaxe)); + + //Dropper + if(ConfigCrafting.DROPPER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDropper), + "CCC", "CDR", "CCC", + 'C', "cobblestone", + 'D', Blocks.dropper, + 'R', TheMiscItems.COIL_ADVANCED.getOredictName())); } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java index fc81c1203..ab4d04a5a 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java @@ -1,132 +1,135 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class FoodCrafting{ public static void init(){ - ItemStack knifeStack = new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD); + String knifeStack = ((INameableItem)InitItems.itemKnife).getOredictName(); //Baguette - if(ConfigValues.enabledFoodRecipes[TheFoods.BAGUETTE.ordinal()]) + if(ConfigCrafting.BAGUETTE.isEnabled()) GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 1F); //Pizza - if(ConfigValues.enabledFoodRecipes[TheFoods.PIZZA.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()), + if(ConfigCrafting.PIZZA.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()), "HKH", "MCF", " D ", - 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), + 'D', TheMiscItems.DOUGH.getOredictName(), 'M', new ItemStack(Blocks.brown_mushroom), - 'C', new ItemStack(Items.carrot), + 'C', "cropCarrot", 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'K', knifeStack, - 'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())); + 'H', TheFoods.CHEESE.getOredictName())); //Hamburger - if(ConfigValues.enabledFoodRecipes[TheFoods.HAMBURGER.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), + if(ConfigCrafting.HAMBURGER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), "KT ", "CB ", " T ", - 'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()), - 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), + 'T', TheFoods.TOAST.getOredictName(), + 'C', TheFoods.CHEESE.getOredictName(), 'K', knifeStack, - 'B', new ItemStack(Items.cooked_beef)); + 'B', new ItemStack(Items.cooked_beef))); //Big Cookie - if(ConfigValues.enabledFoodRecipes[TheFoods.BIG_COOKIE.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()), + if(ConfigCrafting.BIG_COOKIE.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()), "DCD", "CDC", "DCD", - 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), - 'C', new ItemStack(Items.dye, 1, 3)); + 'D', TheMiscItems.DOUGH.getOredictName(), + 'C', new ItemStack(Items.dye, 1, 3))); //Sub Sandwich - if(ConfigValues.enabledFoodRecipes[TheFoods.SUBMARINE_SANDWICH.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), + if(ConfigCrafting.SUB.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), "KCP", "FB ", "PCP", 'P', new ItemStack(Items.paper), - 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), + 'C', TheFoods.CHEESE.getOredictName(), 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), - 'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), - 'K', knifeStack); + 'B', TheFoods.BAGUETTE.getOredictName(), + 'K', knifeStack)); //French Fry - if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRY.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), + if(ConfigCrafting.FRENCH_FRY.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), new ItemStack(Items.baked_potato), - knifeStack); + knifeStack)); //French Fries - if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRIES.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), + if(ConfigCrafting.FRENCH_FRIES.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), "FFF", " P ", - 'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), - 'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())); + 'P', TheMiscItems.PAPER_CONE.getOredictName(), + 'F', TheFoods.FRENCH_FRY.getOredictName())); //Fish N Chips - if(ConfigValues.enabledFoodRecipes[TheFoods.FISH_N_CHIPS.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), + if(ConfigCrafting.FISH_N_CHIPS.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), "FIF", " P ", 'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), - 'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), - 'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())); + 'P', TheMiscItems.PAPER_CONE.getOredictName(), + 'F', TheFoods.FRENCH_FRY.getOredictName())); //Cheese - if(ConfigValues.enabledFoodRecipes[TheFoods.CHEESE.ordinal()]) + if(ConfigCrafting.CHEESE.isEnabled()) GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), new ItemStack(Items.milk_bucket)); //Pumpkin Stew - if(ConfigValues.enabledFoodRecipes[TheFoods.PUMPKIN_STEW.ordinal()]) + if(ConfigCrafting.PUMPKIN_STEW.isEnabled()) GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()), "P", "B", 'P', new ItemStack(Blocks.pumpkin), 'B', new ItemStack(Items.bowl)); //Carrot Juice - if(ConfigValues.enabledFoodRecipes[TheFoods.CARROT_JUICE.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()), - new ItemStack(Items.glass_bottle), new ItemStack(Items.carrot), knifeStack); + if(ConfigCrafting.CARROT_JUICE.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()), + new ItemStack(Items.glass_bottle), "cropCarrot", knifeStack)); //Spaghetti - if(ConfigValues.enabledFoodRecipes[TheFoods.SPAGHETTI.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()), + if(ConfigCrafting.SPAGHETTI.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()), "NNN", " B ", - 'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), - 'B', new ItemStack(Items.bowl)); + 'N', TheFoods.NOODLE.getOredictName(), + 'B', new ItemStack(Items.bowl))); //Noodle - if(ConfigValues.enabledFoodRecipes[TheFoods.NOODLE.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), - new ItemStack(Items.wheat), knifeStack); + if(ConfigCrafting.NOODLE.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), + "cropWheat", knifeStack)); //Chocolate - if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE.ordinal()]) + if(ConfigCrafting.CHOCOLATE.isEnabled()) GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE.ordinal()), "C C", "CMC", "C C", 'C', new ItemStack(Items.dye, 1, 3), 'M', new ItemStack(Items.milk_bucket)); //Chocolate Cake - if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE_CAKE.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()), + if(ConfigCrafting.CHOCOLATE_CAKE.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()), "MMM", "CCC", "EDS", 'M', new ItemStack(Items.milk_bucket), 'E', new ItemStack(Items.egg), - 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), + 'D', TheMiscItems.DOUGH.getOredictName(), 'S', new ItemStack(Items.sugar), - 'C', new ItemStack(Items.dye, 1, 3)); + 'C', new ItemStack(Items.dye, 1, 3))); //Toast - if(ConfigValues.enabledFoodRecipes[TheFoods.TOAST.ordinal()]) + if(ConfigCrafting.TOAST.isEnabled()) GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()), new ItemStack(Items.bread)); } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java index ddba1280a..b5cb88347 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java @@ -2,85 +2,36 @@ package ellpeck.actuallyadditions.crafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; +import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler; +import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SearchCase; +import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SpecialOreCase; import ellpeck.actuallyadditions.recipe.GrinderRecipes; -import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import org.apache.logging.log4j.Level; - -import java.util.ArrayList; public class GrinderCrafting{ + private static GrinderRecipeHandler grindRecHan = GrinderRecipeHandler.instance(); + private static GrinderRecipes grindRec = GrinderRecipes.instance(); + public static void init(){ - Util.logInfo("Initializing Grinder Recipes..."); + Util.logInfo("Initializing Crusher Recipes..."); - GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10); - GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0); - GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()), null, 0); + grindRec.registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10); + grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0); + grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()), null, 0); + grindRecHan.specialOreCases.add(new SpecialOreCase("oreNickel", "dustPlatinum", 30)); - registerFinally(); - } + grindRecHan.searchCases.add(new SearchCase("ore", 2)); + grindRecHan.searchCases.add(new SearchCase("oreNether", 6)); + grindRecHan.searchCases.add(new SearchCase("denseore", 8)); + grindRecHan.searchCases.add(new SearchCase("gem", 1)); + grindRecHan.searchCases.add(new SearchCase("ingot", 1)); + grindRecHan.exceptions.add("ingotBrick"); + grindRecHan.exceptions.add("ingotBrickNether"); - public static void registerFinally(){ - String[] names = OreDictionary.getOreNames(); - for(String name : names){ - - int resultAmount = 1; - String nameOfOre = null; - - if(name.length() > 3 && name.substring(0, 3).equals("ore")){ - nameOfOre = name.substring(3); - resultAmount = 2; - } - if(name.length() > 9 && name.substring(0, 9).equals("oreNether")){ - nameOfOre = name.substring(9); - resultAmount = 4; - } - if(name.length() > 8 && name.substring(0, 8).equals("denseore")){ - nameOfOre = name.substring(8); - resultAmount = 12; - } - if(name.length() > 3 && name.substring(0, 3).equals("gem")) nameOfOre = name.substring(3); - if(name.length() > 5 && name.substring(0, 5).equals("ingot")) nameOfOre = name.substring(5); - - if(nameOfOre != null){ - ArrayList allDusts; - String nameToGetFrom = "dust" + nameOfOre; - - allDusts = OreDictionary.getOres(nameToGetFrom); - - if(allDusts != null && allDusts.size() > 0){ - ArrayList allOresOfName = OreDictionary.getOres(name); - if(allOresOfName != null && allOresOfName.size() > 0){ - for(ItemStack theDust : allDusts){ - ItemStack output = theDust.copy(); - output.stackSize = resultAmount; - for(ItemStack theInput : allOresOfName){ - ItemStack input = theInput.copy(); - if(GrinderRecipes.instance().getOutput(input, false) == null){ - ArrayList specialStacks = null; - - if(name.equals("oreNickel")) specialStacks = OreDictionary.getOres("dustPlatinum"); - - if(specialStacks != null){ - for(ItemStack theSpecial : specialStacks){ - ItemStack special = theSpecial.copy(); - GrinderRecipes.instance().registerRecipe(input, output, special, 10); - } - } - else GrinderRecipes.instance().registerRecipe(input, output, null, 0); - } - } - } - } - else ModUtil.AA_LOGGER.log(Level.ERROR, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + name + "'! This shouldn't happen as there is something registered as '" + name + "' that doesn't exist!"); - } - else if(!name.equals("ingotBrick") && !name.equals("ingotBrickNether")) ModUtil.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + nameToGetFrom + "' doesn't exist! It should correspond to '" + name + "'! This is not an Error, just a bit sad :("); - } - } + grindRecHan.registerFinally(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 20f7ce775..fee9b529e 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; @@ -15,19 +15,35 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class ItemCrafting{ public static void init(){ - //Leaf Blower - if(ConfigValues.enableLeafBlowerRecipe) - GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlower), - " F", "IP", "IR", + //Leaf Blower + if(ConfigCrafting.LEAF_BLOWER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlower), + " F", "IP", "IC", 'F', new ItemStack(Items.flint), - 'I', new ItemStack(Items.iron_ingot), + 'I', "ingotIron", 'P', new ItemStack(Blocks.piston), - 'R', new ItemStack(Items.redstone)); + 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); + + //Coil + if(ConfigCrafting.COIL.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), + " R ", "RIR", " R ", + 'I', "ingotIron", + 'R', "dustRedstone")); + + //Advanced Coil + if(ConfigCrafting.ADV_COIL.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), + " G ", "GCG", " G ", + 'C', TheMiscItems.COIL.getOredictName(), + 'G', "ingotGold")); //Ender Pearl GameRegistry.addRecipe(new ItemStack(Items.ender_pearl), @@ -40,34 +56,41 @@ public class ItemCrafting{ 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal())); //Advanced Leaf Blower - if(ConfigValues.enableLeafBlowerAdvancedRecipe) - GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), - " F", "DP", "DR", + if(ConfigCrafting.LEAF_BLOWER_ADVANCED.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), + " F", "DP", "DC", 'F', new ItemStack(Items.flint), - 'D', new ItemStack(Items.diamond), + 'D', "gemDiamond", 'P', new ItemStack(Blocks.piston), - 'R', new ItemStack(Items.redstone)); + 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); //Quartz - if(ConfigValues.enabledMiscRecipes[TheMiscItems.QUARTZ.ordinal()]) - GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), - new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F); + GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), + new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F); //Knife - if(ConfigValues.enableKnifeRecipe) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemKnife), - new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), - new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal())); + if(ConfigCrafting.KNIFE.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemKnife), + TheMiscItems.KNIFE_BLADE.getOredictName(), + TheMiscItems.KNIFE_HANDLE.getOredictName())); //Crafter on a Stick - if(ConfigValues.enableCrafterRecipe) + if(ConfigCrafting.STICK_CRAFTER.isEnabled()) GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCrafterOnAStick), new ItemStack(Blocks.crafting_table), new ItemStack(Items.sign), new ItemStack(Items.slime_ball)); + //SpeedUpgrade + if(ConfigCrafting.SPEED_UPGRADE.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSpeedUpgrade, 2), + "RGR", "GUG", "RGR", + 'U', TheMiscItems.COIL.getOredictName(), + 'R', "dustRedstone", + 'G', "ingotGold")); + //Mashed Food - if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()]) + if(ConfigCrafting.MASHED_FOOD.isEnabled()) initMashedFoodRecipes(); //Rings @@ -94,19 +117,29 @@ public class ItemCrafting{ } public static void initPotionRingRecipes(){ - GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()), + GameRegistry.addRecipe(new ShapedOreRecipe(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)); + 'G', "ingotGold", + 'I', "ingotIron", + 'D', "dustGlowstone")); - 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)); - } - } + if(ConfigCrafting.RING_SPEED.isEnabled()) addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal()); + if(ConfigCrafting.RING_HASTE.isEnabled()) addRingRecipeWithStack(ThePotionRings.HASTE.craftingItem, ThePotionRings.HASTE.ordinal()); + if(ConfigCrafting.RING_STRENGTH.isEnabled()) addRingRecipeWithStack(ThePotionRings.STRENGTH.craftingItem, ThePotionRings.STRENGTH.ordinal()); + if(ConfigCrafting.RING_JUMP_BOOST.isEnabled()) addRingRecipeWithStack(ThePotionRings.JUMP_BOOST.craftingItem, ThePotionRings.JUMP_BOOST.ordinal()); + if(ConfigCrafting.RING_REGEN.isEnabled()) addRingRecipeWithStack(ThePotionRings.REGEN.craftingItem, ThePotionRings.REGEN.ordinal()); + if(ConfigCrafting.RING_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.RESISTANCE.craftingItem, ThePotionRings.RESISTANCE.ordinal()); + if(ConfigCrafting.RING_FIRE_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.FIRE_RESISTANCE.craftingItem, ThePotionRings.FIRE_RESISTANCE.ordinal()); + if(ConfigCrafting.RING_WATER_BREATHING.isEnabled()) addRingRecipeWithStack(ThePotionRings.WATER_BREATHING.craftingItem, ThePotionRings.WATER_BREATHING.ordinal()); + if(ConfigCrafting.RING_INVISIBILITY.isEnabled()) addRingRecipeWithStack(ThePotionRings.INVISIBILITY.craftingItem, ThePotionRings.INVISIBILITY.ordinal()); + if(ConfigCrafting.RING_NIGHT_VISION.isEnabled()) addRingRecipeWithStack(ThePotionRings.NIGHT_VISION.craftingItem, ThePotionRings.NIGHT_VISION.ordinal()); + if(ConfigCrafting.RING_SATURATION.isEnabled()) addRingRecipeWithStack(ThePotionRings.SATURATION.craftingItem, ThePotionRings.SATURATION.ordinal()); + + } + + public static void addRingRecipeWithStack(ItemStack mainStack, int meta){ + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), 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, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star)); } public static void initMashedFoodRecipes(){ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java index e044852d8..56e1bc903 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java @@ -1,40 +1,41 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class MiscCrafting{ public static void init(){ //Dough - if(ConfigValues.enabledMiscRecipes[TheMiscItems.DOUGH.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()), - new ItemStack(Items.wheat), new ItemStack(Items.wheat)); + if(ConfigCrafting.DOUGH.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()), + "cropWheat", "cropWheat")); //Paper Cone - if(ConfigValues.enabledMiscRecipes[TheMiscItems.PAPER_CONE.ordinal()]) + if(ConfigCrafting.PAPER_CONE.isEnabled()) GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), "P P", " P ", 'P', new ItemStack(Items.paper)); //Knife Handle - if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_HANDLE.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()), - new ItemStack(Items.stick), - new ItemStack(Items.leather)); + if(ConfigCrafting.KNIFE_HANDLE.isEnabled()) + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()), + "stickWood", + new ItemStack(Items.leather))); //Knife Blade - if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_BLADE.ordinal()]) - GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), + if(ConfigCrafting.KNIFE_BLADE.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), "KF", - 'K', new ItemStack(Items.iron_ingot), - 'F', new ItemStack(Items.flint)); - + 'K', "ingotIron", + 'F', new ItemStack(Items.flint))); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java index 51470baee..103b1bf17 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java @@ -1,49 +1,50 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; public class ToolCrafting{ public static void init(){ - if(ConfigValues.enableToolEmeraldRecipe){ + if(ConfigCrafting.TOOL_EMERALD.isEnabled()){ //Pickaxe - GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeEmerald), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemPickaxeEmerald), "EEE", " S ", " S ", - 'E', new ItemStack(Items.emerald), - 'S', new ItemStack(Items.stick)); + 'E', "gemEmerald", + 'S', new ItemStack(Items.stick))); //Sword - GameRegistry.addRecipe(new ItemStack(InitItems.itemSwordEmerald), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSwordEmerald), "E", "E", "S", - 'E', new ItemStack(Items.emerald), - 'S', new ItemStack(Items.stick)); + 'E', "gemEmerald", + 'S', new ItemStack(Items.stick))); //Axe - GameRegistry.addRecipe(new ItemStack(InitItems.itemAxeEmerald), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemAxeEmerald), "EE", "ES", " S", - 'E', new ItemStack(Items.emerald), - 'S', new ItemStack(Items.stick)); + 'E', "gemEmerald", + 'S', new ItemStack(Items.stick))); //Shovel - GameRegistry.addRecipe(new ItemStack(InitItems.itemShovelEmerald), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemShovelEmerald), "E", "S", "S", - 'E', new ItemStack(Items.emerald), - 'S', new ItemStack(Items.stick)); + 'E', "gemEmerald", + 'S', new ItemStack(Items.stick))); //Hoe - GameRegistry.addRecipe(new ItemStack(InitItems.itemHoeEmerald), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemHoeEmerald), "EE", " S", " S", - 'E', new ItemStack(Items.emerald), - 'S', new ItemStack(Items.stick)); + 'E', "gemEmerald", + 'S', new ItemStack(Items.stick))); } - if(ConfigValues.enableToolObsidianRecipe){ + if(ConfigCrafting.TOOL_OBSIDIAN.isEnabled()){ //Pickaxe GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeObsidian), "EEE", " S ", " S ", diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 0a03afdb3..a6f6b816a 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -27,19 +27,27 @@ public class CreativeTab extends CreativeTabs{ this.list = list; this.addBlock(InitBlocks.blockInputter); + this.addBlock(InitBlocks.blockInputterAdvanced); + this.addBlock(InitBlocks.blockGreenhouseGlass); this.addBlock(InitBlocks.blockGrinder); this.addBlock(InitBlocks.blockGrinderDouble); this.addBlock(InitBlocks.blockFurnaceDouble); - this.addBlock(InitBlocks.blockFurnaceSolar); - this.addBlock(InitBlocks.blockFishingNet); - this.addBlock(InitBlocks.blockHeatCollector); + + //TODO Re-add + //this.addBlock(InitBlocks.blockFurnaceSolar); + //this.addBlock(InitBlocks.blockHeatCollector); this.addBlock(InitBlocks.blockItemRepairer); + this.addBlock(InitBlocks.blockFishingNet); + this.addBlock(InitBlocks.blockBreaker); + this.addBlock(InitBlocks.blockPlacer); + this.addBlock(InitBlocks.blockDropper); this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockFeeder); this.addBlock(InitBlocks.blockCompost); this.addBlock(InitBlocks.blockGiantChest); + this.addItem(InitItems.itemSpeedUpgrade); this.addItem(InitItems.itemMisc); this.addItem(InitItems.itemFertilizer); this.addItem(InitItems.itemFoods); @@ -64,6 +72,8 @@ public class CreativeTab extends CreativeTabs{ this.addItem(InitItems.itemPotionRing); this.addItem(InitItems.itemPotionRingAdvanced); + + this.addItem(InitItems.itemJams); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java index 32026b10e..12f44f3a9 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java @@ -2,40 +2,27 @@ package ellpeck.actuallyadditions.event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import ellpeck.actuallyadditions.achievement.InitAchievements; +import ellpeck.actuallyadditions.achievement.TheAchievements; +import net.minecraft.item.ItemStack; public class CraftEvent{ @SubscribeEvent public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ - /*if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.DOUGH.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftDough, 1); + checkAchievements(event.crafting, event, InitAchievements.CRAFTING_ACH); + } + + public static void checkAchievements(ItemStack gotten, PlayerEvent event, int type){ + for(int i = 0; i < TheAchievements.values().length; i++){ + TheAchievements ach = TheAchievements.values()[i]; + if(ach.type == type){ + if(gotten.getItem() == ach.ach.theItemStack.getItem()){ + if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){ + event.player.addStat(ach.ach, 1); + } + } + } } - if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftMashedFood, 1); - } - if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.KNIFE_BLADE.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftKnifeBlade, 1); - } - if(event.crafting.getItem() == InitItems.itemKnife){ - event.player.addStat(InitAchievements.achievementCraftKnife, 1); - } - if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.SUBMARINE_SANDWICH.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftSubSandwich, 1); - } - if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.PAPER_CONE.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftPaperCone, 1); - } - if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRY.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftFrenchFry, 1); - } - if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRIES.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftFrenchFries, 1); - } - if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FISH_N_CHIPS.ordinal()){ - event.player.addStat(InitAchievements.achievementCraftFishNChips, 1); - } - if(event.crafting.getItem()== Item.getItemFromBlock(InitBlocks.blockCompost)){ - event.player.addStat(InitAchievements.achievementCraftCompost, 1); - }*/ } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java index f746dc286..71c28a16d 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java @@ -10,6 +10,8 @@ public class InitEvents{ Util.registerEvent(new SmeltEvent()); Util.registerEvent(new CraftEvent()); Util.registerEvent(new KilledEvent()); + Util.registerEvent(new PickupEvent()); + Util.registerEvent(new TooltipEvent()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/PickupEvent.java b/src/main/java/ellpeck/actuallyadditions/event/PickupEvent.java new file mode 100644 index 000000000..1eea58cf6 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/PickupEvent.java @@ -0,0 +1,14 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; +import ellpeck.actuallyadditions.achievement.InitAchievements; + +public class PickupEvent{ + + @SubscribeEvent + public void onCraftedEvent(PlayerEvent.ItemPickupEvent event){ + CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event, InitAchievements.PICKUP_ACH); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java index 12e46eb73..d26b563b2 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -39,7 +39,7 @@ public class RenderPlayerEventAA{ //dqmhose if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ - hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.25F); + hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.3F); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java b/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java index a88ba7606..c23398842 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java @@ -2,13 +2,12 @@ package ellpeck.actuallyadditions.event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import ellpeck.actuallyadditions.achievement.InitAchievements; public class SmeltEvent{ @SubscribeEvent public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){ - /*if(event.smelting.getItem() == InitItems.itemFoods && event.smelting.getItemDamage() == TheFoods.BAGUETTE.ordinal()){ - event.player.addStat(InitAchievements.achievementSmeltBaguette, 1); - }*/ + CraftEvent.checkAchievements(event.smelting, event, InitAchievements.SMELTING_ACH); } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java new file mode 100644 index 000000000..b4f7c3ec3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java @@ -0,0 +1,26 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.util.StatCollector; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.oredict.OreDictionary; + +public class TooltipEvent{ + + @SubscribeEvent + public void onTooltipEvent(ItemTooltipEvent event){ + if(KeyUtil.isControlPressed()){ + int[] oreIDs = OreDictionary.getOreIDs(event.itemStack); + if(oreIDs.length > 0){ + event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".oredictName.desc") + ":"); + for(int oreID : oreIDs){ + event.toolTip.add(StringUtil.GRAY + "-" + OreDictionary.getOreName(oreID)); + } + } + else event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".noOredictNameAvail.desc")); + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java index ceccb05fd..f01ba74ce 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java @@ -6,7 +6,6 @@ import net.minecraft.client.model.ModelRenderer; public class ModelStandardBlock extends ModelBaseAA{ public ModelRenderer s; - private String name; public ModelStandardBlock(String name){ diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java index bd81aa449..d2ca7e8ec 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -22,9 +22,9 @@ public class RenderSpecial{ public void render(EntityPlayer player, float renderTick, float size, float offsetUp){ int bobHeight = 70; - double rotationModifier = 2; + long theTime = Minecraft.getSystemTime(); + long time = theTime/50; - long time = player.worldObj.getTotalWorldTime(); if(time-bobHeight >= lastTimeForBobbing){ this.lastTimeForBobbing = time; } @@ -37,7 +37,7 @@ public class RenderSpecial{ GL11.glTranslated(playerPos.xCoord-clientPos.xCoord, playerPos.yCoord-clientPos.yCoord+1.6225, playerPos.zCoord-clientPos.zCoord); } - GL11.glTranslated(0F, offsetUp+0.15D, 0F); + GL11.glTranslated(0F, offsetUp + 0.15D, 0F); GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); GL11.glScalef(size, size, size); @@ -49,7 +49,7 @@ public class RenderSpecial{ GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0); } - GL11.glRotated((double)time*rotationModifier, 0, 1, 0); + GL11.glRotated((double)theTime/20, 0, 1, 0); Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); theModel.render(0.0625F); diff --git a/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java b/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java new file mode 100644 index 000000000..3d58b94d7 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gen/InitVillager.java @@ -0,0 +1,43 @@ +package ellpeck.actuallyadditions.gen; + +import cpw.mods.fml.common.registry.VillagerRegistry; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.metalists.TheJams; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.gen.structure.MapGenStructureIO; +import net.minecraftforge.common.ChestGenHooks; + +import java.util.Random; + +public class InitVillager{ + + public static ChestGenHooks jamHouseChest; + + public static void init(){ + Util.logInfo("Initializing Village Addons..."); + + if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){ + + int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue(); + VillagerRegistry.instance().registerVillagerId(jamID); + VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler()); + + jamHouseChest = new ChestGenHooks("JamHouse", new WeightedRandomChestContent[0], 5, 20); + for(int i = 0; i < TheJams.values().length; i++){ + jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, new Random().nextInt(5)+1, i), 1, 1, 15)); + } + jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.glass_bottle, new Random().nextInt(5)+1), 1, 1, 15)); + jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.potionitem, new Random().nextInt(5)+1), 1, 1, 15)); + + VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler()); + MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER + ":jamHouseStructure"); + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java new file mode 100644 index 000000000..dccd4fdee --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java @@ -0,0 +1,85 @@ +package ellpeck.actuallyadditions.gen; + +import cpw.mods.fml.common.registry.VillagerRegistry; +import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.metalists.TheJams; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.Random; + +public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHandler{ + + private ArrayList trades = new ArrayList(); + + public JamVillagerTradeHandler(){ + this.addWants("ingotGold", 3, 2); + this.addWants("cropWheat", 10, 10); + this.addWants("dustRedstone", 15, 15); + this.addWants(new ItemStack(Items.bucket), 1, 4); + this.addWants(new ItemStack(Items.glass_bottle), 5, 5); + this.addWants(new ItemStack(Items.potionitem), 1, 0); + this.addWants("ingotIron", 5, 5); + this.addWants("gemDiamond", 1, 1); + this.addWants("dustGlowstone", 5, 10); + } + + @Override + @SuppressWarnings("all") + public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){ + for(int i = 0; i < trades.size(); i++){ + for(int j = 0; j < trades.get(i).wants.size(); j++){ + ItemStack wantsTwo = null; + ItemStack wantsOne = trades.get(i).wants.get(j); + + wantsOne.stackSize = rand.nextInt(trades.get(i).extraStackSize) + trades.get(i).baseStackSize; + if(rand.nextInt(3) == 0){ + int toGet = rand.nextInt(trades.size()); + for(int k = 0; k < trades.get(toGet).wants.size(); k++){ + wantsTwo = trades.get(toGet).wants.get(k); + wantsTwo.stackSize = rand.nextInt(trades.get(k).extraStackSize) + trades.get(k).baseStackSize; + } + } + if(wantsOne == wantsTwo) wantsTwo = null; + + for(int k = 0; k < TheJams.values().length; k++){ + recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(5)+1, k))); + } + } + } + } + + public void addWants(String oredictName, int minSize, int maxSize){ + ArrayList stacks = OreDictionary.getOres(oredictName); + trades.add(new Trade(stacks, minSize, maxSize)); + } + + public void addWants(ItemStack stack, int minSize, int maxSize){ + trades.add(new Trade(stack, minSize, maxSize)); + } + + public static class Trade{ + + public final ArrayList wants = new ArrayList(); + public final int baseStackSize; + public final int extraStackSize; + + public Trade(ArrayList wants, int minStackSize, int maxStackSize){ + this.wants.addAll(wants); + this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize; + this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize; + } + + public Trade(ItemStack want, int minStackSize, int maxStackSize){ + this.wants.add(want); + this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize; + this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize; + } + + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java index 2f882b001..1559282b5 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java @@ -4,7 +4,8 @@ import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; @@ -36,7 +37,7 @@ public class OreGen implements IWorldGenerator{ } private void generateSurface(World world, Random random, int x, int z){ - if(ConfigValues.generateBlackQuartz) this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, this.getRandom(ConfigValues.blackQuartzBaseAmount, ConfigValues.blackQuartzAdditionalChance, random), ConfigValues.blackQuartzChance, ConfigValues.blackQuartzMinHeight, ConfigValues.blackQuartzMaxHeight); + if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()) this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, this.getRandom(ConfigIntValues.BLACK_QUARTZ_BASE_AMOUNT.getValue(), ConfigIntValues.BLACK_QUARTZ_ADD_CHANCE.getValue(), random), ConfigIntValues.BLACK_QUARTZ_CHANCE.getValue(), ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue(), ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue()); } @SuppressWarnings("unused") diff --git a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java new file mode 100644 index 000000000..e2fda48a1 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java @@ -0,0 +1,193 @@ +package ellpeck.actuallyadditions.gen; + +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.StructureBoundingBox; +import net.minecraft.world.gen.structure.StructureComponent; +import net.minecraft.world.gen.structure.StructureVillagePieces; + +import java.util.List; +import java.util.Random; + +public class VillageComponentJamHouse extends StructureVillagePieces.House1{ + + private static final int xSize = 10; + private static final int ySize = 8; + private static final int zSize = 11; + + private int averageGroundLevel = -1; + + @SuppressWarnings("unused") + public VillageComponentJamHouse(){ + + } + + public VillageComponentJamHouse(StructureBoundingBox boundingBox, int par5){ + this.coordBaseMode = par5; + this.boundingBox = boundingBox; + } + + public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, int p4){ + StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize+1, ySize+1, zSize+1, p4); + return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ + if(this.averageGroundLevel < 0){ + this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); + if(this.averageGroundLevel < 0) return true; + this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize, 0); + } + + this.spawnActualHouse(world, rand, sbb); + + for (int i = 0; i < xSize; i++){ + for(int j = 0; j < zSize; j++){ + this.clearCurrentPositionBlocksUpwards(world, j, ySize, i, sbb); + this.func_151554_b(world, Blocks.cobblestone, 0, j, -1, i, sbb); + } + } + + this.spawnVillagers(world, sbb, 3, 1, 3, 1); + + return true; + } + + public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){ + //Base + this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.grass); + this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.cobblestone); + this.placeBlockAtCurrentPosition(world, Blocks.stone_stairs, this.getMetadataWithOffset(Blocks.stone_stairs, 3), 5, 0, 0, sbb); + this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.cobblestone); + this.fillWithMetadataBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.planks, 1, Blocks.planks, 1, false); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 5, 0, 1, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 4, 0, 7, sbb); + + //Garden Fence + this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.fence); + this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.fence); + this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.fence); + + //Side Walls + for(int i = 0; i < 2; i++){ + this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.planks); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i* 8, 2, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 6, sbb); + this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.glass_pane); + } + + //Front Wall + this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.planks); + this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.planks); + this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.planks); + this.placeDoorAtCurrentPosition(world, sbb, rand, 5, 1, 1, this.getMetadataWithOffset(Blocks.wooden_door, 1)); + + //Back Wall + this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.planks); + this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.planks); + this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.planks); + this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.cobblestone); + this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.glass_pane); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 8, 2, 7, sbb); + this.placeDoorAtCurrentPosition(world, sbb, rand, 4, 1, 7, this.getMetadataWithOffset(Blocks.wooden_door, 1)); + + //Fence Supports + this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.fence); + this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.fence); + this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.fence); + this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.fence); + + //Roof + this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.planks); + this.fillWithMetadataBlocks(world, sbb, 0, 4, 0, 10, 4, 0, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); + this.fillWithMetadataBlocks(world, sbb, 0, 5, 1, 10, 5, 1, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); + this.fillWithMetadataBlocks(world, sbb, 0, 6, 2, 10, 6, 2, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); + this.fillWithMetadataBlocks(world, sbb, 0, 4, 8, 10, 4, 8, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); + this.fillWithMetadataBlocks(world, sbb, 0, 5, 7, 10, 5, 7, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); + this.fillWithMetadataBlocks(world, sbb, 0, 6, 6, 10, 6, 6, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); + this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.wooden_slab); + + //Roof Gadgets + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 1, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 1, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 7, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 6, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 7, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 6, sbb); + this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.planks); + this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.planks); + + //Counter + this.fillWithMetadataBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false); + this.fillWithMetadataBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false); + this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.planks); + this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.planks); + this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.fence); + this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.fence); + this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.fence); + + //Decoration + this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 8, 1, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 8, 2, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 6, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 6, sbb); + this.fillWithMetadataBlocks(world, sbb, 2, 1, 3, 2, 1, 5, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), false); + this.fillWithMetadataBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.carpet, 10, Blocks.carpet, 10, false); + this.fillWithMetadataBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.carpet, 10, Blocks.carpet, 10, false); + + //Loot Chest + this.placeBlockAtCurrentPosition(world, Blocks.chest, 0, 8, 1, 6, sbb); + int posX = this.getXWithOffset(8, 6); + int posY = this.getYWithOffset(1); + int posZ = this.getZWithOffset(8, 6); + TileEntity chest = world.getTileEntity(posX, posY, posZ); + if(chest != null && chest instanceof TileEntityChest){ + WeightedRandomChestContent.generateChestContents(rand, InitVillager.jamHouseChest.getItems(rand), (TileEntityChest)chest, InitVillager.jamHouseChest.getCount(rand)); + } + + //Torches + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 2, 0, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 4, 2, 0, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 2, 8, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 2, 8, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 6, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 2, sbb); + this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 6, sbb); + } + + public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){ + this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false); + } + + @Override + protected int getVillagerType(int par1){ + return ConfigIntValues.JAM_VILLAGER_ID.getValue(); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gen/VillageJamHouseHandler.java b/src/main/java/ellpeck/actuallyadditions/gen/VillageJamHouseHandler.java new file mode 100644 index 000000000..c080323d6 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gen/VillageJamHouseHandler.java @@ -0,0 +1,25 @@ +package ellpeck.actuallyadditions.gen; + +import cpw.mods.fml.common.registry.VillagerRegistry; +import net.minecraft.world.gen.structure.StructureVillagePieces; + +import java.util.List; +import java.util.Random; + +public class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{ + + @Override + public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){ + return new StructureVillagePieces.PieceWeight(VillageComponentJamHouse.class, 5, 1); + } + + @Override + public Class getComponentClass(){ + return VillageComponentJamHouse.class; + } + + @Override + public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){ + return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, p4); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java new file mode 100644 index 000000000..224a8f0dd --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java @@ -0,0 +1,78 @@ +package ellpeck.actuallyadditions.inventory; + +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityBreaker; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +@InventoryContainer +public class ContainerBreaker extends Container{ + + private TileEntityBreaker breaker; + + public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){ + this.breaker = (TileEntityBreaker)tile; + + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + this.addSlotToContainer(new Slot(this.breaker, j+i*3, 62+j*18, 21+i*18)); + } + } + + 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 boolean canInteractWith(EntityPlayer player){ + return this.breaker.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 9; + 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){ + this.mergeItemStack(newStack, 0, 9+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/ContainerCrafter.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java index 874aee73d..29338aa30 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.inventory; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.*; @@ -7,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.world.World; +@InventoryContainer public class ContainerCrafter extends Container{ public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java new file mode 100644 index 000000000..47dde5e19 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java @@ -0,0 +1,78 @@ +package ellpeck.actuallyadditions.inventory; + +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityDropper; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +@InventoryContainer +public class ContainerDropper extends Container{ + + private TileEntityDropper dropper; + + public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){ + this.dropper = (TileEntityDropper)tile; + + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + this.addSlotToContainer(new Slot(this.dropper, j+i*3, 62+j*18, 21+i*18)); + } + } + + 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 boolean canInteractWith(EntityPlayer player){ + return this.dropper.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 9; + 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){ + this.mergeItemStack(newStack, 0, 9+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/ContainerFeeder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java index e33ea433d..ae0d3528f 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFeeder; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -11,6 +12,7 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +@InventoryContainer public class ContainerFeeder extends Container{ private TileEntityFeeder tileFeeder; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java index d923304b1..c2e2fbc89 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java @@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -14,6 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; +@InventoryContainer public class ContainerFurnaceDouble extends Container{ private TileEntityFurnaceDouble tileFurnace; @@ -22,6 +24,7 @@ public class ContainerFurnaceDouble extends Container{ private int lastCoalTimeLeft; private int lastFirstCrushTime; private int lastSecondCrushTime; + private int lastBurnTime; public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){ this.tileFurnace = (TileEntityFurnaceDouble)tile; @@ -33,6 +36,8 @@ public class ContainerFurnaceDouble extends Container{ this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21)); this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69)); + this.addSlotToContainer(new Slot(this.tileFurnace, this.tileFurnace.speedUpgradeSlot, 155, 21)); + 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)); @@ -50,6 +55,7 @@ public class ContainerFurnaceDouble extends Container{ iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft); iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime); iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime); + iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime); } @Override @@ -62,12 +68,14 @@ public class ContainerFurnaceDouble extends Container{ if(this.lastCoalTimeLeft != this.tileFurnace.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft); if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime); if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime); + if(this.lastBurnTime != this.tileFurnace.maxBurnTime) iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime); } this.lastCoalTime = this.tileFurnace.coalTime; this.lastCoalTimeLeft = this.tileFurnace.coalTimeLeft; this.lastFirstCrushTime = this.tileFurnace.firstSmeltTime; this.lastSecondCrushTime = this.tileFurnace.secondSmeltTime; + this.lastBurnTime = this.tileFurnace.maxBurnTime; } @Override @@ -77,6 +85,7 @@ public class ContainerFurnaceDouble extends Container{ if(par1 == 1) this.tileFurnace.coalTimeLeft = par2; if(par1 == 2) this.tileFurnace.firstSmeltTime = par2; if(par1 == 3) this.tileFurnace.secondSmeltTime = par2; + if(par1 == 4) this.tileFurnace.maxBurnTime = par2; } @Override @@ -86,7 +95,7 @@ public class ContainerFurnaceDouble extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = 5; + final int inventoryStart = 6; final int inventoryEnd = inventoryStart+26; final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java index 27ee0269b..3d5d510a8 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java @@ -2,12 +2,14 @@ package ellpeck.actuallyadditions.inventory; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; +import invtweaks.api.container.ChestContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +@ChestContainer(rowSize = 13) public class ContainerGiantChest extends Container{ public TileEntityGiantChest tileChest; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index 2718c0dc2..a3e0c6abb 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.recipe.GrinderRecipes; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityGrinder; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -14,6 +15,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; +@InventoryContainer public class ContainerGrinder extends Container{ private TileEntityGrinder tileGrinder; @@ -23,6 +25,7 @@ public class ContainerGrinder extends Container{ private int lastCoalTimeLeft; private int lastFirstCrushTime; private int lastSecondCrushTime; + private int lastMaxCrushTime; public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){ this.tileGrinder = (TileEntityGrinder)tile; @@ -39,6 +42,8 @@ public class ContainerGrinder extends Container{ this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69)); } + this.addSlotToContainer(new Slot(this.tileGrinder, this.tileGrinder.speedUpgradeSlot, this.isDouble ? 155 : 146, 21)); + 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)); @@ -55,7 +60,8 @@ public class ContainerGrinder extends Container{ iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime); iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft); iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime); - if(this.isDouble) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime); + iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime); + if(this.isDouble) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime); } @Override @@ -67,12 +73,14 @@ public class ContainerGrinder extends Container{ if(this.lastCoalTime != this.tileGrinder.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime); if(this.lastCoalTimeLeft != this.tileGrinder.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft); if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime); - if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime); + if(this.lastMaxCrushTime != this.tileGrinder.maxCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime); + if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime); } this.lastCoalTime = this.tileGrinder.coalTime; this.lastCoalTimeLeft = this.tileGrinder.coalTimeLeft; this.lastFirstCrushTime = this.tileGrinder.firstCrushTime; + this.lastMaxCrushTime = this.tileGrinder.maxCrushTime; if(this.isDouble) this.lastSecondCrushTime = this.tileGrinder.secondCrushTime; } @@ -82,7 +90,8 @@ public class ContainerGrinder extends Container{ if(par1 == 0) this.tileGrinder.coalTime = par2; if(par1 == 1) this.tileGrinder.coalTimeLeft = par2; if(par1 == 2) this.tileGrinder.firstCrushTime = par2; - if(this.isDouble && par1 == 3) this.tileGrinder.secondCrushTime = par2; + if(par1 == 3) this.tileGrinder.maxCrushTime = par2; + if(this.isDouble && par1 == 4) this.tileGrinder.secondCrushTime = par2; } @Override @@ -92,7 +101,7 @@ public class ContainerGrinder extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = this.isDouble ? 7 : 4; + final int inventoryStart = this.isDouble ? 8 : 5; final int inventoryEnd = inventoryStart+26; final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java index f71db1cc6..648ea273a 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java @@ -2,8 +2,10 @@ package ellpeck.actuallyadditions.inventory; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.slot.SlotFilter; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityInputter; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -11,6 +13,7 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +@InventoryContainer public class ContainerInputter extends Container{ private TileEntityInputter tileInputter; @@ -22,18 +25,32 @@ public class ContainerInputter extends Container{ private int lastPlaceToPutSlotAmount; private int lastPlaceToPullSlotAmount; - public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile){ + private boolean isAdvanced; + + public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile, boolean isAdvanced){ this.tileInputter = (TileEntityInputter)tile; + this.isAdvanced = isAdvanced; - this.addSlotToContainer(new Slot(this.tileInputter, 0, 80, 21)); + this.addSlotToContainer(new Slot(this.tileInputter, 0, 80, 21 + (isAdvanced ? 12 : 0))); - 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)); + if(isAdvanced){ + for(int i = 0; i < 2; i++){ + this.addSlotToContainer(new SlotFilter(this.tileInputter, 1+i*6, 20+i*84, 6)); + this.addSlotToContainer(new SlotFilter(this.tileInputter, 2+i*6, 38+i*84, 6)); + this.addSlotToContainer(new SlotFilter(this.tileInputter, 3+i*6, 56+i*84, 6)); + this.addSlotToContainer(new SlotFilter(this.tileInputter, 4+i*6, 20+i*84, 24)); + this.addSlotToContainer(new SlotFilter(this.tileInputter, 5+i*6, 38+i*84, 24)); + this.addSlotToContainer(new SlotFilter(this.tileInputter, 6+i*6, 56+i*84, 24)); } } - for (int i = 0; i < 9; i++){ - this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); + + for(int i = 0; i < 3; i++){ + for (int j = 0; j < 9; j++){ + this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18 + (isAdvanced ? 12 : 0))); + } + } + for(int i = 0; i < 9; i++){ + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? 12 : 0))); } } @@ -87,7 +104,7 @@ public class ContainerInputter extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = 1; + final int inventoryStart = this.isAdvanced ? 13 : 1; final int inventoryEnd = inventoryStart+26; final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java index b1ea0abc3..0eb861132 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java @@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; +import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -13,6 +14,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; +@InventoryContainer public class ContainerRepairer extends Container{ private TileEntityItemRepairer tileRepairer; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiBreaker.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiBreaker.java new file mode 100644 index 000000000..9975882b7 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiBreaker.java @@ -0,0 +1,47 @@ +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.TileEntityBreaker; +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 GuiBreaker extends GuiContainer{ + + private TileEntityBreaker breaker; + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); + + public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerBreaker(inventory, tile)); + this.breaker = (TileEntityBreaker)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.breaker.getInventoryName()); + } + + @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); + } + + @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/inventory/GuiCrafter.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiCrafter.java index a9f94cc28..6a3357f93 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiCrafter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiCrafter.java @@ -2,6 +2,8 @@ package ellpeck.actuallyadditions.inventory; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; @@ -19,6 +21,11 @@ public class GuiCrafter extends GuiContainer{ this.ySize = 166; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 74, -10, "container." + ModUtil.MOD_ID_LOWER + ".crafting"); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiDropper.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiDropper.java new file mode 100644 index 000000000..eb7543178 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiDropper.java @@ -0,0 +1,47 @@ +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.TileEntityDropper; +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 GuiDropper extends GuiContainer{ + + private TileEntityDropper dropper; + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); + + public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerDropper(inventory, tile)); + this.dropper = (TileEntityDropper)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.dropper.getInventoryName()); + } + + @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); + } + + @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/inventory/GuiFeeder.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java index e9e65625e..288a1a8b2 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java @@ -29,6 +29,11 @@ public class GuiFeeder extends GuiContainer{ this.ySize = 70+86; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 70-5, -10, this.tileFeeder.getInventoryName()); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java index 4dc51d6d5..3afe84460 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java @@ -23,6 +23,11 @@ public class GuiFurnaceDouble extends GuiContainer{ this.ySize = 93+86; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileFurnace.getInventoryName()); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java index a5d8cd670..9d85dc943 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java @@ -3,6 +3,7 @@ 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.TileEntityGiantChest; import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; @@ -14,13 +15,21 @@ public class GuiGiantChest extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest"); + TileEntityGiantChest chest; + public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerGiantChest(inventory, tile)); + this.chest = (TileEntityGiantChest)tile; this.xSize = 242; this.ySize = 172+86; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 172-5, -10, this.chest.getInventoryName()); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java index 76e16a332..b9f723df7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java @@ -26,6 +26,11 @@ public class GuiGrinder extends GuiContainer{ this.ySize = 93+86; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileGrinder.getInventoryName()); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index ae06c7865..7a3e81c66 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -33,10 +33,19 @@ public class GuiHandler implements IGuiHandler{ return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace); case INPUTTER_ID: TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); - return new ContainerInputter(entityPlayer.inventory, tileInputter); + return new ContainerInputter(entityPlayer.inventory, tileInputter, false); + case INPUTTER_ADVANCED_ID: + TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z); + return new ContainerInputter(entityPlayer.inventory, tileInputterAdvanced, true); case REPAIRER_ID: TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); return new ContainerRepairer(entityPlayer.inventory, tileRepairer); + case BREAKER_ID: + TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z); + return new ContainerBreaker(entityPlayer.inventory, tileBreaker); + case DROPPER_ID: + TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z); + return new ContainerDropper(entityPlayer.inventory, tileDropper); default: return null; } @@ -64,10 +73,19 @@ public class GuiHandler implements IGuiHandler{ return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace); case INPUTTER_ID: TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); - return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world); + return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world, false); + case INPUTTER_ADVANCED_ID: + TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z); + return new GuiInputter(entityPlayer.inventory, tileInputterAdvanced, x, y, z, world, true); case REPAIRER_ID: TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); return new GuiRepairer(entityPlayer.inventory, tileRepairer); + case BREAKER_ID: + TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z); + return new GuiBreaker(entityPlayer.inventory, tileBreaker); + case DROPPER_ID: + TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z); + return new GuiDropper(entityPlayer.inventory, tileDropper); default: return null; } @@ -81,6 +99,9 @@ public class GuiHandler implements IGuiHandler{ public static final int FURNACE_DOUBLE_ID = 5; public static final int INPUTTER_ID = 6; public static final int REPAIRER_ID = 7; + public static final int INPUTTER_ADVANCED_ID = 8; + public static final int BREAKER_ID = 9; + public static final int DROPPER_ID = 10; public static void init(){ Util.logInfo("Initializing GuiHandler..."); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java index fba4f7905..4b036a739 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java @@ -23,6 +23,8 @@ import org.lwjgl.opengl.GL11; public class GuiInputter extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); + private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced"); + private TileEntityInputter tileInputter; private int x; @@ -35,6 +37,8 @@ public class GuiInputter extends GuiContainer{ private SmallerButton buttonSlotPutM; private SmallerButton buttonSlotPullM; + private boolean isAdvanced; + public static final String[] sideString = new String[]{ StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"), StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"), @@ -44,15 +48,21 @@ public class GuiInputter extends GuiContainer{ StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.south"), StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.west")}; - public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){ - super(new ContainerInputter(inventory, tile)); + public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){ + super(new ContainerInputter(inventory, tile, isAdvanced)); this.tileInputter = (TileEntityInputter)tile; this.x = x; this.y = y; this.z = z; this.world = world; this.xSize = 176; - this.ySize = 93+86; + this.ySize = 93+86 + (isAdvanced ? 12 : 0); + this.isAdvanced = isAdvanced; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, this.isAdvanced ? 105-5 : 93-5, -10, this.tileInputter.getInventoryName()); } @SuppressWarnings("unchecked") @@ -60,15 +70,15 @@ public class GuiInputter extends GuiContainer{ public void initGui(){ super.initGui(); - SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43, ">"); - SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43, "<"); - buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64, "+"); - buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64, "-"); + SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43 + (isAdvanced ? 12 : 0), ">"); + SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43 + (isAdvanced ? 12 : 0), "<"); + buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64 + (isAdvanced ? 12 : 0), "+"); + buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64 + (isAdvanced ? 12 : 0), "-"); - SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43, ">"); - SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43, "<"); - buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64, "+"); - buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64, "-"); + SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43 + (isAdvanced ? 12 : 0), ">"); + SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43 + (isAdvanced ? 12 : 0), "<"); + buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64 + (isAdvanced ? 12 : 0), "+"); + buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64 + (isAdvanced ? 12 : 0), "-"); this.buttonList.add(buttonSidePutP); this.buttonList.add(buttonSlotPutP); @@ -85,19 +95,19 @@ public class GuiInputter extends GuiContainer{ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+93 + (isAdvanced ? 12 : 0), 0, 0, 176, 86); - this.mc.getTextureManager().bindTexture(resLoc); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93 + (isAdvanced ? 12 : 0)); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32, 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752); - this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 3, 4210752); + this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752); - this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 3, 4210752); + this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java index 7d403e042..81151158b 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiRepairer.java @@ -23,6 +23,11 @@ public class GuiRepairer extends GuiContainer{ this.ySize = 93+86; } + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileRepairer.getInventoryName()); + } + @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotFilter.java b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotFilter.java new file mode 100644 index 000000000..ab1be1320 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotFilter.java @@ -0,0 +1,16 @@ +package ellpeck.actuallyadditions.inventory.slot; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +public class SlotFilter extends Slot{ + + public SlotFilter(IInventory inventory, int id, int x, int y){ + super(inventory, id, x, y); + } + + @Override + public int getSlotStackLimit(){ + return 1; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index 4b6d7a67b..c0062a2c5 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -15,6 +15,7 @@ public class InitItems{ public static Item itemFertilizer; public static Item itemMisc; public static Item itemFoods; + public static Item itemJams; public static Item itemKnife; public static Item itemCrafterOnAStick; public static Item itemDust; @@ -37,6 +38,8 @@ public class InitItems{ public static Item itemSwordObsidian; public static Item itemHoeObsidian; + public static Item itemSpeedUpgrade; + public static void init(){ Util.logInfo("Initializing Items..."); @@ -44,10 +47,13 @@ public class InitItems{ ItemUtil.register(itemFertilizer); itemMisc = new ItemMisc(); - ItemUtil.register(itemMisc); + ItemUtil.register(itemMisc, ItemMisc.allMiscItems); itemFoods = new ItemFoods(); - ItemUtil.register(itemFoods); + ItemUtil.register(itemFoods, ItemFoods.allFoods); + + itemJams = new ItemJams(); + ItemUtil.register(itemJams, ItemJams.allJams); itemKnife = new ItemKnife(); ItemUtil.register(itemKnife); @@ -56,10 +62,10 @@ public class InitItems{ ItemUtil.register(itemCrafterOnAStick); itemDust = new ItemDust(); - ItemUtil.register(itemDust); + ItemUtil.register(itemDust, ItemDust.allDusts); itemSpecialDrop = new ItemSpecialDrop(); - ItemUtil.register(itemSpecialDrop); + ItemUtil.register(itemSpecialDrop, ItemSpecialDrop.allDrops); itemLeafBlower = new ItemLeafBlower(false); ItemUtil.register(itemLeafBlower); @@ -73,6 +79,9 @@ public class InitItems{ itemPotionRingAdvanced = new ItemPotionRing(true); ItemUtil.register(itemPotionRingAdvanced); + itemSpeedUpgrade = new ItemUpgrade(ItemUpgrade.UpgradeType.SPEED, "itemUpgradeSpeed", 2+3); + ItemUtil.register(itemSpeedUpgrade); + 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/ItemCrafterOnAStick.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java index cb7f05fe9..04e43ba5d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,7 +17,7 @@ import net.minecraft.world.World; import java.util.List; -public class ItemCrafterOnAStick extends Item implements IName{ +public class ItemCrafterOnAStick extends Item implements INameableItem{ public ItemCrafterOnAStick(){ this.setMaxStackSize(1); @@ -27,7 +27,7 @@ public class ItemCrafterOnAStick extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(ItemUtil.addStandardInformation(this)); + ItemUtil.addInformation(this, list, 1, ""); } @Override @@ -56,4 +56,9 @@ public class ItemCrafterOnAStick extends Item implements IName{ public String getName(){ return "itemCrafterOnAStick"; } + + @Override + public String getOredictName(){ + return this.getName(); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java index 35fcc18df..97e9b7dfd 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java @@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheDusts; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,11 +13,10 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import java.util.List; -public class ItemDust extends Item implements IName{ +public class ItemDust extends Item implements INameableItem{ public static final TheDusts[] allDusts = TheDusts.values(); @@ -31,6 +29,11 @@ public class ItemDust extends Item implements IName{ return "itemDust"; } + @Override + public String getOredictName(){ + return ""; + } + @Override public int getMetadata(int damage){ return damage; @@ -58,8 +61,7 @@ public class ItemDust extends Item implements IName{ @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() + allDusts[stack.getItemDamage()].getName() + ".desc")); - else list.add(ItemUtil.shiftForInfo()); + ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java index 72b8391cb..6d535bc9d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -16,7 +16,7 @@ import net.minecraft.world.World; import java.util.List; -public class ItemFertilizer extends Item implements IName{ +public class ItemFertilizer extends Item implements INameableItem{ @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ @@ -36,7 +36,7 @@ public class ItemFertilizer extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(ItemUtil.addStandardInformation(this)); + ItemUtil.addInformation(this, list, 1, ""); } @Override @@ -54,4 +54,9 @@ public class ItemFertilizer extends Item implements IName{ public String getName(){ return "itemFertilizer"; } + + @Override + public String getOredictName(){ + return this.getName(); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java index 86d4f73e2..0492eb531 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java @@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheFoods; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -18,7 +18,7 @@ import net.minecraft.world.World; import java.util.List; -public class ItemFoods extends ItemFood implements IName{ +public class ItemFoods extends ItemFood implements INameableItem{ public static final TheFoods[] allFoods = TheFoods.values(); public IIcon[] textures = new IIcon[allFoods.length]; @@ -30,6 +30,11 @@ public class ItemFoods extends ItemFood implements IName{ TheFoods.setReturnItems(); } + @Override + public String getOredictName(){ + return ""; + } + @Override public EnumRarity getRarity(ItemStack stack){ return allFoods[stack.getItemDamage()].rarity; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java new file mode 100644 index 000000000..5ce347cd3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java @@ -0,0 +1,138 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.metalists.TheJams; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +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 ItemJams extends ItemFood implements INameableItem{ + + public static final TheJams[] allJams = TheJams.values(); + public IIcon overlayIcon; + + public ItemJams(){ + super(0, 0.0F, false); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + @Override + public String getOredictName(){ + return ""; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return allJams[stack.getItemDamage()].rarity; + } + + @Override + public int func_150905_g(ItemStack stack){ + return allJams[stack.getItemDamage()].healAmount; + } + + @Override + public float func_150906_h(ItemStack stack){ + return allJams[stack.getItemDamage()].saturation; + } + + @Override + public int getMetadata(int damage){ + return damage; + } + + @SuppressWarnings("all") + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list){ + for (int j = 0; j < allJams.length; j++){ + list.add(new ItemStack(this, 1, j)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName() + allJams[stack.getItemDamage()].getName(); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass){ + return pass > 0 ? allJams[stack.getItemDamage()].color : super.getColorFromItemStack(stack, pass); + } + + @Override + public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){ + ItemStack stackToReturn = super.onEaten(stack, world, player); + + if(!world.isRemote){ + PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200); + player.addPotionEffect(firstEffectToGet); + + PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600); + player.addPotionEffect(secondEffectToGet); + + ItemStack returnItem = new ItemStack(Items.glass_bottle); + if(!player.inventory.addItemStackToInventory(returnItem.copy())){ + EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy()); + entityItem.delayBeforeCanPickup = 0; + player.worldObj.spawnEntityInWorld(entityItem); + } + } + return stackToReturn; + } + + @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() + allJams[stack.getItemDamage()].getName() + ".desc")); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.2")); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".hunger.desc") + ": " + allJams[stack.getItemDamage()].healAmount); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allJams[stack.getItemDamage()].saturation); + } + else list.add(ItemUtil.shiftForInfo()); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int damage, int pass){ + return pass > 0 ? this.overlayIcon : super.getIconFromDamageForRenderPass(damage, pass); + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconReg){ + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.overlayIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Overlay"); + } + + @Override + public String getName(){ + return "itemJam"; + } +} \ 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 dc95fe564..a73b250a2 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java @@ -2,8 +2,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -17,10 +17,10 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemKnife extends Item implements IName{ +public class ItemKnife extends Item implements INameableItem{ public ItemKnife(){ - this.setMaxDamage(ConfigValues.knifeMaxDamage); + this.setMaxDamage(ConfigIntValues.KNIFE_DAMAGE.getValue()); this.setMaxStackSize(1); this.setContainerItem(this); } @@ -38,6 +38,11 @@ public class ItemKnife extends Item implements IName{ return false; } + @Override + public String getOredictName(){ + return this.getName(); + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java index ca9fe635b..945a1ae9b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -2,7 +2,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.*; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; @@ -21,15 +22,14 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -import java.util.Random; -public class ItemLeafBlower extends Item implements IName{ +public class ItemLeafBlower extends Item implements INameableItem{ - public final int range = ConfigValues.leafBlowerRangeSides; - public final int rangeUp = ConfigValues.leafBlowerRangeUp; - public final boolean doesDrop = ConfigValues.leafBlowerDropItems; - public final boolean hasParticles = ConfigValues.leafBlowerParticles; - public final boolean hasSound = ConfigValues.leafBlowerHasSound; + public final int range = ConfigIntValues.LEAF_BLOWER_RANGE_SIDES.getValue(); + public final int rangeUp = ConfigIntValues.LEAF_BLOWER_RANGE_UP.getValue(); + public final boolean doesDrop = ConfigBoolValues.LEAF_BLOWER_ITEMS.isEnabled(); + public final boolean hasParticles = ConfigBoolValues.LEAF_BLOWER_PARTICLES.isEnabled(); + public final boolean hasSound = ConfigBoolValues.LEAF_BLOWER_SOUND.isEnabled(); private final boolean isAdvanced; @@ -48,46 +48,46 @@ public class ItemLeafBlower extends Item implements IName{ } } - public void breakStuff(World world, int x, int y, int z){ - ArrayList theCoords = new ArrayList(); + @Override + public String getOredictName(){ + return this.getName(); + } + public void breakStuff(World world, int x, int y, int z){ for(int reachX = -range; reachX < range+1; reachX++){ for(int reachZ = -range; reachZ < range+1; reachZ++){ for(int reachY = (this.isAdvanced ? -range : -rangeUp); reachY < (this.isAdvanced ? range+1 : rangeUp+1); reachY++){ Block block = world.getBlock(x+reachX, y+reachY, z+reachZ); if(block != null && (block instanceof BlockBush || (this.isAdvanced && block instanceof BlockLeavesBase))){ - theCoords.add(new ChunkCoordinates(x+reachX, y+reachY, z+reachZ)); + ChunkCoordinates theCoord = new ChunkCoordinates(x+reachX, y+reachY, z+reachZ); + Block theBlock = world.getBlock(theCoord.posX, theCoord.posY, theCoord.posZ); + ArrayList drops = new ArrayList(); + int meta = world.getBlockMetadata(theCoord.posX, theCoord.posY, theCoord.posZ); + drops.addAll(theBlock.getDrops(world, theCoord.posX, theCoord.posY, theCoord.posZ, meta, 0)); + + world.setBlockToAir(theCoord.posX, theCoord.posY, theCoord.posZ); + if(this.hasParticles) world.playAuxSFX(2001, theCoord.posX, theCoord.posY, theCoord.posZ, Block.getIdFromBlock(theBlock)+(meta << 12)); + + if(this.doesDrop){ + for(ItemStack theDrop : drops){ + world.spawnEntityInWorld(new EntityItem(world, theCoord.posX + 0.5, theCoord.posY + 0.5, theCoord.posZ + 0.5, theDrop)); + } + } + return; } } } } - - if(theCoords.size() > 0){ - ChunkCoordinates theCoord = theCoords.get(new Random().nextInt(theCoords.size())); - Block theBlock = world.getBlock(theCoord.posX, theCoord.posY, theCoord.posZ); - ArrayList drops = new ArrayList(); - int meta = world.getBlockMetadata(theCoord.posX, theCoord.posY, theCoord.posZ); - drops.addAll(theBlock.getDrops(world, theCoord.posX, theCoord.posY, theCoord.posZ, meta, 0)); - - world.setBlockToAir(theCoord.posX, theCoord.posY, theCoord.posZ); - if(this.hasParticles) world.playAuxSFX(2001, theCoord.posX, theCoord.posY, theCoord.posZ, Block.getIdFromBlock(theBlock)+(meta << 12)); - - if(this.doesDrop){ - for(ItemStack theDrop : drops){ - world.spawnEntityInWorld(new EntityItem(world, theCoord.posX + 0.5, theCoord.posY + 0.5, theCoord.posZ + 0.5, theDrop)); - } - } - } } @Override public int getMaxItemUseDuration(ItemStack stack){ - return 100000; + return 1000000; } @Override public EnumAction getItemUseAction(ItemStack stack){ - return EnumAction.none; + return EnumAction.bow; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java index 733f77a18..2cf6110b6 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java @@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,11 +13,10 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import java.util.List; -public class ItemMisc extends Item implements IName{ +public class ItemMisc extends Item implements INameableItem{ public static final TheMiscItems[] allMiscItems = TheMiscItems.values(); public IIcon[] textures = new IIcon[allMiscItems.length]; @@ -32,6 +30,11 @@ public class ItemMisc extends Item implements IName{ return "itemMisc"; } + @Override + public String getOredictName(){ + return ""; + } + @Override public EnumRarity getRarity(ItemStack stack){ return allMiscItems[stack.getItemDamage()].rarity; @@ -59,8 +62,7 @@ public class ItemMisc extends Item implements IName{ @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() + allMiscItems[stack.getItemDamage()].getName() + ".desc")); - else list.add(ItemUtil.shiftForInfo()); + ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java index 1b217d314..785608fd1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java @@ -18,7 +18,7 @@ import net.minecraft.world.World; import java.util.List; -public class ItemPotionRing extends Item implements IName{ +public class ItemPotionRing extends Item implements INameableItem{ public static final ThePotionRings[] allRings = ThePotionRings.values(); @@ -30,23 +30,31 @@ public class ItemPotionRing extends Item implements IName{ this.isAdvanced = isAdvanced; } + @Override + public String getOredictName(){ + return this.getName(); + } + @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(); + if(!world.isRemote){ + 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)); + 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)); } - else thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true)); } } } @@ -83,15 +91,14 @@ public class ItemPotionRing extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + ItemUtil.addInformation(this, list, 2, ""); + 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 diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java index 3ee14cbe1..200273019 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -15,13 +14,12 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import java.util.List; import java.util.Random; -public class ItemSpecialDrop extends Item implements IName{ +public class ItemSpecialDrop extends Item implements INameableItem{ public static final TheSpecialDrops[] allDrops = TheSpecialDrops.values(); public IIcon[] textures = new IIcon[allDrops.length]; @@ -51,6 +49,11 @@ public class ItemSpecialDrop extends Item implements IName{ return allDrops[stack.getItemDamage()].rarity; } + @Override + public String getOredictName(){ + return ""; + } + @Override public int getMetadata(int damage){ return damage; @@ -73,8 +76,7 @@ public class ItemSpecialDrop extends Item implements IName{ @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() + allDrops[stack.getItemDamage()].getName() + ".desc")); - else list.add(ItemUtil.shiftForInfo()); + ItemUtil.addInformation(this, list, 1, allDrops[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemUpgrade.java new file mode 100644 index 000000000..96623e566 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemUpgrade.java @@ -0,0 +1,65 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class ItemUpgrade extends Item implements INameableItem{ + + private final String name; + public UpgradeType type; + private int textAmount; + + public ItemUpgrade(UpgradeType type, String name, int textAmount){ + this.name = name; + this.type = type; + this.textAmount = textAmount; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.rare; + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + ItemUtil.addInformation(this, list, this.textAmount, ""); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass){ + return this.itemIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconReg){ + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + public enum UpgradeType{ + SPEED + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java index 140981ac1..c20b577a5 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java @@ -1,32 +1,39 @@ package ellpeck.actuallyadditions.items.metalists; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.item.EnumRarity; -public enum TheDusts implements IName{ +public enum TheDusts implements INameableItem{ - IRON("Iron", 7826534, EnumRarity.common), - GOLD("Gold", 14335744, EnumRarity.uncommon), - DIAMOND("Diamond", 292003, EnumRarity.rare), - EMERALD("Emerald", 4319527, EnumRarity.epic), - LAPIS("Lapis", 1849791, EnumRarity.uncommon), - QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon), - COAL("Coal", 0, EnumRarity.uncommon), - QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare); + IRON("Iron", 7826534, EnumRarity.common, "dustIron"), + GOLD("Gold", 14335744, EnumRarity.uncommon, "dustGold"), + DIAMOND("Diamond", 292003, EnumRarity.rare, "dustDiamond"), + EMERALD("Emerald", 4319527, EnumRarity.epic, "dustEmerald"), + LAPIS("Lapis", 1849791, EnumRarity.uncommon, "dustLapis"), + QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon, "dustQuartz"), + COAL("Coal", 0, EnumRarity.uncommon, "dustCoal"), + QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare, "dustQuartzBlack"); public final String name; + public final String oredictName; public final int color; public final EnumRarity rarity; - TheDusts(String name, int color, EnumRarity rarity){ + TheDusts(String name, int color, EnumRarity rarity, String oredictName){ this.name = name; this.color = color; this.rarity = rarity; + this.oredictName = oredictName; } @Override public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java index 39f175b28..b9df1658a 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java @@ -1,29 +1,29 @@ package ellpeck.actuallyadditions.items.metalists; import ellpeck.actuallyadditions.items.InitItems; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -public enum TheFoods implements IName{ +public enum TheFoods implements INameableItem{ - CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common), - PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common), - CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.common), - FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.uncommon), - FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.common), - FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.common), - SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.common), - NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.common), - CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.uncommon), - CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.common), - TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common), - SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.uncommon), - BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon), - HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common), - PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon), - BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common); + CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common, "foodCheese"), + PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common, "foodPumpkinStew"), + CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.common, "foodCarrotJuice"), + FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.uncommon, "foodFishNChips"), + FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.common, "foodFrenchFries"), + FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.common, "foodFrenchFry"), + SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.common, "foodSpaghetti"), + NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.common, "foodNoodle"), + CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.uncommon, "foodChocolateCake"), + CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.common, "foodChocolate"), + TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common, "foodToast"), + SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.uncommon, "foodSubmarineSandwich"), + BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon, "foodBigCookie"), + HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common, "foodHamburger"), + PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon, "foodPizza"), + BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common, "foodBaguette"); public static void setReturnItems(){ SPAGHETTI.returnItem = new ItemStack(Items.bowl); @@ -34,6 +34,7 @@ public enum TheFoods implements IName{ } public final String name; + public final String oredictName; public final int healAmount; public final float saturation; public final boolean getsDrunken; @@ -41,17 +42,23 @@ public enum TheFoods implements IName{ public ItemStack returnItem; public final EnumRarity rarity; - TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){ + TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity, String oredictName){ this.name = name; this.getsDrunken = getsDrunken; this.healAmount = healAmount; this.saturation = saturation; this.useDuration = useDuration; this.rarity = rarity; + this.oredictName = oredictName; } @Override public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheJams.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheJams.java new file mode 100644 index 000000000..fc770f571 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheJams.java @@ -0,0 +1,44 @@ +package ellpeck.actuallyadditions.items.metalists; + +import ellpeck.actuallyadditions.util.INameableItem; +import net.minecraft.item.EnumRarity; + +public enum TheJams implements INameableItem{ + + CU_BA_RA("CuBaRa", 20, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273), + GRA_KI_BA("GraKiBa", 20, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820), + PL_AP_LE("PlApLe", 20, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009), + CH_AP_CI("ChApCi", 20, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222), + HO_ME_KI("HoMeKi", 20, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360), + PI_CO("PiCo", 20, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203); + + public final String name; + public final String oredictName; + public final int healAmount; + public final float saturation; + public final EnumRarity rarity; + public final int firstEffectToGet; + public final int secondEffectToGet; + public final int color; + + TheJams(String name, int healAmount, float saturation, EnumRarity rarity, String oredictName, int firstEffectID, int secondEffectID, int color){ + this.name = name; + this.healAmount = healAmount; + this.saturation = saturation; + this.rarity = rarity; + this.oredictName = oredictName; + this.firstEffectToGet = firstEffectID; + this.secondEffectToGet = secondEffectID; + this.color = color; + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public String getOredictName(){ + return this.oredictName; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java index 7e7c84d91..c8e5fcfd1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java @@ -1,28 +1,37 @@ package ellpeck.actuallyadditions.items.metalists; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.item.EnumRarity; -public enum TheMiscItems implements IName{ +public enum TheMiscItems implements INameableItem{ - PAPER_CONE("PaperCone", EnumRarity.common), - MASHED_FOOD("MashedFood", EnumRarity.uncommon), - KNIFE_BLADE("KnifeBlade", EnumRarity.common), - KNIFE_HANDLE("KnifeHandle", EnumRarity.common), - DOUGH("Dough", EnumRarity.common), - QUARTZ("BlackQuartz", EnumRarity.epic), - RING("Ring", EnumRarity.uncommon); + PAPER_CONE("PaperCone", EnumRarity.common, "itemPaperCone"), + MASHED_FOOD("MashedFood", EnumRarity.uncommon, "itemMashedFood"), + KNIFE_BLADE("KnifeBlade", EnumRarity.common, "itemKnifeBlade"), + KNIFE_HANDLE("KnifeHandle", EnumRarity.common, "itemKnifeHandle"), + DOUGH("Dough", EnumRarity.common, "itemDough"), + QUARTZ("BlackQuartz", EnumRarity.epic, "gemQuartzBlack"), + RING("Ring", EnumRarity.uncommon, "itemRing"), + COIL("Coil", EnumRarity.common, "itemCoilBasic"), + COIL_ADVANCED("CoilAdvanced", EnumRarity.uncommon, "itemCoilAdvanced"); public final String name; + public final String oredictName; public final EnumRarity rarity; - TheMiscItems(String name, EnumRarity rarity){ + TheMiscItems(String name, EnumRarity rarity, String oredictName){ this.name = name; this.rarity = rarity; + this.oredictName = oredictName; } @Override public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java index 26cd4c2b6..3e08a50c9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java @@ -1,12 +1,12 @@ package ellpeck.actuallyadditions.items.metalists; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; 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{ +public enum ThePotionRings implements INameableItem{ SPEED("Speed", 8171462, 1, 0, 3, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)), //TODO Slowness @@ -58,4 +58,9 @@ public enum ThePotionRings implements IName{ public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return ""; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java index 9ac0b6268..1458edd53 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java @@ -1,40 +1,47 @@ package ellpeck.actuallyadditions.items.metalists; -import ellpeck.actuallyadditions.config.ConfigValues; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.item.EnumRarity; -public enum TheSpecialDrops implements IName{ +public enum TheSpecialDrops implements INameableItem{ - SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 40, 3, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableExperienceDrop), - BLOOD_FRAGMENT("BloodFragment", 15, 1, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableBloodDrop), - HEART_PART("HeartPart", 5, 1, EntityCreature.class, EnumRarity.rare, ConfigValues.enableHeartDrop), - UNKNOWN_SUBSTANCE("UnknownSubstance", 3, 1, EntitySkeleton.class, EnumRarity.epic, ConfigValues.enableSubstanceDrop), - PEARL_SHARD("PearlShard", 30, 3, EntityEnderman.class, EnumRarity.epic, ConfigValues.enablePearlShardDrop), - EMERALD_SHARD("EmeraldShard", 30, 3, EntityCreeper.class, EnumRarity.rare, ConfigValues.enableEmeraldShardDrop); + SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 40, 3, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.EXPERIENCE_DROP.isEnabled(), "itemSolidifiedExperience"), + BLOOD_FRAGMENT("BloodFragment", 15, 1, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.BLOOD_DROP.isEnabled(), "itemBloodFragment"), + HEART_PART("HeartPart", 5, 1, EntityCreature.class, EnumRarity.rare, ConfigBoolValues.HEART_DROP.isEnabled(), "itemHeartPart"), + UNKNOWN_SUBSTANCE("UnknownSubstance", 3, 1, EntitySkeleton.class, EnumRarity.epic, ConfigBoolValues.SUBSTANCE_DROP.isEnabled(), "itemUnknownSubstance"), + PEARL_SHARD("PearlShard", 30, 3, EntityEnderman.class, EnumRarity.epic, ConfigBoolValues.PEARL_SHARD_DROP.isEnabled(), "nuggetEnderpearl"), + EMERALD_SHARD("EmeraldShard", 30, 3, EntityCreeper.class, EnumRarity.rare, ConfigBoolValues.EMERALD_SHARD_CROP.isEnabled(), "nuggetEmerald"); public final String name; + public final String oredictName; public final int chance; public final int maxAmount; public final Class dropFrom; public final boolean canDrop; public final EnumRarity rarity; - TheSpecialDrops(String name, int chance, int maxAmount, Class dropFrom, EnumRarity rarity, boolean canDrop){ + TheSpecialDrops(String name, int chance, int maxAmount, Class dropFrom, EnumRarity rarity, boolean canDrop, String oredictName){ this.name = name; this.chance = chance; this.rarity = rarity; this.maxAmount = maxAmount; this.dropFrom = dropFrom; this.canDrop = canDrop; + this.oredictName = oredictName; } @Override public String getName(){ return this.name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java index 9c503b8e4..6287b62f6 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,27 +16,30 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemAxeAA extends ItemAxe implements IName{ +public class ItemAxeAA extends ItemAxe implements INameableItem{ private String name; private EnumRarity rarity; private ItemStack repairItem; + private String oredictName; public ItemAxeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; + this.oredictName = name; } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(ItemUtil.addStandardInformation(this)); if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc")); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -64,4 +67,9 @@ public class ItemAxeAA extends ItemAxe implements IName{ public String getName(){ return name; } + + @Override + public String getOredictName(){ + return oredictName; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java index 64c6c2698..4adf9cf67 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemHoeAA extends ItemHoe implements IName{ +public class ItemHoeAA extends ItemHoe implements INameableItem{ private String name; + private String oredictName; private EnumRarity rarity; private ItemStack repairItem; @@ -27,16 +28,18 @@ public class ItemHoeAA extends ItemHoe implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; + this.oredictName = name; } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - list.add(ItemUtil.addStandardInformation(this)); + 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")); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -64,4 +67,9 @@ public class ItemHoeAA extends ItemHoe implements IName{ public String getName(){ return name; } + + @Override + public String getOredictName(){ + return this.oredictName; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java index 127c5bd59..04bf68c14 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemPickaxeAA extends ItemPickaxe implements IName{ +public class ItemPickaxeAA extends ItemPickaxe implements INameableItem{ private String name; + private String oredictName; private EnumRarity rarity; private ItemStack repairItem; @@ -27,16 +28,18 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; + this.oredictName = name; } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(ItemUtil.addStandardInformation(this)); if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc")); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -64,4 +67,9 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{ public String getName(){ return name; } + + @Override + public String getOredictName(){ + return oredictName; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java index 76695c63c..f805278c0 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemShovelAA extends ItemSpade implements IName{ +public class ItemShovelAA extends ItemSpade implements INameableItem{ private String name; + private String oredictName; private EnumRarity rarity; private ItemStack repairItem; @@ -27,16 +28,18 @@ public class ItemShovelAA extends ItemSpade implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; + this.oredictName = name; } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(ItemUtil.addStandardInformation(this)); if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc")); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -64,4 +67,9 @@ public class ItemShovelAA extends ItemSpade implements IName{ public String getName(){ return name; } + + @Override + public String getOredictName(){ + return oredictName; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java index aa791ae42..2b4a84b32 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IName; +import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector; import java.util.List; -public class ItemSwordAA extends ItemSword implements IName{ +public class ItemSwordAA extends ItemSword implements INameableItem{ private String name; + private String oredictName; private EnumRarity rarity; private ItemStack repairItem; @@ -27,16 +28,18 @@ public class ItemSwordAA extends ItemSword implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; + this.oredictName = name; } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - list.add(ItemUtil.addStandardInformation(this)); + 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")); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -64,4 +67,9 @@ public class ItemSwordAA extends ItemSword implements IName{ public String getName(){ return name; } + + @Override + public String getOredictName(){ + return oredictName; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/material/InitItemMaterials.java b/src/main/java/ellpeck/actuallyadditions/material/InitItemMaterials.java index b02444705..91e5d0811 100644 --- a/src/main/java/ellpeck/actuallyadditions/material/InitItemMaterials.java +++ b/src/main/java/ellpeck/actuallyadditions/material/InitItemMaterials.java @@ -1,6 +1,7 @@ package ellpeck.actuallyadditions.material; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigFloatValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; @@ -13,8 +14,8 @@ public class InitItemMaterials{ public static void init(){ Util.logInfo("Initializing Materials..."); - toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigValues.toolEmeraldHarvestLevel, ConfigValues.toolEmeraldMaxUses, ConfigValues.toolEmeraldEfficiency, ConfigValues.toolEmeraldDamage, ConfigValues.toolEmeraldEnchantability); - toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigValues.toolObsidianHarvestLevel, ConfigValues.toolObsidianMaxUses, ConfigValues.toolObsidianEfficiency, ConfigValues.toolObsidianDamage, ConfigValues.toolObsidianEnchantability); + toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigIntValues.EMERALD_HARVEST_LEVEL.getValue(), ConfigIntValues.EMERALD_USES.getValue(), ConfigFloatValues.EMERALD_SPEED.getValue(), ConfigFloatValues.EMERALD_MAX_DAMAGE.getValue(), ConfigIntValues.EMERALD_ENCHANTABILITY.getValue()); + toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigIntValues.OBSIDIAN_HARVEST_LEVEL.getValue(), ConfigIntValues.OBSIDIAN_USES.getValue(), ConfigFloatValues.OBSIDIAN_SPEED.getValue(), ConfigFloatValues.OBSIDIAN_MAX_DAMAGE.getValue(), ConfigIntValues.OBSIDIAN_ENCHANTABILITY.getValue()); } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java new file mode 100644 index 000000000..8eae1f040 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -0,0 +1,202 @@ +package ellpeck.actuallyadditions.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.ItemList; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.RecipeInfo; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ellpeck.actuallyadditions.inventory.GuiGrinder; +import ellpeck.actuallyadditions.recipe.GrinderRecipes; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.*; +import java.util.List; + +public class CrusherRecipeHandler extends TemplateRecipeHandler{ + + public static final String NAME = "crushing"; + public static final String FUEL = "fuel"; + + public static ArrayList fuels; + + public CrusherRecipeHandler(){ + super(); + RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); + } + + public class CachedCrush extends CachedRecipe{ + + public PositionedStack ingredient; + public PositionedStack resultOne; + public PositionedStack resultTwo; + public int secondChance; + + public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance){ + in.stackSize = 1; + this.ingredient = new PositionedStack(in, 80, 21); + this.resultOne = new PositionedStack(resultOne, 66, 69); + if(resultTwo != null) this.resultTwo = new PositionedStack(resultTwo, 94, 69); + this.secondChance = secondChance; + } + + @Override + public List getIngredients(){ + return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingredient)); + } + + @Override + public PositionedStack getResult(){ + return resultOne; + } + + @Override + public PositionedStack getOtherStack(){ + return fuels.get((cycleticks / 48) % fuels.size()).stack; + } + + @Override + public List getOtherStacks(){ + ArrayList list = new ArrayList(); + list.add(this.getOtherStack()); + if(this.resultTwo != null) list.add(this.resultTwo); + return list; + } + } + + @Override + public int recipiesPerPage(){ + return 1; + } + + public static class Fuel{ + + public Fuel(ItemStack in, int burnTime){ + this.stack = new PositionedStack(in, 51, 21, false); + this.burnTime = burnTime; + } + + public PositionedStack stack; + public int burnTime; + } + + @Override + public void loadTransferRects(){ + transferRects.add(new RecipeTransferRect(new Rectangle(51, 5, 14, 14), FUEL)); + transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), NAME)); + } + + @Override + public Class getGuiClass(){ + return GuiGrinder.class; + } + + @Override + public String getRecipeName(){ + return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name"); + } + + @Override + public TemplateRecipeHandler newInstance(){ + if (fuels == null || fuels.isEmpty()) findFuels(); + return super.newInstance(); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results){ + if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){ + ArrayList recipes = GrinderRecipes.instance().recipes; + for(GrinderRecipes.GrinderRecipe recipe : recipes){ + arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); + } + } + else super.loadCraftingRecipes(outputId, results); + } + + @Override + public void loadCraftingRecipes(ItemStack result){ + ArrayList recipes = GrinderRecipes.instance().recipes; + for(GrinderRecipes.GrinderRecipe recipe : recipes){ + if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); + } + } + + @Override + public void loadUsageRecipes(String inputId, Object... ingredients){ + if (inputId.equals(FUEL) && getClass() == CrusherRecipeHandler.class) loadCraftingRecipes(NAME); + else super.loadUsageRecipes(inputId, ingredients); + } + + @Override + public void loadUsageRecipes(ItemStack ingredient){ + ArrayList recipes = GrinderRecipes.instance().recipes; + for(GrinderRecipes.GrinderRecipe recipe : recipes){ + if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){ + CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance); + theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredient), ingredient); + arecipes.add(theRecipe); + } + } + } + + @Override + public String getGuiTexture(){ + return ModUtil.MOD_ID_LOWER + ":textures/gui/guiGrinder.png"; + } + + @Override + public void drawBackground(int recipeIndex){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(49, 5, 49, 5, 66, 86); + } + + @Override + public void drawExtras(int recipe){ + drawProgressBar(51, 5, 176, 44, 14, 14, 48, 7); + drawProgressBar(80, 40, 176, 0, 24, 23, 48, 1); + + CachedCrush crush = (CachedCrush)this.arecipes.get(recipe); + if(crush.resultTwo != null){ + int secondChance = crush.secondChance; + String secondString = secondChance + "%"; + GuiDraw.drawString(secondString, 118, 73, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } + } + + private static Set excludedFuels(){ + Set theFuels = new HashSet(); + theFuels.add(Item.getItemFromBlock(Blocks.brown_mushroom)); + theFuels.add(Item.getItemFromBlock(Blocks.red_mushroom)); + theFuels.add(Item.getItemFromBlock(Blocks.standing_sign)); + theFuels.add(Item.getItemFromBlock(Blocks.wall_sign)); + theFuels.add(Item.getItemFromBlock(Blocks.wooden_door)); + theFuels.add(Item.getItemFromBlock(Blocks.trapped_chest)); + return theFuels; + } + + private static void findFuels(){ + fuels = new ArrayList(); + Set theFuels = excludedFuels(); + for(ItemStack item : ItemList.items){ + if(!theFuels.contains(item.getItem())){ + int burnTime = TileEntityFurnace.getItemBurnTime(item); + if(burnTime > 0) fuels.add(new Fuel(item.copy(), burnTime)); + } + } + } + + @Override + public String getOverlayIdentifier(){ + return NAME; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java new file mode 100644 index 000000000..7f90d5e67 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java @@ -0,0 +1,34 @@ +package ellpeck.actuallyadditions.nei; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.item.ItemStack; + +public class NEIActuallyAdditionsConfig implements IConfigureNEI{ + + @Override + public void loadConfig(){ + Util.logInfo("Initializing Not Enough Items Plugin..."); + + CrusherRecipeHandler crusherRecipeHandler = new CrusherRecipeHandler(); + API.registerRecipeHandler(crusherRecipeHandler); + API.registerUsageHandler(crusherRecipeHandler); + + //TODO Re-add + API.hideItem(new ItemStack(InitBlocks.blockHeatCollector)); + API.hideItem(new ItemStack(InitBlocks.blockFurnaceSolar)); + } + + @Override + public String getName(){ + return ModUtil.MOD_ID + " NEI Plugin"; + } + + @Override + public String getVersion(){ + return ModUtil.VERSION; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/oredict/OreDictRegistry.java b/src/main/java/ellpeck/actuallyadditions/oredict/OreDictRegistry.java deleted file mode 100644 index f67eb5415..000000000 --- a/src/main/java/ellpeck/actuallyadditions/oredict/OreDictRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -package ellpeck.actuallyadditions.oredict; - -import ellpeck.actuallyadditions.blocks.InitBlocks; -import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.items.InitItems; -import ellpeck.actuallyadditions.items.metalists.TheDusts; -import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class OreDictRegistry{ - - public static void init(){ - OreDictionary.registerOre("dustDiamond", new ItemStack(InitItems.itemDust, 1, TheDusts.DIAMOND.ordinal())); - OreDictionary.registerOre("dustIron", new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal())); - OreDictionary.registerOre("dustGold", new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal())); - OreDictionary.registerOre("dustEmerald", new ItemStack(InitItems.itemDust, 1, TheDusts.EMERALD.ordinal())); - OreDictionary.registerOre("dustLapis", new ItemStack(InitItems.itemDust, 1, TheDusts.LAPIS.ordinal())); - OreDictionary.registerOre("dustCoal", new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal())); - OreDictionary.registerOre("dustQuartz", new ItemStack(InitItems.itemDust, 1, TheDusts.QUARTZ.ordinal())); - OreDictionary.registerOre("dustQuartzBlack", new ItemStack(InitItems.itemDust, 1, TheDusts.QUARTZ_BLACK.ordinal())); - OreDictionary.registerOre("oreQuartzBlack", new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())); - OreDictionary.registerOre("itemQuartzBlack", new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java index f6066a752..d304b006c 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java @@ -2,14 +2,20 @@ package ellpeck.actuallyadditions.proxy; import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.common.registry.VillagerRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.render.*; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.event.RenderPlayerEventAA; import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; +import ellpeck.actuallyadditions.update.UpdateChecker; +import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; @SuppressWarnings("unused") @@ -24,6 +30,10 @@ public class ClientProxy implements IProxy{ public void init(){ Util.logInfo("Initializing ClientProxy..."); + if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled()){ + new UpdateChecker().init(); + } + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost())); @@ -33,6 +43,8 @@ public class ClientProxy implements IProxy{ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar())); + VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png")); + Util.registerEvent(new RenderPlayerEventAA()); } diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java new file mode 100644 index 000000000..192270f4f --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java @@ -0,0 +1,112 @@ +package ellpeck.actuallyadditions.recipe; + +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; +import org.apache.logging.log4j.Level; + +import java.util.ArrayList; + +public class GrinderRecipeHandler{ + + private static final GrinderRecipeHandler instance = new GrinderRecipeHandler(); + + public static GrinderRecipeHandler instance(){ + return instance; + } + + public ArrayList searchCases = new ArrayList(); + public ArrayList exceptions = new ArrayList(); + public ArrayList specialOreCases = new ArrayList(); + + public static class SearchCase{ + + public final String name; + public final int resultAmount; + + public SearchCase(String name, int resultAmount){ + this.name = name; + this.resultAmount = resultAmount; + } + } + + public static class SpecialOreCase{ + + public final String inputName; + public final String secondResultName; + public final int secondResultChance; + + public SpecialOreCase(String inputName, String secondResultName, int secondResultChance){ + this.inputName = inputName; + this.secondResultChance = secondResultChance; + this.secondResultName = secondResultName; + } + + } + + public void registerFinally(){ + String[] names = OreDictionary.getOreNames(); + for(String inputName : names){ + + if(!this.exceptions.contains(inputName)){ + int resultAmount = 1; + String inputNameWithoutPrefix = null; + + for(SearchCase searchCase : searchCases){ + String toSearch = searchCase.name; + if(inputName.length() > toSearch.length() && inputName.substring(0, toSearch.length()).equals(toSearch)){ + inputNameWithoutPrefix = inputName.substring(toSearch.length()); + resultAmount = searchCase.resultAmount; + break; + } + } + + if(inputNameWithoutPrefix != null){ + String inputWithDustPrefix = "dust" + inputNameWithoutPrefix; + ArrayList allOresOfInitialInputName = OreDictionary.getOres(inputName); + ArrayList allOresWithDustPrefix = OreDictionary.getOres(inputWithDustPrefix); + if(allOresOfInitialInputName != null && allOresOfInitialInputName.size() > 0){ + if(allOresWithDustPrefix != null && allOresWithDustPrefix.size() > 0){ + for(ItemStack theInput : allOresOfInitialInputName){ + for(ItemStack theDust : allOresWithDustPrefix){ + ItemStack input = theInput.copy(); + ItemStack output = theDust.copy(); + output.stackSize = resultAmount; + if(!GrinderRecipes.instance().hasExactRecipe(input, output)){ + ArrayList specialStacks = null; + int specialAmount = 0; + + for(SpecialOreCase theCase : specialOreCases){ + if(inputName.equals(theCase.inputName)){ + specialStacks = OreDictionary.getOres(theCase.secondResultName); + specialAmount = theCase.secondResultChance; + } + } + if(specialStacks != null && specialStacks.size() > 0){ + for(ItemStack theSpecial : specialStacks){ + ItemStack special = theSpecial.copy(); + GrinderRecipes.instance().registerRecipe(input, output, special, specialAmount); + } + } + else GrinderRecipes.instance().registerRecipe(input, output, null, 0); + } + } + } + } + else{ + if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled()) + ModUtil.AA_LOGGER.log(Level.INFO, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + inputWithDustPrefix + "' doesn't exist! It should correspond to '" + inputName + "'! This is not an Error, just a bit sad :("); + } + + } + else{ + if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled()) + ModUtil.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + inputName + "'! This shouldn't happen as there is something registered as '" + inputName + "' that doesn't exist!"); + } + } + } + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java index f2210abfb..d0a2ebab2 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java @@ -27,6 +27,15 @@ public class GrinderRecipes{ return null; } + public boolean hasExactRecipe(ItemStack input, ItemStack outputOne){ + for(GrinderRecipe recipe : recipes){ + if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)){ + return true; + } + } + return false; + } + public int getSecondChance(ItemStack input){ for(GrinderRecipe recipe : recipes){ if(recipe.input.isItemEqual(input)){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 47bdcbbc8..cfde380a7 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -39,6 +39,12 @@ public class TileEntityBase extends TileEntity{ 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"); + GameRegistry.registerTileEntity(TileEntityGreenhouseGlass.class, ModUtil.MOD_ID_LOWER + ":tileEntityGreenhouseGlass"); + GameRegistry.registerTileEntity(TileEntityBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityBreaker"); + GameRegistry.registerTileEntity(TileEntityDropper.class, ModUtil.MOD_ID_LOWER + ":tileEntityDropper"); + GameRegistry.registerTileEntity(TileEntityInputter.TileEntityInputterAdvanced.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputterAdvanced"); + GameRegistry.registerTileEntity(TileEntityBreaker.TileEntityPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPlacer"); + GameRegistry.registerTileEntity(TileEntityGrinder.TileEntityGrinderDouble.class, ModUtil.MOD_ID_LOWER + ":tileEntityGrinderDouble"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java new file mode 100644 index 000000000..27ef4bfb3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -0,0 +1,136 @@ +package ellpeck.actuallyadditions.tile; + +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.util.WorldUtil; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; + +public class TileEntityBreaker extends TileEntityInventoryBase{ + + public static class TileEntityPlacer extends TileEntityBreaker{ + + public TileEntityPlacer(){ + super(9, "placer"); + this.isPlacer = true; + } + + } + + public boolean isPlacer; + + private final int timeNeeded = ConfigIntValues.BREAKER_TIME_NEEDED.getValue(); + private int currentTime; + + public TileEntityBreaker(int slots, String name){ + super(slots, name); + } + + public TileEntityBreaker(){ + super(9, "breaker"); + this.isPlacer = false; + } + + @Override + @SuppressWarnings("unchecked") + public void updateEntity(){ + if(!worldObj.isRemote){ + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + if(this.currentTime > 0){ + this.currentTime--; + if(this.currentTime <= 0){ + ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); + + ChunkCoordinates coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, xCoord, yCoord, zCoord); + if(coordsBlock != null){ + Block blockToBreak = worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ); + if(!this.isPlacer && blockToBreak != null && blockToBreak.getBlockHardness(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ) > -1.0F){ + ArrayList drops = new ArrayList(); + int meta = worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ); + drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, meta, 0)); + + if(this.addToInventory(drops, false)){ + worldObj.playAuxSFX(2001, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12)); + WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord); + this.addToInventory(drops, true); + this.markDirty(); + } + } + else if(this.isPlacer && (worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ))){ + ItemStack removeFalse = this.removeFromInventory(false); + if(removeFalse != null && Block.getBlockFromItem(removeFalse.getItem()) != blockToBreak && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){ + this.removeFromInventory(true); + } + } + } + } + } + else this.currentTime = this.timeNeeded; + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("CurrentTime", this.currentTime); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + this.currentTime = compound.getInteger("CurrentTime"); + } + + public boolean addToInventory(ArrayList stacks, boolean actuallyDo){ + int working = 0; + for(ItemStack stack : stacks){ + for(int i = 0; i < this.slots.length; i++){ + if(this.slots[i] == null || (this.slots[i].isItemEqual(stack) && this.slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){ + working++; + if(actuallyDo){ + if(this.slots[i] == null) this.slots[i] = stack.copy(); + else this.slots[i].stackSize += stack.stackSize; + } + break; + } + } + } + return working >= stacks.size(); + } + + public ItemStack removeFromInventory(boolean actuallyDo){ + for(int i = 0; i < this.slots.length; i++){ + if(this.slots[i] != null && !(Block.getBlockFromItem(this.slots[i].getItem()) instanceof BlockAir)){ + ItemStack slot = this.slots[i].copy(); + if(actuallyDo){ + this.slots[i].stackSize--; + if(this.slots[i].stackSize <= 0) this.slots[i] = null; + } + return slot; + } + } + return null; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return this.isPlacer; + } + + @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 true; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java index fa080ce8b..1959426ff 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java @@ -1,6 +1,6 @@ package ellpeck.actuallyadditions.tile; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.ItemFertilizer; import ellpeck.actuallyadditions.items.ItemMisc; @@ -10,18 +10,24 @@ import net.minecraft.nbt.NBTTagCompound; public class TileEntityCompost extends TileEntityInventoryBase{ - public final int amountNeededToConvert = ConfigValues.compostAmountNeededToConvert; - public final int conversionTimeNeeded = ConfigValues.compostConversionTimeNeeded; + public final int amountNeededToConvert = ConfigIntValues.COMPOST_AMOUNT.getValue(); + public final int conversionTimeNeeded = ConfigIntValues.COMPOST_TIME.getValue(); public int conversionTime; public TileEntityCompost(){ - super(1, "tileEntityCompost"); + super(1, "compost"); } @Override public void updateEntity(){ if(!worldObj.isRemote){ + + if(this.slots[0] != null && this.slots[0].stackSize > 0){ + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, this.slots[0].stackSize + (this.slots[0].getItem() instanceof ItemFertilizer ? 1 : 0), 2); + } + else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); + boolean theFlag = this.conversionTime > 0; if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){ this.conversionTime++; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java new file mode 100644 index 000000000..eeed05a36 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java @@ -0,0 +1,80 @@ +package ellpeck.actuallyadditions.tile; + +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.util.WorldUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityDropper extends TileEntityInventoryBase{ + + private final int timeNeeded = ConfigIntValues.DROPPER_TIME_NEEDED.getValue(); + private int currentTime; + + @SuppressWarnings("unused") + public TileEntityDropper(){ + super(9, "dropper"); + } + + @Override + @SuppressWarnings("unchecked") + public void updateEntity(){ + if(!worldObj.isRemote){ + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + if(this.currentTime > 0){ + this.currentTime--; + if(this.currentTime <= 0){ + if(this.removeFromInventory(false) != null){ + ItemStack stack = this.removeFromInventory(true); + stack.stackSize = 1; + WorldUtil.dropItemAtSide(ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)), worldObj, xCoord, yCoord, zCoord, stack); + } + } + } + else this.currentTime = this.timeNeeded; + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("CurrentTime", this.currentTime); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + this.currentTime = compound.getInteger("CurrentTime"); + } + + public ItemStack removeFromInventory(boolean actuallyDo){ + for(int i = 0; i < this.slots.length; i++){ + if(this.slots[i] != null){ + ItemStack slot = this.slots[i].copy(); + if(actuallyDo){ + this.slots[i].stackSize--; + if(this.slots[i].stackSize <= 0) this.slots[i] = null; + } + return slot; + } + } + return null; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return true; + } + + @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 true; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java index 62f282445..5d809834b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java @@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.PacketTileEntityFeeder; import net.minecraft.entity.passive.EntityAnimal; @@ -16,15 +16,15 @@ import java.util.Random; public class TileEntityFeeder extends TileEntityInventoryBase{ - public int reach = ConfigValues.feederReach; - public int timerGoal = ConfigValues.feederTimeNeeded; - public int animalThreshold = ConfigValues.feederThreshold; + public int reach = ConfigIntValues.FEEDER_REACH.getValue(); + public int timerGoal = ConfigIntValues.FEEDER_TIME.getValue(); + public int animalThreshold = ConfigIntValues.FEEDER_THRESHOLD.getValue(); public int currentTimer; public int currentAnimalAmount; public TileEntityFeeder(){ - super(1, "tileEntityFeeder"); + super(1, "feeder"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java index 29db19999..d4d84c4f2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java @@ -1,6 +1,6 @@ package ellpeck.actuallyadditions.tile; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.nbt.NBTTagCompound; @@ -10,7 +10,7 @@ import java.util.Random; public class TileEntityFishingNet extends TileEntityBase{ - public int timeUntilNextDropToSet = ConfigValues.fishingNetTime; + public int timeUntilNextDropToSet = ConfigIntValues.FISHER_TIME.getValue(); public int timeUntilNextDrop; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 0723921e7..efdfb5363 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -2,14 +2,14 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; -public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IPowerAcceptor{ +public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPowerAcceptor{ public static final int SLOT_COAL = 0; public static final int SLOT_INPUT_1 = 1; @@ -20,22 +20,25 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public int coalTime; public int coalTimeLeft; - public final int maxBurnTime = ConfigValues.furnaceDoubleSmeltTime; + public int maxBurnTime = this.getStandardSpeed(); public int firstSmeltTime; public int secondSmeltTime; public TileEntityFurnaceDouble(){ - super(5, "tileEntityFurnaceDouble"); + super(6, "furnaceDouble"); + this.speedUpgradeSlot = 5; } @Override @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + this.speedUp(); + boolean theFlag = this.coalTimeLeft > 0; - if(this.coalTimeLeft > 0) this.coalTimeLeft--; + if(this.coalTimeLeft > 0) this.coalTimeLeft -= 1+this.burnTimeAmplifier; boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1); boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2); @@ -174,4 +177,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public int getItemPower(){ return this.coalTime; } + + @Override + public int getStandardSpeed(){ + return ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue(); + } + + @Override + public void setSpeed(int newSpeed){ + this.maxBurnTime = newSpeed; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java index c17758a26..3b8fa4d91 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -1,16 +1,19 @@ package ellpeck.actuallyadditions.tile; -import net.minecraft.block.BlockFurnace; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; - public class TileEntityFurnaceSolar extends TileEntityBase{ @Override + public boolean canUpdate(){ + return false; + } + + //TODO Reimplement + + /*@Override public void updateEntity(){ if(!worldObj.isRemote){ if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){ - TileEntity tileBelow = TileEntityInputter.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord); + TileEntity tileBelow = WorldUtil.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord); givePowerTo(tileBelow); } @@ -37,5 +40,5 @@ public class TileEntityFurnaceSolar extends TileEntityBase{ BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord); } } - } + }*/ } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java index 821035a55..7d9c0dd33 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGiantChest.java @@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList; public class TileEntityGiantChest extends TileEntityInventoryBase{ public TileEntityGiantChest(){ - super(9*13, "tileEntityGiantChest"); + super(9*13, "giantChest"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java new file mode 100644 index 000000000..c59eea2dc --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java @@ -0,0 +1,58 @@ +package ellpeck.actuallyadditions.tile; + +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.block.BlockGrass; +import net.minecraft.block.IGrowable; +import net.minecraft.init.Items; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayerFactory; + +import java.util.Random; + +public class TileEntityGreenhouseGlass extends TileEntityBase{ + + private int timeUntilNextFertToSet = ConfigIntValues.GLASS_TIME_NEEDED.getValue(); + + private int timeUntilNextFert; + + @Override + public void updateEntity(){ + if(!worldObj.isRemote){ + if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){ + ChunkCoordinates blockToFert = this.blockToFertilize(); + if(blockToFert != null){ + Random rand = new Random(); + if(this.timeUntilNextFert > 0){ + this.timeUntilNextFert--; + if(timeUntilNextFert <= 0){ + this.applyBonemealEffect(blockToFert); + } + } + else this.timeUntilNextFert = this.timeUntilNextFertToSet + rand.nextInt(this.timeUntilNextFertToSet/2); + } + } + } + } + + public ChunkCoordinates blockToFertilize(){ + for(int i = yCoord-1; i > 0; i--){ + Block block = worldObj.getBlock(xCoord, i, zCoord); + if(block != null && !(block instanceof BlockAir)){ + if(block instanceof IGrowable && !(block instanceof BlockGrass)){ + return new ChunkCoordinates(xCoord, i, zCoord); + } + else return null; + } + } + return null; + } + + public boolean applyBonemealEffect(ChunkCoordinates coords){ + return ItemDye.applyBonemeal(new ItemStack(Items.dye, 1, 15), worldObj, coords.posX, coords.posY, coords.posZ, FakePlayerFactory.getMinecraft((WorldServer)worldObj)); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 93780d9ff..6c80adcdd 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.recipe.GrinderRecipes; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -11,7 +11,18 @@ import net.minecraft.tileentity.TileEntityFurnace; import java.util.Random; -public class TileEntityGrinder extends TileEntityInventoryBase implements IPowerAcceptor{ +public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcceptor{ + + public static class TileEntityGrinderDouble extends TileEntityGrinder{ + + public TileEntityGrinderDouble(){ + super(8, "grinderDouble"); + this.isDouble = true; + this.maxCrushTime = this.getStandardSpeed(); + this.speedUpgradeSlot = 7; + } + + } public static final int SLOT_COAL = 0; public static final int SLOT_INPUT_1 = 1; @@ -31,30 +42,33 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IPower public boolean isDouble; - public TileEntityGrinder(){ - super(0, ""); + public TileEntityGrinder(int slots, String name){ + super(slots, name); } - public TileEntityGrinder(boolean isDouble){ - super(isDouble ? 7 : 4, isDouble ? "tileEntityGrinderDouble" : "tileEntityGrinder"); - this.maxCrushTime = isDouble ? ConfigValues.grinderDoubleCrushTime : ConfigValues.grinderCrushTime; - this.isDouble = isDouble; + public TileEntityGrinder(){ + super(5, "grinder"); + this.isDouble = false; + this.maxCrushTime = this.getStandardSpeed(); + this.speedUpgradeSlot = 4; } @Override @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + this.speedUp(); + boolean theFlag = this.coalTimeLeft > 0; - if(this.coalTimeLeft > 0) this.coalTimeLeft--; + if(this.coalTimeLeft > 0) this.coalTimeLeft -= 1+this.burnTimeAmplifier; boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); boolean canCrushOnSecond = false; if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); if((canCrushOnFirst || canCrushOnSecond) && this.coalTimeLeft <= 0 && this.slots[SLOT_COAL] != null){ - this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]); + this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]); this.coalTimeLeft = this.coalTime; if(this.coalTime > 0){ this.slots[SLOT_COAL].stackSize--; @@ -136,9 +150,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IPower compound.setInteger("CoalTimeLeft", this.coalTimeLeft); compound.setInteger("FirstCrushTime", this.firstCrushTime); compound.setInteger("SecondCrushTime", this.secondCrushTime); - compound.setBoolean("IsDouble", this.isDouble); - compound.setString("Name", this.name); - compound.setInteger("Slots", this.slots.length); super.writeToNBT(compound); } @@ -148,10 +159,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IPower this.coalTimeLeft = compound.getInteger("CoalTimeLeft"); this.firstCrushTime = compound.getInteger("FirstCrushTime"); this.secondCrushTime = compound.getInteger("SecondCrushTime"); - this.isDouble = compound.getBoolean("IsDouble"); - this.name = compound.getString("Name"); - this.maxCrushTime = isDouble ? ConfigValues.grinderDoubleCrushTime : ConfigValues.grinderCrushTime; - this.initializeSlots(compound.getInteger("Slots")); super.readFromNBT(compound); } @@ -204,4 +211,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IPower public int getItemPower(){ return this.coalTime; } + + @Override + public int getStandardSpeed(){ + return this.isDouble ? ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue() : ConfigIntValues.GRINDER_CRUSH_TIME.getValue(); + } + + @Override + public void setSpeed(int newSpeed){ + this.maxCrushTime = newSpeed; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java index f1b5c3e98..eca959c5b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java @@ -1,27 +1,26 @@ 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; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; public class TileEntityHeatCollector extends TileEntityBase{ - private int randomChance = ConfigValues.heatCollectorRandomChance; - private int blocksNeeded = ConfigValues.heatCollectorBlocksNeeded; + private int randomChance = ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue(); + private int blocksNeeded = ConfigIntValues.HEAT_COLLECTOR_BLOCKS.getValue(); @Override + public boolean canUpdate(){ + return false; + } + + //TODO Reimplement + + /*@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); + ChunkCoordinates coords = WorldUtil.getCoordsFromSide(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){ @@ -31,35 +30,16 @@ public class TileEntityHeatCollector extends TileEntityBase{ } if(blocksAround.size() >= blocksNeeded){ - TileEntity tileAbove = TileEntityInputter.getTileEntityFromSide(0, worldObj, xCoord, yCoord, zCoord); + TileEntity tileAbove = WorldUtil.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); + WorldUtil.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/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index ac7e8c798..c96d5953f 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -1,14 +1,26 @@ package ellpeck.actuallyadditions.tile; +import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; public class TileEntityInputter extends TileEntityInventoryBase{ + public static class TileEntityInputterAdvanced extends TileEntityInputter{ + + public TileEntityInputterAdvanced(){ + super(13, "inputterAdvanced"); + this.isAdvanced = true; + } + + } + + public static final int PUT_FILTER_START = 1; + public static final int PULL_FILTER_START = 7; + public int sideToPut = -1; public int slotToPut = -1; public int placeToPutSlotAmount; @@ -19,8 +31,15 @@ public class TileEntityInputter extends TileEntityInventoryBase{ public int placeToPullSlotAmount; public TileEntity placeToPull; + public boolean isAdvanced; + + public TileEntityInputter(int slots, String name){ + super(slots, name); + } + public TileEntityInputter(){ - super(1, "tileEntityInputter"); + super(1, "inputter"); + this.isAdvanced = false; } @Override @@ -28,9 +47,11 @@ public class TileEntityInputter extends TileEntityInventoryBase{ if(!worldObj.isRemote){ this.initVars(); - if(!(this.sideToPull == this.sideToPut && this.slotToPull == this.slotToPut)){ - if(sideToPull != -1) this.pull(); - if(sideToPut != -1) this.put(); + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + if(!(this.sideToPull == this.sideToPut && this.slotToPull == this.slotToPut)){ + if(sideToPull != -1) this.pull(); + if(sideToPut != -1) this.put(); + } } } } @@ -50,7 +71,7 @@ public class TileEntityInputter extends TileEntityInventoryBase{ if(tempStack.getMaxStackSize() < this.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize(); else maxSize = this.getInventoryStackLimit(); } - if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize))){ + if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkFilters(tempStack, true)){ if(theSided != null){ for(int j = 0; j < 5; j++){ if(theSided.canExtractItem(i, tempStack, j)){ @@ -108,7 +129,7 @@ public class TileEntityInputter extends TileEntityInventoryBase{ if(tempStack.getMaxStackSize() < theInventory.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize(); else maxSize = theInventory.getInventoryStackLimit(); } - if(tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)){ + if((tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkFilters(this.slots[0], false)){ if(theSided != null){ for(int j = 0; j < 5; j++){ if(theSided.canInsertItem(i, this.slots[0], j)){ @@ -152,9 +173,22 @@ public class TileEntityInputter extends TileEntityInventoryBase{ } } + public boolean checkFilters(ItemStack stack, boolean isPull){ + if(!this.isAdvanced) return true; + + int slotStart = isPull ? PULL_FILTER_START : PUT_FILTER_START; + int slotStop = slotStart+6; + + for(int i = slotStart; i < slotStop; i++){ + if(this.slots[i] != null && this.slots[i].isItemEqual(stack)) return true; + } + return false; + } + public void initVars(){ - this.placeToPull = getTileEntityFromSide(this.sideToPull, this.worldObj, this.xCoord, this.yCoord, this.zCoord); - this.placeToPut = getTileEntityFromSide(this.sideToPut, this.worldObj, this.xCoord, this.yCoord, this.zCoord); + + this.placeToPull = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPull), this.worldObj, this.xCoord, this.yCoord, this.zCoord); + this.placeToPut = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPut), this.worldObj, this.xCoord, this.yCoord, this.zCoord); if(this.placeToPull != null && this.placeToPull instanceof IInventory){ this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory(); @@ -173,16 +207,6 @@ public class TileEntityInputter extends TileEntityInventoryBase{ } } - public static TileEntity getTileEntityFromSide(int side, World world, int x, int y, int z){ - if(side == 0) return world.getTileEntity(x, y+1, z); - if(side == 1) return world.getTileEntity(x, y-1, z); - if(side == 2) return world.getTileEntity(x, y, z-1); - if(side == 3) return world.getTileEntity(x-1, y, z); - if(side == 4) return world.getTileEntity(x, y, z+1); - if(side == 5) return world.getTileEntity(x+1, y, z); - else return null; - } - public void onButtonPressed(int buttonID){ if(buttonID == 0) this.sideToPut++; if(buttonID == 1) this.sideToPut--; @@ -215,16 +239,16 @@ public class TileEntityInputter extends TileEntityInventoryBase{ @Override public void readFromNBT(NBTTagCompound compound){ - super.readFromNBT(compound); this.sideToPut = compound.getInteger("SideToPut"); this.slotToPut = compound.getInteger("SlotToPut"); this.sideToPull = compound.getInteger("SideToPull"); this.slotToPull = compound.getInteger("SlotToPull"); + super.readFromNBT(compound); } - + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ - return true; + return i == 0; } @Override @@ -234,6 +258,6 @@ public class TileEntityInputter extends TileEntityInventoryBase{ @Override public boolean canExtractItem(int slot, ItemStack stack, int side){ - return true; + return slot == 0; } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index 7097320f8..2ecc4bc2d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.tile; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -13,7 +14,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements public TileEntityInventoryBase(int slots, String name){ this.initializeSlots(slots); - this.name = name; + this.name = "container." + ModUtil.MOD_ID_LOWER + "." + name; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java index 568e2d309..d7873dd15 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java @@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.config.ConfigValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -14,7 +14,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I public static final int SLOT_INPUT = 1; public static final int SLOT_OUTPUT = 2; - private final int speedSlowdown = ConfigValues.repairerSpeedSlowdown; + private final int speedSlowdown = ConfigIntValues.REPAIRER_SPEED_SLOWDOWN.getValue(); public int coalTime; public int coalTimeLeft; @@ -22,7 +22,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I public int nextRepairTick; public TileEntityItemRepairer(){ - super(3, "tileEntityItemRepairer"); + super(3, "repairer"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityUpgradable.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityUpgradable.java new file mode 100644 index 000000000..864678128 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityUpgradable.java @@ -0,0 +1,40 @@ +package ellpeck.actuallyadditions.tile; + +import ellpeck.actuallyadditions.items.ItemUpgrade; +import net.minecraft.item.ItemStack; + +public abstract class TileEntityUpgradable extends TileEntityInventoryBase{ + + public int speedUpgradeSlot; + public int burnTimeAmplifier; + + public TileEntityUpgradable(int slots, String name){ + super(slots, name); + } + + public void speedUp(){ + ItemStack stack = this.slots[speedUpgradeSlot]; + if(stack != null && stack.getItem() instanceof ItemUpgrade && ((ItemUpgrade)stack.getItem()).type == ItemUpgrade.UpgradeType.SPEED){ + int newSpeed = this.getStandardSpeed() - 10*stack.stackSize; + this.speedUpBurnTimeBySpeed(stack.stackSize); + if(newSpeed < 5) newSpeed = 5; + this.setSpeed(newSpeed); + } + else{ + this.speedUpBurnTimeBySpeed(0); + this.setSpeed(this.getStandardSpeed()); + } + } + + public void speedUpBurnTimeBySpeed(int upgradeAmount){ + this.burnTimeAmplifier = upgradeAmount*2; + } + + public int getStandardSpeed(){ + return 0; + } + + public void setSpeed(int newSpeed){ + + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java new file mode 100644 index 000000000..8d96556a1 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java @@ -0,0 +1,81 @@ +package ellpeck.actuallyadditions.update; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.StatCollector; +import org.apache.logging.log4j.Level; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +public class UpdateChecker{ + + public boolean doneChecking = false; + public boolean checkFailed = false; + public boolean notified = false; + public String onlineVersion; + + public void init(){ + Util.logInfo("Initializing Update Checker..."); + Util.registerEvent(this); + new UpdateCheckThread(); + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event){ + if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){ + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if(checkFailed){ + player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".update.failed.desc"))); + } + else if(onlineVersion.length() > 0){ + int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", "")); + int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", "")); + + if(update > client){ + String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc"; + String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc"; + String notice3 = "info." + ModUtil.MOD_ID_LOWER + ".update.download.desc"; + player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal(notice1))); + player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, this.onlineVersion))); + player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice3, "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files"))); + } + + } + notified = true; + } + } + + public class UpdateCheckThread extends Thread{ + + public UpdateCheckThread(){ + this.setName(ModUtil.MOD_ID + " Update Checker"); + this.setDaemon(true); + this.start(); + } + + @Override + public void run(){ + Util.logInfo("Starting Update Check..."); + try{ + URL url = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/newestVersion.txt"); + BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); + onlineVersion = r.readLine(); + r.close(); + Util.logInfo("Update Check done!"); + } + catch(Exception e){ + ModUtil.AA_LOGGER.log(Level.ERROR, "Update Check failed!"); + checkFailed = true; + e.printStackTrace(); + } + doneChecking = true; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java index 087034e24..4528b0a01 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java @@ -1,6 +1,8 @@ package ellpeck.actuallyadditions.util; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; public class AssetUtil{ @@ -10,4 +12,10 @@ public class AssetUtil{ return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/" + file + ".png"); } + public static void displayNameAndInventoryString(FontRenderer font, int xSize, int yPositionOfInventoryText, int yPositionOfMachineText, String machineName){ + String localMachineName = StatCollector.translateToLocal(machineName + ".name"); + String inventoryName = StatCollector.translateToLocal("container.inventory"); + font.drawString(localMachineName, xSize/2 - font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); + font.drawString(inventoryName, xSize/2 - font.getStringWidth(inventoryName)/2, yPositionOfInventoryText-1, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java index cc4d59a5c..86fc9e727 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java @@ -4,17 +4,42 @@ import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.creative.CreativeTab; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.List; public class BlockUtil{ public static String createUnlocalizedName(Block block){ - return ModUtil.MOD_ID_LOWER + "." + ((IName)block).getName(); + return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName(); + } + + @SuppressWarnings("unchecked") + public static void addInformation(Block block, List list, int lines, String extraName){ + if(KeyUtil.isShiftPressed()){ + for(int i = 0; i < lines; i++){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); + } + } + else list.add(ItemUtil.shiftForInfo()); + } + + public static void register(Block block, Class itemBlock, Enum[] list){ + block.setCreativeTab(CreativeTab.instance); + block.setBlockName(createUnlocalizedName(block)); + GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName()); + for(Enum current : list){ + if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal())); + } } public static void register(Block block, Class itemBlock){ block.setCreativeTab(CreativeTab.instance); block.setBlockName(createUnlocalizedName(block)); - GameRegistry.registerBlock(block, itemBlock, ((IName)block).getName()); + GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName()); + if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD)); } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/FakePlayerUtil.java b/src/main/java/ellpeck/actuallyadditions/util/FakePlayerUtil.java new file mode 100644 index 000000000..d61199c55 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/FakePlayerUtil.java @@ -0,0 +1,21 @@ +package ellpeck.actuallyadditions.util; + +import com.mojang.authlib.GameProfile; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayer; + +import java.util.UUID; + +public class FakePlayerUtil{ + + public static final String fakeName = "EllpecksActuallyAdditionsFakePlayer"; + public static GameProfile fakeProfile = new GameProfile(UUID.nameUUIDFromBytes(fakeName.getBytes()), fakeName); + + public static FakePlayer newFakePlayer(World world){ + if(world instanceof WorldServer){ + return new FakePlayer((WorldServer)world, fakeProfile); + } + else return null; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/IName.java b/src/main/java/ellpeck/actuallyadditions/util/INameableItem.java similarity index 51% rename from src/main/java/ellpeck/actuallyadditions/util/IName.java rename to src/main/java/ellpeck/actuallyadditions/util/INameableItem.java index 51a235199..7ae6d959f 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/IName.java +++ b/src/main/java/ellpeck/actuallyadditions/util/INameableItem.java @@ -1,7 +1,9 @@ package ellpeck.actuallyadditions.util; -public interface IName{ +public interface INameableItem{ String getName(); + String getOredictName(); + } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java index ea10fd3aa..cfe583ece 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -3,13 +3,22 @@ package ellpeck.actuallyadditions.util; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.creative.CreativeTab; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.List; public class ItemUtil{ - public static String addStandardInformation(Item item){ - if(KeyUtil.isShiftPressed()) return StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)item).getName() + ".desc"); - else return shiftForInfo(); + @SuppressWarnings("unchecked") + public static void addInformation(Item item, List list, int lines, String extraName){ + if(KeyUtil.isShiftPressed()){ + for(int i = 0; i < lines; i++){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); + } + } + else list.add(shiftForInfo()); } public static void registerItems(Item[] items){ @@ -21,15 +30,24 @@ public class ItemUtil{ public static void register(Item item){ item.setCreativeTab(CreativeTab.instance); item.setUnlocalizedName(createUnlocalizedName(item)); - GameRegistry.registerItem(item, ((IName)item).getName()); + GameRegistry.registerItem(item, ((INameableItem)item).getName()); + if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), new ItemStack(item, 1, Util.WILDCARD)); + } + + public static void register(Item item, Enum[] list){ + item.setCreativeTab(CreativeTab.instance); + item.setUnlocalizedName(createUnlocalizedName(item)); + GameRegistry.registerItem(item, ((INameableItem)item).getName()); + for(Enum current : list){ + if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(item, 1, current.ordinal())); + } } public static String createUnlocalizedName(Item item){ - return ModUtil.MOD_ID_LOWER + "." + ((IName)item).getName(); + return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName(); } public static String shiftForInfo(){ return StringUtil.GREEN + StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".shiftForInfo.desc"); } - } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index bd96d90b2..94584f60d 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.3"; + public static final String VERSION = "1.7.10-0.0.4.3"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java index 968cda7c5..4319d7753 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java @@ -27,5 +27,6 @@ public class StringUtil{ public static final String[] ROMAN_NUMERALS = new String[]{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; public static final int DECIMAL_COLOR_WHITE = 16777215; + public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752; } diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java new file mode 100644 index 000000000..05966627c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -0,0 +1,66 @@ +package ellpeck.actuallyadditions.util; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldUtil{ + + public static ChunkCoordinates getCoordsFromSide(ForgeDirection side, int x, int y, int z){ + if(side == ForgeDirection.UNKNOWN) return null; + return new ChunkCoordinates(x+side.offsetX, y+side.offsetY, z+side.offsetZ); + } + + public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){ + ChunkCoordinates c = getCoordsFromSide(side, x, y, z); + if(c != null){ + world.setBlockToAir(c.posX, c.posY, c.posZ); + } + } + + public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){ + if(world instanceof WorldServer){ + if(side != ForgeDirection.UNKNOWN){ + return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world, x, y, z, side.ordinal(), 0, 0, 0); + } + } + return false; + } + + public static boolean dropItemAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){ + if(side != ForgeDirection.UNKNOWN){ + ChunkCoordinates coords = getCoordsFromSide(side, x, y, z); + if(coords != null){ + EntityItem item = new EntityItem(world, coords.posX+0.5, coords.posY+0.5, coords.posZ+0.5, stack); + item.motionX = 0; + item.motionY = 0; + item.motionZ = 0; + world.spawnEntityInWorld(item); + } + } + return false; + } + + public static TileEntity getTileEntityFromSide(ForgeDirection side, World world, int x, int y, int z){ + ChunkCoordinates c = getCoordsFromSide(side, x, y, z); + if(c != null){ + return world.getTileEntity(c.posX, c.posY, c.posZ); + } + return null; + } + + public static ForgeDirection getDirectionByRotatingSide(int side){ + if(side == 0) return ForgeDirection.UP; + if(side == 1) return ForgeDirection.DOWN; + if(side == 2) return ForgeDirection.NORTH; + if(side == 3) return ForgeDirection.EAST; + if(side == 4) return ForgeDirection.SOUTH; + if(side == 5) return ForgeDirection.WEST; + else return ForgeDirection.UNKNOWN; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java new file mode 100644 index 000000000..d2dd090fa --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java @@ -0,0 +1,76 @@ +package ellpeck.actuallyadditions.waila; + +import ellpeck.actuallyadditions.tile.TileEntityCompost; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +import java.util.List; + +@SuppressWarnings("unused") +public class WailaDataProvider implements IWailaDataProvider{ + + private final String WAILA_PRE_LANG = "gui." + ModUtil.MOD_ID_LOWER + ".waila."; + + @Override + public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){ + return null; + } + + @Override + public List getWailaHead(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ + return currentTip; + } + + @Override + public List getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ + + if (accessor.getTileEntity() instanceof TileEntityCompost){ + this.compostBody(accessor, currentTip); + } + + return currentTip; + } + + public void compostBody(IWailaDataAccessor accessor, List currentTip){ + int meta = accessor.getMetadata(); + TileEntityCompost tile = (TileEntityCompost)accessor.getTileEntity(); + + if(meta <= tile.amountNeededToConvert){ + String tip1 = StatCollector.translateToLocal(WAILA_PRE_LANG + "compostAmount" + ".name") + ": " + meta + "/" + tile.amountNeededToConvert; + currentTip.add(tip1); + + if(meta == tile.amountNeededToConvert){ + currentTip.add(StatCollector.translateToLocal(WAILA_PRE_LANG + "compostConverting" + ".name")); + } + } + + if(meta == tile.amountNeededToConvert+1){ + currentTip.add(StatCollector.translateToLocal(WAILA_PRE_LANG + "compostDone" + ".name")); + } + } + + @Override + public List getWailaTail(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ + return currentTip; + } + + @Override + public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z){ + return tag; + } + + public static void register(IWailaRegistrar registrar){ + Util.logInfo("Initializing Waila Plugin..."); + + registrar.registerBodyProvider(new WailaDataProvider(), TileEntityCompost.class); + } +} \ 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 ba9638d5b..9c5c10455 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -7,18 +7,26 @@ tile.actuallyadditions.blockMiscBlackQuartz.name=Block of Black Quartz tile.actuallyadditions.blockMiscBlackQuartzChiseled.name=Chiseled Block of Black Quartz tile.actuallyadditions.blockMiscBlackQuartzPillar.name=Pillar of Black Quartz tile.actuallyadditions.blockFeeder.name=Automatic Feeder -tile.actuallyadditions.blockGiantChest.name=Giant Chest +tile.actuallyadditions.blockGiantChest.name=Storage Crate tile.actuallyadditions.blockGrinder.name=Crusher 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.blockFurnaceSolar.name=Solar Panel [TEMPORARILY UNIMPLEMENTED] +tile.actuallyadditions.blockHeatCollector.name=Heat Collector [TEMPORARILY UNIMPLEMENTED] tile.actuallyadditions.blockItemRepairer.name=Item Repairer +tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing +tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing +tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass + +tile.actuallyadditions.blockBreaker.name=Auto-Breaker +tile.actuallyadditions.blockPlacer.name=Auto-Placer +tile.actuallyadditions.blockDropper.name=Automatic Precision Dropper + tile.actuallyadditions.blockInputter.name=ESD -tile.actuallyadditions.blockInputter.add.0.name=Ellpeck's Slot Device -tile.actuallyadditions.blockInputter.add.1.name=Energetic Solo Dancer +tile.actuallyadditions.blockInputterAdvanced.name=Advanced ESD +tile.actuallyadditions.blockInputter.add.1.name=Ellpeck's Slot Device tile.actuallyadditions.blockInputter.add.2.name=Ethereal System Dude tile.actuallyadditions.blockInputter.add.3.name=Energy Stuff Distributor tile.actuallyadditions.blockInputter.add.4.name=Existing Stuff Donator @@ -29,7 +37,10 @@ tile.actuallyadditions.blockInputter.add.8.name=Extraordinary Sample Deliverer tile.actuallyadditions.blockInputter.add.9.name=Express Sending Doughnut tile.actuallyadditions.blockInputter.add.10.name=Expelling Sugar Dagger tile.actuallyadditions.blockInputter.add.11.name=Extra-Long Solidifying Dissociation -tile.actuallyadditions.blockInputter.add.12.name=Extravagant Supreme Dirt +tile.actuallyadditions.blockInputter.add.12.name=Energetic Solo Dancer +tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant +tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger +tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO item.actuallyadditions.itemMiscMashedFood.name=Mashed Food item.actuallyadditions.itemFertilizer.name=Fertilizer @@ -40,6 +51,13 @@ item.actuallyadditions.itemMiscKnifeHandle.name=Knife Handle item.actuallyadditions.itemMiscBlackQuartz.name=Black Quartz item.actuallyadditions.itemMiscRing.name=Ring +item.actuallyadditions.itemJamCuBaRa.name=CuBaRa-Jam +item.actuallyadditions.itemJamGraKiBa.name=GraKiBa-Jam +item.actuallyadditions.itemJamPlApLe.name=PlApLe-Jam +item.actuallyadditions.itemJamChApCi.name=ChApCi-Jam +item.actuallyadditions.itemJamHoMeKi.name=HoMeKi-Jam +item.actuallyadditions.itemJamPiCo.name=PiCo-Jam + item.actuallyadditions.itemLeafBlower.name=Leaf Blower item.actuallyadditions.itemLeafBlowerAdvanced.name=Advanced Leaf Blower item.actuallyadditions.itemKnife.name=Knife @@ -72,6 +90,11 @@ item.actuallyadditions.itemFoodCarrotJuice.name=Carrot Juice item.actuallyadditions.itemFoodPumpkinStew.name=Pumpkin Stew item.actuallyadditions.itemFoodCheese.name=Cheese +item.actuallyadditions.itemUpgradeSpeed.name=Speed Upgrade + +item.actuallyadditions.itemMiscCoil.name=Basic Coil +item.actuallyadditions.itemMiscCoilAdvanced.name=Advanced Coil + item.actuallyadditions.itemPotionRing.name=Ring of item.actuallyadditions.itemPotionRingAdvanced.name=Advanced Ring of @@ -96,14 +119,79 @@ tooltip.actuallyadditions.hunger.desc=Fills tooltip.actuallyadditions.saturation.desc=Saturation tooltip.actuallyadditions.durability.desc=Durability -tooltip.actuallyadditions.blockCompost.desc.1=Used to make Fertilizer with Mashed Food -tooltip.actuallyadditions.blockCompost.desc.2=BETA INFO: Will visually contain Compost in the Future! +tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries +tooltip.actuallyadditions.noOredictNameAvail.desc=Has No OreDictionary Entries + +tooltip.actuallyadditions.itemJam.desc.1=A delicious Jam consisting of +tooltip.actuallyadditions.itemJam.desc.2=Also gives you some Effects! +tooltip.actuallyadditions.itemJamCuBaRa.desc=Currant, Banana and Raspberry +tooltip.actuallyadditions.itemJamGraKiBa.desc=Grape, Kiwi and Banana +tooltip.actuallyadditions.itemJamPlApLe.desc=Plum, Apple and Lemon +tooltip.actuallyadditions.itemJamChApCi.desc=Cherry, Apple and Cinnamon +tooltip.actuallyadditions.itemJamHoMeKi.desc=Honeydew Melon and Kiwi +tooltip.actuallyadditions.itemJamPiCo.desc=Pineapple and Coconut + +tile.actuallyadditions.blockCompactIronSingle.name=Single Compact Iron +tile.actuallyadditions.blockCompactIronDouble.name=Double Compact Iron +tile.actuallyadditions.blockCompactIronTriple.name=Triple Compact Iron +tile.actuallyadditions.blockCompactIronQuadruple.name=Quadruple Compact Iron +tile.actuallyadditions.blockCompactIronQuintuple.name=Quintuple Compact Iron +tile.actuallyadditions.blockCompactIronSextuple.name=Sextuple Compact Iron +tooltip.actuallyadditions.blockCompactIron.desc=Iron, but bunched together! + +tile.actuallyadditions.blockCompactGoldSingle.name=Single Compact Gold +tile.actuallyadditions.blockCompactGoldDouble.name=Double Compact Gold +tile.actuallyadditions.blockCompactGoldTriple.name=Triple Compact Gold +tile.actuallyadditions.blockCompactGoldQuadruple.name=Quadruple Compact Gold +tile.actuallyadditions.blockCompactGoldQuintuple.name=Quintuple Compact Gold +tile.actuallyadditions.blockCompactGoldSextuple.name=Sextuple Compact Gold +tooltip.actuallyadditions.blockCompactGold.desc=Gold, but bunched together! + +tile.actuallyadditions.blockCompactDiamondSingle.name=Single Compact Diamond +tile.actuallyadditions.blockCompactDiamondDouble.name=Double Compact Diamond +tile.actuallyadditions.blockCompactDiamondTriple.name=Triple Compact Diamond +tile.actuallyadditions.blockCompactDiamondQuadruple.name=Quadruple Compact Diamond +tile.actuallyadditions.blockCompactDiamondQuintuple.name=Quintuple Compact Diamond +tile.actuallyadditions.blockCompactDiamondSextuple.name=Sextuple Compact Diamond +tooltip.actuallyadditions.blockCompactDiamond.desc=Diamond, but bunched together! + +tile.actuallyadditions.blockCompactRedstoneSingle.name=Single Compact Redstone +tile.actuallyadditions.blockCompactRedstoneDouble.name=Double Compact Redstone +tile.actuallyadditions.blockCompactRedstoneTriple.name=Triple Compact Redstone +tile.actuallyadditions.blockCompactRedstoneQuadruple.name=Quadruple Compact Redstone +tile.actuallyadditions.blockCompactRedstoneQuintuple.name=Quintuple Compact Redstone +tile.actuallyadditions.blockCompactRedstoneSextuple.name=Sextuple Compact Redstone +tooltip.actuallyadditions.blockCompactRedstone.desc=Redstone, but bunched together! + +tile.actuallyadditions.blockCompactCoalSingle.name=Single Compact Coal +tile.actuallyadditions.blockCompactCoalDouble.name=Double Compact Coal +tile.actuallyadditions.blockCompactCoalTriple.name=Triple Compact Coal +tile.actuallyadditions.blockCompactCoalQuadruple.name=Quadruple Compact Coal +tile.actuallyadditions.blockCompactCoalQuintuple.name=Quintuple Compact Coal +tile.actuallyadditions.blockCompactCoalSextuple.name=Sextuple Compact Coal +tooltip.actuallyadditions.blockCompactCoal.desc=Coal, but bunched together! + +tile.actuallyadditions.blockCompactLapisSingle.name=Single Compact Lapis +tile.actuallyadditions.blockCompactLapisDouble.name=Double Compact Lapis +tile.actuallyadditions.blockCompactLapisTriple.name=Triple Compact Lapis +tile.actuallyadditions.blockCompactLapisQuadruple.name=Quadruple Compact Lapis +tile.actuallyadditions.blockCompactLapisQuintuple.name=Quintuple Compact Lapis +tile.actuallyadditions.blockCompactLapisSextuple.name=Sextuple Compact Lapis +tooltip.actuallyadditions.blockCompactLapis.desc=Lapis, but bunched together! + +tooltip.actuallyadditions.itemUpgradeSpeed.desc.1=Speeds up Machines when placed in their Upgrade Slot +tooltip.actuallyadditions.itemUpgradeSpeed.desc.2=Works in: +tooltip.actuallyadditions.itemUpgradeSpeed.desc.3=-Double Furnace +tooltip.actuallyadditions.itemUpgradeSpeed.desc.4=-Crusher +tooltip.actuallyadditions.itemUpgradeSpeed.desc.5=-Double Crusher + +tooltip.actuallyadditions.blockCompost.desc=Used to make Fertilizer with Mashed Food tooltip.actuallyadditions.blockMiscOreBlackQuartz.desc=The darkest form of Quartz. tooltip.actuallyadditions.blockMiscBlackQuartz.desc=Black, eerie Quartz! Nice for decorating. tooltip.actuallyadditions.blockMiscBlackQuartzChiseled.desc=Black, eerie chiseled Quartz! Nice for decorating. tooltip.actuallyadditions.blockMiscBlackQuartzPillar.desc=Kind of a pillar. Not really, though. It's fake! Fake I say! tooltip.actuallyadditions.blockFeeder.desc=Feeds Animals on its own! -tooltip.actuallyadditions.blockGiantChest.desc=GUI Scale on 'Auto'? That's a problem! +tooltip.actuallyadditions.blockGiantChest.desc=Stores a whole lot of stuff. Bigger than a Double Chest! tooltip.actuallyadditions.blockGrinder.desc.1=Crushes Ores into Dusts! tooltip.actuallyadditions.blockGrinder.desc.2=You get two Dusts per Ore and Extras! tooltip.actuallyadditions.blockGrinder.desc.3=To crush two ores simultaneously, @@ -114,16 +202,22 @@ tooltip.actuallyadditions.blockGrinderDouble.desc.3=Can crush two Ores simultane tooltip.actuallyadditions.blockFurnaceDouble.desc=Smelts two things simultaneously! tooltip.actuallyadditions.blockInputter.desc.1=Its real name is %sObfuscated%s! tooltip.actuallyadditions.blockInputter.desc.2=Acts like a more advanced Hopper -tooltip.actuallyadditions.blockInputter.desc.3=Configurable: -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.blockInputter.desc.3=Turn me off with Redstone! +tooltip.actuallyadditions.blockInputter.desc.4=Configurable: +tooltip.actuallyadditions.blockInputter.desc.5=-Side to Output to and Input from +tooltip.actuallyadditions.blockInputter.desc.6=-Slot in the other Inventory to Output to and Input from +tooltip.actuallyadditions.blockInputterAdvanced.desc=Has an Input and Output Filter! tooltip.actuallyadditions.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.blockFurnaceSolar.desc=Powers Actually Additions Machines and Vanilla Furnaces below it in Daylight +tooltip.actuallyadditions.blockHeatCollector.desc.1=Powers Actually Additions Machines and Vanilla Furnaces 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.blockBreaker.desc=Breaks Blocks and stores them in its internal Inventory +tooltip.actuallyadditions.blockPlacer.desc=Places Blocks stored in its internal Inventory +tooltip.actuallyadditions.blockDropper.desc=Drops Items automatically (Without spewing them all over the Place!) + tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost. tooltip.actuallyadditions.itemMiscDough.desc=Used to make things that involve dough. @@ -133,11 +227,19 @@ 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.blockMiscWoodCasing.desc=Not so sturdy Casing, used for Crafting +tooltip.actuallyadditions.blockMiscStoneCasing.desc=Pretty sturdy Casing, used for Crafting +tooltip.actuallyadditions.blockGreenhouseGlass.desc=Lets Crops below it grow faster when it is Daytime +tooltip.actuallyadditions.blockCrafter.desc=Automatically crafts Items without needing any form of Power + 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.itemMiscCoil.desc=Lower Tier Coil, used for Crafting +tooltip.actuallyadditions.itemMiscCoilAdvanced.desc=Higher Tier Coil, used for Crafting + tooltip.actuallyadditions.itemPotionRingAdvanced.desc.1=Gives Potion Effect of a High Level tooltip.actuallyadditions.itemPotionRingAdvanced.desc.2=Can be anywhere in the Inventory @@ -191,31 +293,6 @@ tooltip.actuallyadditions.itemDustQuartz.desc=Quartz! Crushed in the Crusher! tooltip.actuallyadditions.itemDustCoal.desc=Coal! Crushed in the Crusher! tooltip.actuallyadditions.itemDustQuartzBlack.desc=Black Quartz! Crushed in the Crusher! -achievement.actuallyadditions.smeltBaguette=Better than Bread! -achievement.actuallyadditions.smeltBaguette.desc=Bake a Baguette -achievement.actuallyadditions.craftDough=Knead, knead! -achievement.actuallyadditions.craftDough.desc=Craft some Dough -achievement.actuallyadditions.craftCompost=Throw it all in! -achievement.actuallyadditions.craftCompost.desc=Craft a Compost -achievement.actuallyadditions.craftFertilizer=Better than Bone Meal! -achievement.actuallyadditions.craftFertilizer.desc=Make Fertilizer -achievement.actuallyadditions.craftSubSandwich=Metro, Underground, Tube, Nom! -achievement.actuallyadditions.craftSubSandwich.desc=Craft a Submarine Sandwich -achievement.actuallyadditions.craftPaperCone=Witch's hat! -achievement.actuallyadditions.craftPaperCone.desc=Craft a Paper Cone -achievement.actuallyadditions.craftFrenchFry=Just the single one... -achievement.actuallyadditions.craftFrenchFry.desc=Craft a French Fry -achievement.actuallyadditions.craftFrenchFries=French Fires? -achievement.actuallyadditions.craftFrenchFries.desc=Craft French Fries -achievement.actuallyadditions.craftFishNChips=It's Fish! It's Chips! -achievement.actuallyadditions.craftFishNChips.desc=Craft Fish 'N' Chips -achievement.actuallyadditions.craftMashedFood=Munch munch munch! -achievement.actuallyadditions.craftMashedFood.desc=Craft Mashed Food -achievement.actuallyadditions.craftKnifeBlade=Sharp! So sharp! -achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade -achievement.actuallyadditions.craftKnife=Sharper! Even sharper! -achievement.actuallyadditions.craftKnife.desc=Craft a Knife - info.actuallyadditions.gui.animals=Animals info.actuallyadditions.gui.enoughToBreed=Enough to breed! info.actuallyadditions.gui.tooMany=Too many to breed! @@ -242,4 +319,45 @@ 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 +effect.actuallyadditions.saturation.name=Saturation + +container.actuallyadditions.inputter.name=ESD +container.actuallyadditions.inputterAdvanced.name=Advanced ESD +container.actuallyadditions.grinder.name=Crusher +container.actuallyadditions.grinderDouble.name=Double Crusher +container.actuallyadditions.furnaceDouble.name=Double Furnace +container.actuallyadditions.feeder.name=Feeder +container.actuallyadditions.giantChest.name=Storage Crate +container.actuallyadditions.repairer.name=Repairer +container.actuallyadditions.placer.name=Placer +container.actuallyadditions.breaker.name=Breaker +container.actuallyadditions.dropper.name=Precision Dropper +container.actuallyadditions.crafting.name=Crafting Table On A Stick + +container.actuallyadditions.nei.crushing.name=Crusher + +gui.actuallyadditions.waila.compostAmount.name=Amount of Mashed Food +gui.actuallyadditions.waila.compostDone.name=Done! +gui.actuallyadditions.waila.compostConverting.name=Converting... + +info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}] +info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}] +info.actuallyadditions.update.download.desc=[{"text":"Download the newest Version "},{"text":"here! (Click me!)","color":"dark_green","underlined":"true","clickEvent":{"action":"open_url","value":"%s"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click here to open your Browser and download the newest Version!"}]}}}] +info.actuallyadditions.update.failed.desc=[{"text":"The Update Check for "},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"failed! Check your Internet Connection and the Logs for more Info!","color":"none"}] + +achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff +achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience +achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp! +achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade +achievement.actuallyadditions.craftKnife=Cutcutcutcutcutcutcutcutcutcutcut! +achievement.actuallyadditions.craftKnife.desc=Craft a Knife +achievement.actuallyadditions.craftMashedFood=Munch munch munch! +achievement.actuallyadditions.craftMashedFood.desc=Craft some Mashed Food +achievement.actuallyadditions.craftWoodenCasing=Hard and sturdy! +achievement.actuallyadditions.craftWoodenCasing.desc=Craft a Wooden Casing +achievement.actuallyadditions.craftStoneCasing=Harder and sturdier! +achievement.actuallyadditions.craftStoneCasing.desc=Craft a Stone Casing +achievement.actuallyadditions.craftBasicCoil=Transmits.. power.. or something? +achievement.actuallyadditions.craftBasicCoil.desc=Craft a Basic Coil +achievement.actuallyadditions.craftAdvancedCoil=Transmits... more power I guess. +achievement.actuallyadditions.craftAdvancedCoil.desc=Craft an Advanced Coil \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreaker.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreaker.png new file mode 100644 index 000000000..9a81851c1 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreaker.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerFront.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerFront.png new file mode 100644 index 000000000..e5c3e4ba7 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerFront.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerTop.png new file mode 100644 index 000000000..819a89861 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockBreakerTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropper.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropper.png new file mode 100644 index 000000000..1b700624e Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropper.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperFront.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperFront.png new file mode 100644 index 000000000..3ee2f356c Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperFront.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperTop.png new file mode 100644 index 000000000..819a89861 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockDropperTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeeder.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeeder.png index fe16b7fa5..44ef1d178 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeeder.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeeder.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeederTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeederTop.png index b5c8ca857..3ac8e8b34 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeederTop.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFeederTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChest.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChest.png index 898ee7474..d2fff5bb4 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChest.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChest.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestBottom.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestBottom.png new file mode 100644 index 000000000..4d6a4d271 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestBottom.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestTop.png index 485f8a4f0..52880a6e9 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestTop.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGiantChestTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockGreenhouseGlass.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGreenhouseGlass.png new file mode 100644 index 000000000..11b4a7fc2 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockGreenhouseGlass.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockInputterAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockInputterAdvanced.png new file mode 100644 index 000000000..1e3199c6d Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockInputterAdvanced.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscStoneCasing.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscStoneCasing.png new file mode 100644 index 000000000..e32c54303 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscStoneCasing.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscWoodCasing.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscWoodCasing.png new file mode 100644 index 000000000..da2fae99f Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockMiscWoodCasing.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacer.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacer.png new file mode 100644 index 000000000..b1fdace56 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacer.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerFront.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerFront.png new file mode 100644 index 000000000..29683af36 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerFront.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerTop.png new file mode 100644 index 000000000..819a89861 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockPlacerTop.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelCompost.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelCompost.png index 2da473943..5f8316a13 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelCompost.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelCompost.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/entity/villager/jamVillager.png b/src/main/resources/assets/actuallyadditions/textures/entity/villager/jamVillager.png new file mode 100644 index 000000000..910912ca6 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/entity/villager/jamVillager.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiBreaker.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiBreaker.png new file mode 100644 index 000000000..8bdee9186 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/guiBreaker.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiFurnaceDouble.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiFurnaceDouble.png index 407b5b952..c4a1f8bf9 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiFurnaceDouble.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiFurnaceDouble.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinder.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinder.png index b17b169ef..9c94d97ff 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinder.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinder.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinderDouble.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinderDouble.png index f57b24fca..608242579 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinderDouble.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiGrinderDouble.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png new file mode 100644 index 000000000..673ce121b Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/guiInputterAdvanced.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiInventory.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiInventory.png index 6916cd386..52d44be19 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiInventory.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiInventory.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemJam.png b/src/main/resources/assets/actuallyadditions/textures/items/itemJam.png new file mode 100644 index 000000000..c809c3362 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemJam.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemJamOverlay.png b/src/main/resources/assets/actuallyadditions/textures/items/itemJamOverlay.png new file mode 100644 index 000000000..d6ce4d94f Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemJamOverlay.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png index 65503eabd..ad59792f7 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlower.png 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 index 0f64f1940..5b9b6eb7d 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png and b/src/main/resources/assets/actuallyadditions/textures/items/itemLeafBlowerAdvanced.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoil.png b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoil.png new file mode 100644 index 000000000..c56f57da8 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoil.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoilAdvanced.png b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoilAdvanced.png new file mode 100644 index 000000000..593cbf2dc Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemMiscCoilAdvanced.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemUpgradeSpeed.png b/src/main/resources/assets/actuallyadditions/textures/items/itemUpgradeSpeed.png new file mode 100644 index 000000000..59c1c5361 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemUpgradeSpeed.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f7dcf1a26..435c78154 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,8 +2,8 @@ { "modid": "ActuallyAdditions", "name": "Actually Additions", - "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", + "description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!", + "version": "0.0.4.3", "mcversion": "1.7.10", "url": "https://github.com/Ellpeck/ActuallyAdditions", "updateUrl": "",