From 36f721ed3089ce4a4e2c82b6e9781575d32c8141 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 23 Mar 2015 16:47:36 +0100 Subject: [PATCH 1/3] Delete gradle.xml --- .idea/gradle.xml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .idea/gradle.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index e8060c247..000000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file From 0bfb102ca92881438883b5ab402c0b143cc2726d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 29 Mar 2015 15:29:05 +0200 Subject: [PATCH 2/3] Leaf Blower! --- build.gradle | 2 +- .../actuallyadditions/ActuallyAdditions.java | 5 +- .../achievement/AchievementAA.java | 4 +- .../achievement/InitAchievements.java | 3 +- .../blocks/BlockCompost.java | 12 +- .../actuallyadditions/blocks/BlockFeeder.java | 12 +- .../blocks/BlockFurnaceDouble.java | 16 ++- .../blocks/BlockGiantChest.java | 12 +- .../blocks/BlockGrinder.java | 18 +-- .../blocks/BlockInputter.java | 55 ++----- .../actuallyadditions/blocks/BlockMisc.java | 10 +- .../actuallyadditions/blocks/InitBlocks.java | 17 +-- .../blocks/render/RenderItems.java | 4 +- .../blocks/render/RenderTileEntity.java | 4 +- .../config/ConfigValues.java | 16 +++ .../crafting/FoodCrafting.java | 16 ++- .../crafting/GrinderCrafting.java | 27 ++-- .../crafting/ItemCrafting.java | 19 ++- .../creative/CreativeTab.java | 6 +- .../actuallyadditions/event/CraftEvent.java | 1 + .../actuallyadditions/event/KilledEvent.java | 6 +- .../actuallyadditions/event/SmeltEvent.java | 1 + .../ellpeck/actuallyadditions/gen/OreGen.java | 3 +- .../inventory/GuiFeeder.java | 9 +- .../inventory/GuiFurnaceDouble.java | 6 +- .../inventory/GuiGiantChest.java | 6 +- .../inventory/GuiGrinder.java | 8 +- .../inventory/GuiInputter.java | 31 ++-- .../actuallyadditions/items/InitItems.java | 27 ++-- .../items/ItemCrafterOnAStick.java | 7 +- .../actuallyadditions/items/ItemDust.java | 10 +- .../items/ItemFertilizer.java | 7 +- .../actuallyadditions/items/ItemFoods.java | 16 ++- .../actuallyadditions/items/ItemKnife.java | 14 +- .../items/ItemLeafBlower.java | 136 ++++++++++++++++++ .../actuallyadditions/items/ItemMisc.java | 10 +- .../items/ItemSpecialDrop.java | 10 +- .../items/metalists/TheDusts.java | 4 +- .../items/metalists/TheFoods.java | 4 +- .../items/metalists/TheSpecialDrops.java | 10 +- .../items/tools/ItemAxeAA.java | 13 +- .../items/tools/ItemHoeAA.java | 13 +- .../items/tools/ItemPickaxeAA.java | 13 +- .../items/tools/ItemShovelAA.java | 13 +- .../items/tools/ItemSwordAA.java | 13 +- .../network/PacketHandler.java | 4 +- .../tile/TileEntityBase.java | 13 +- .../tile/TileEntityInputter.java | 82 +++++++---- .../actuallyadditions/util/AssetUtil.java | 13 ++ .../actuallyadditions/util/BlockUtil.java | 20 +++ .../ellpeck/actuallyadditions/util/IName.java | 2 +- .../actuallyadditions/util/ItemUtil.java | 35 +++++ .../actuallyadditions/util/KeyUtil.java | 15 ++ .../actuallyadditions/util/ModUtil.java | 16 +++ .../actuallyadditions/util/StringUtil.java | 31 ++++ .../ellpeck/actuallyadditions/util/Util.java | 94 +----------- .../assets/actuallyadditions/lang/de_DE.lang | 4 +- .../assets/actuallyadditions/lang/en_US.lang | 6 + src/main/resources/mcmod.info | 2 +- 59 files changed, 628 insertions(+), 358 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/ModUtil.java create mode 100644 src/main/java/ellpeck/actuallyadditions/util/StringUtil.java diff --git a/build.gradle b/build.gradle index 00c492554..e1df25fcd 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-0.0.2.1" +version = "1.7.10-0.0.2.3" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index e5ad5e275..90c9dddc2 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -21,12 +21,13 @@ 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; import ellpeck.actuallyadditions.util.Util; -@Mod(modid = Util.MOD_ID, name = Util.NAME, version = Util.VERSION) +@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION) public class ActuallyAdditions{ - @Instance(Util.MOD_ID) + @Instance(ModUtil.MOD_ID) public static ActuallyAdditions instance; @SidedProxy(clientSide = "ellpeck.actuallyadditions.proxy.ClientProxy", serverSide = "ellpeck.actuallyadditions.proxy.ServerProxy") diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java b/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java index c8f99ffcc..bb092eb4b 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/AchievementAA.java @@ -1,13 +1,13 @@ package ellpeck.actuallyadditions.achievement; -import ellpeck.actuallyadditions.util.Util; +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." + Util.MOD_ID_LOWER +"." + Util.MOD_ID_LOWER + "." + name, Util.MOD_ID_LOWER + "." + name, x, y, displayStack, 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(); diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java index fbe71ec2e..9930f8109 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java @@ -4,6 +4,7 @@ import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; @@ -53,7 +54,7 @@ public class InitAchievements{ achievementCraftFishNChips = new AchievementAA("craftFishNChips", 4, 2, new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), achievementCraftFrenchFry); - theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + Util.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()])); + theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()])); AchievementPage.registerAchievementPage(theAchievementPage); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index be50b1d3f..b1b9220d1 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -9,7 +9,9 @@ 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.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -147,12 +149,12 @@ public class BlockCompost extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.1")); + 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." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.2")); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.2")); } - else list.add(Util.shiftForInfo()); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java index d7d7b8317..7ea42f5f3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java @@ -6,7 +6,9 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFeeder; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -45,8 +47,8 @@ public class BlockFeeder extends BlockContainerBase implements IName{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); - this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); } @Override @@ -95,8 +97,8 @@ public class BlockFeeder extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index 650ff795f..1cf568b08 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -6,7 +6,9 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -90,10 +92,10 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); - this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Top"); - this.onIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "On"); - this.frontIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Front"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "On"); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front"); } @Override @@ -177,8 +179,8 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java index 79e36dcb2..6d3a0a7c9 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java @@ -6,7 +6,9 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -45,8 +47,8 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); - this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); } @Override @@ -95,8 +97,8 @@ public class BlockGiantChest extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index 456298e26..c7dc6c77e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -6,7 +6,9 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGrinder; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -76,10 +78,10 @@ public class BlockGrinder extends BlockContainerBase implements IName{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); - this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":blockGrinderTop"); - this.onIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":blockGrinderOn"); - this.bottomIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":blockGrinderBottom"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":blockGrinderTop"); + this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":blockGrinderOn"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":blockGrinderBottom"); } @Override @@ -128,12 +130,12 @@ public class BlockGrinder extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()){ + if(KeyUtil.isShiftPressed()){ for(int i = 0; i < (((BlockGrinder)theBlock).isDouble ? 3 : 4); i++){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i+1))); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i+1))); } } - else list.add(Util.shiftForInfo()); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 106c62e3c..7bfe8a6d9 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -5,21 +5,17 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityInputter; -import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.*; import net.minecraft.block.Block; 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.util.MathHelper; import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.List; @@ -37,46 +33,11 @@ public class BlockInputter extends BlockContainerBase implements IName{ this.setTickRandomly(true); } - @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); - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ - int rotation = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if (rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if (rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); - if (rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityInputter(); } - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z){ - return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0; - } - @Override public IIcon getIcon(int side, int meta){ return this.blockIcon; @@ -85,14 +46,14 @@ public class BlockInputter extends BlockContainerBase implements IName{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @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){ - TileEntityInputter furnace = (TileEntityInputter)world.getTileEntity(x, y, z); - if (furnace != null) player.openGui(ActuallyAdditions.instance, GuiHandler.INPUTTER_ID, world, x, y, z); + TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z); + if (inputter != null) player.openGui(ActuallyAdditions.instance, GuiHandler.INPUTTER_ID, world, x, y, z); return true; } return true; @@ -150,13 +111,13 @@ public class BlockInputter extends BlockContainerBase implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocalFormatted("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + 1, Util.OBFUSCATED, Util.LIGHT_GRAY)); + 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." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1))); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1))); } } - else list.add(Util.shiftForInfo()); + else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java index 9634b74a3..d04ae3cc7 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java @@ -4,7 +4,9 @@ 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.Util; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -52,7 +54,7 @@ public class BlockMisc extends Block implements IName{ @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allMiscBlocks[i].getName()); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + allMiscBlocks[i].getName()); } } @@ -86,8 +88,8 @@ public class BlockMisc extends Block implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + allMiscBlocks[stack.getItemDamage()].getName() + ".desc")); - else list.add(Util.shiftForInfo()); + 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()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 37db62ef2..7e6c96900 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.blocks; +import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; @@ -19,27 +20,27 @@ public class InitBlocks{ Util.logInfo("Initializing Blocks..."); blockCompost = new BlockCompost(); - Util.register(blockCompost, BlockCompost.TheItemBlock.class); + BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class); blockMisc = new BlockMisc(); - Util.register(blockMisc, BlockMisc.TheItemBlock.class); + BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class); blockFeeder = new BlockFeeder(); - Util.register(blockFeeder, BlockFeeder.TheItemBlock.class); + BlockUtil.register(blockFeeder, BlockFeeder.TheItemBlock.class); blockGiantChest = new BlockGiantChest(); - Util.register(blockGiantChest, BlockGiantChest.TheItemBlock.class); + BlockUtil.register(blockGiantChest, BlockGiantChest.TheItemBlock.class); blockGrinder = new BlockGrinder(false); - Util.register(blockGrinder, BlockGrinder.TheItemBlock.class); + BlockUtil.register(blockGrinder, BlockGrinder.TheItemBlock.class); blockGrinderDouble = new BlockGrinder(true); - Util.register(blockGrinderDouble, BlockGrinder.TheItemBlock.class); + BlockUtil.register(blockGrinderDouble, BlockGrinder.TheItemBlock.class); blockFurnaceDouble = new BlockFurnaceDouble(); - Util.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class); + BlockUtil.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class); blockInputter = new BlockInputter(); - Util.register(blockInputter, BlockInputter.TheItemBlock.class); + BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java index d6d9f8f84..202ad6a4e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java @@ -1,6 +1,6 @@ package ellpeck.actuallyadditions.blocks.render; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -14,7 +14,7 @@ public class RenderItems implements IItemRenderer{ public RenderItems(ModelBaseAA model){ this.theModel = model; - this.theTexture = new ResourceLocation(Util.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png"); + this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java index 358f06179..1d4ddb04a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java @@ -1,6 +1,6 @@ package ellpeck.actuallyadditions.blocks.render; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; @@ -20,7 +20,7 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{ 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(Util.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png")); + this.bindTexture(new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png")); theModel.render(0.0625F); GL11.glPopMatrix(); } diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index 240d76c82..20505d2e5 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -59,6 +59,14 @@ public class ConfigValues{ public static int blackQuartzMinHeight; public static int blackQuartzMaxHeight; + public static boolean enableLeafBlowerRecipe; + public static boolean enableLeafBlowerAdvancedRecipe; + public static int leafBlowerRangeSides; + public static int leafBlowerRangeUp; + public static boolean leafBlowerDropItems; + public static boolean leafBlowerParticles; + public static boolean leafBlowerHasSound; + public static void defineConfigValues(Configuration config){ for(int i = 0; i < enabledFoodRecipes.length; i++){ @@ -68,6 +76,14 @@ public class ConfigValues{ enabledMiscRecipes[i] = config.getBoolean(TheMiscItems.values()[i].name, ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled"); } + 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"); + 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"); diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java index 173ec6482..fc81c1203 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java @@ -14,6 +14,8 @@ public class FoodCrafting{ public static void init(){ + ItemStack knifeStack = new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD); + //Baguette if(ConfigValues.enabledFoodRecipes[TheFoods.BAGUETTE.ordinal()]) GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, @@ -27,7 +29,7 @@ public class FoodCrafting{ 'M', new ItemStack(Blocks.brown_mushroom), 'C', new ItemStack(Items.carrot), 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), - 'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD), + 'K', knifeStack, 'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())); //Hamburger @@ -36,7 +38,7 @@ public class FoodCrafting{ "KT ", "CB ", " T ", 'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()), 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), - 'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD), + 'K', knifeStack, 'B', new ItemStack(Items.cooked_beef)); //Big Cookie @@ -54,13 +56,13 @@ public class FoodCrafting{ 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), - 'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + 'K', knifeStack); //French Fry if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRY.ordinal()]) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()), + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), new ItemStack(Items.baked_potato), - new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + knifeStack); //French Fries if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRIES.ordinal()]) @@ -92,7 +94,7 @@ public class FoodCrafting{ //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), new ItemStack(InitItems.itemKnife)); + new ItemStack(Items.glass_bottle), new ItemStack(Items.carrot), knifeStack); //Spaghetti if(ConfigValues.enabledFoodRecipes[TheFoods.SPAGHETTI.ordinal()]) @@ -104,7 +106,7 @@ public class FoodCrafting{ //Noodle if(ConfigValues.enabledFoodRecipes[TheFoods.NOODLE.ordinal()]) GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), - new ItemStack(Items.wheat), new ItemStack(InitItems.itemKnife)); + new ItemStack(Items.wheat), knifeStack); //Chocolate if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE.ordinal()]) diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java index c4eee3c8f..ddba1280a 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java @@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.crafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; 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; @@ -37,11 +38,11 @@ public class GrinderCrafting{ } if(name.length() > 9 && name.substring(0, 9).equals("oreNether")){ nameOfOre = name.substring(9); - resultAmount = 2; + resultAmount = 4; } if(name.length() > 8 && name.substring(0, 8).equals("denseore")){ nameOfOre = name.substring(8); - resultAmount = 6; + 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); @@ -55,24 +56,30 @@ public class GrinderCrafting{ if(allDusts != null && allDusts.size() > 0){ ArrayList allOresOfName = OreDictionary.getOres(name); if(allOresOfName != null && allOresOfName.size() > 0){ - for(ItemStack output : allDusts){ + for(ItemStack theDust : allDusts){ + ItemStack output = theDust.copy(); output.stackSize = resultAmount; - for(ItemStack input : allOresOfName){ + for(ItemStack theInput : allOresOfName){ + ItemStack input = theInput.copy(); if(GrinderRecipes.instance().getOutput(input, false) == null){ + ArrayList specialStacks = null; - if(name.equals("oreNickel")){ - ArrayList specialStacks = OreDictionary.getOres("dustPlatinum"); - for(ItemStack theSpecial : specialStacks) GrinderRecipes.instance().registerRecipe(input, output, theSpecial, 10); + 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 Util.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 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")) Util.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 :("); + 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 :("); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 07a6d95df..26c666b3f 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -18,6 +18,24 @@ public class ItemCrafting{ public static void init(){ + //Leaf Blower + if(ConfigValues.enableLeafBlowerRecipe) + GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlower), + " F", "IP", "IR", + 'F', new ItemStack(Items.flint), + 'I', new ItemStack(Items.iron_ingot), + 'P', new ItemStack(Blocks.piston), + 'R', new ItemStack(Items.redstone)); + + //Advanced Leaf Blower + if(ConfigValues.enableLeafBlowerAdvancedRecipe) + GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), + " F", "DP", "DR", + 'F', new ItemStack(Items.flint), + 'D', new ItemStack(Items.diamond), + 'P', new ItemStack(Blocks.piston), + 'R', new ItemStack(Items.redstone)); + //Quartz if(ConfigValues.enabledMiscRecipes[TheMiscItems.QUARTZ.ordinal()]) GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), @@ -40,7 +58,6 @@ public class ItemCrafting{ if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()]) initMashedFoodRecipes(); - //Ingots from Dusts GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()), new ItemStack(Items.iron_ingot), 1F); diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 119ed1c18..774e63afa 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.items.InitItems; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -18,7 +18,7 @@ public class CreativeTab extends CreativeTabs{ private List list; public CreativeTab(){ - super(Util.MOD_ID_LOWER); + super(ModUtil.MOD_ID_LOWER); } @Override @@ -43,6 +43,8 @@ public class CreativeTab extends CreativeTabs{ this.addItem(InitItems.itemCrafterOnAStick); this.addItem(InitItems.itemDust); this.addItem(InitItems.itemSpecialDrop); + this.addItem(InitItems.itemLeafBlower); + this.addItem(InitItems.itemLeafBlowerAdvanced); this.addItem(InitItems.itemPickaxeEmerald); this.addItem(InitItems.itemSwordEmerald); diff --git a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java index 2be836190..861072e89 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java @@ -10,6 +10,7 @@ import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import net.minecraft.item.Item; public class CraftEvent{ + @SubscribeEvent public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.DOUGH.ordinal()){ diff --git a/src/main/java/ellpeck/actuallyadditions/event/KilledEvent.java b/src/main/java/ellpeck/actuallyadditions/event/KilledEvent.java index d6f1c69ed..b7e1534b4 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/KilledEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/KilledEvent.java @@ -3,9 +3,6 @@ package ellpeck.actuallyadditions.event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.monster.EntityMob; -import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingDropsEvent; @@ -13,12 +10,13 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent; import java.util.Random; public class KilledEvent{ + @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event){ if(event.source.getEntity() instanceof EntityPlayer){ for(int i = 0; i < TheSpecialDrops.values().length; i++){ TheSpecialDrops theDrop = TheSpecialDrops.values()[i]; - if(theDrop.canDrop && (event.entityLiving.getClass() == theDrop.dropFrom || (event.entityLiving instanceof EntityCreature && theDrop.dropFrom == EntityCreature.class) || (event.entityLiving instanceof EntityMob && theDrop.dropFrom == EntityMob.class) || (event.entityLiving instanceof EntityAnimal && theDrop.dropFrom == EntityAnimal.class))){ + if(theDrop.canDrop && theDrop.dropFrom.isAssignableFrom(event.entityLiving.getClass())){ if(new Random().nextInt(100) + 1 <= theDrop.chance){ event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, new Random().nextInt(theDrop.maxAmount) + 1, theDrop.ordinal()), 0); } diff --git a/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java b/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java index 2f010c2eb..e45e8db0f 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/SmeltEvent.java @@ -7,6 +7,7 @@ import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; public class SmeltEvent{ + @SubscribeEvent public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){ if(event.smelting.getItem() == InitItems.itemFoods && event.smelting.getItemDamage() == TheFoods.BAGUETTE.ordinal()){ diff --git a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java index cbf1c6bdd..2f882b001 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java @@ -5,6 +5,7 @@ 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.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -53,7 +54,7 @@ public class OreGen implements IWorldGenerator{ new WorldGenMinable(block, meta, maxVeinSize, blockIn).generate(world, random, posX, posY, posZ); } } - else Util.AA_LOGGER.log(Level.FATAL, "Couldn't generate '" + block.getUnlocalizedName() + "' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!"); + else ModUtil.AA_LOGGER.log(Level.FATAL, "Couldn't generate '" + block.getUnlocalizedName() + "' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!"); } public int getRandom(int base, int extra, Random rand){ diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java index 827a3ab6f..e9e65625e 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFeeder.java @@ -4,7 +4,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFeeder; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -16,7 +17,7 @@ import java.util.Arrays; @SideOnly(Side.CLIENT) public class GuiFeeder extends GuiContainer{ - private static final ResourceLocation resLoc = Util.getGuiLocation("guiFeeder"); + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFeeder"); private TileEntityFeeder tileFeeder; public int loveCounter; @@ -31,7 +32,7 @@ public class GuiFeeder extends GuiContainer{ @Override public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION); + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft, this.guiTop+70, 0, 0, 176, 86); this.mc.getTextureManager().bindTexture(resLoc); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 70); @@ -58,7 +59,7 @@ public class GuiFeeder extends GuiContainer{ public void drawScreen(int x, int y, float f){ super.drawScreen(x, y, f); if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){ - String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.tooMany") : StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.notEnough")))}; + String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.tooMany") : StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.notEnough")))}; this.func_146283_a(Arrays.asList(array), x, y); } } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java index 828c58e20..4dc51d6d5 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiFurnaceDouble.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -13,7 +13,7 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiFurnaceDouble extends GuiContainer{ - private static final ResourceLocation resLoc = Util.getGuiLocation("guiFurnaceDouble"); + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFurnaceDouble"); private TileEntityFurnaceDouble tileFurnace; public GuiFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){ @@ -27,7 +27,7 @@ public class GuiFurnaceDouble extends GuiContainer{ public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION); + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); this.mc.getTextureManager().bindTexture(resLoc); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java index 7ebdd1543..a5d8cd670 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGiantChest.java @@ -3,7 +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.util.Util; +import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -12,7 +12,7 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiGiantChest extends GuiContainer{ - private static final ResourceLocation resLoc = Util.getGuiLocation("guiGiantChest"); + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest"); public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerGiantChest(inventory, tile)); @@ -26,7 +26,7 @@ public class GuiGiantChest extends GuiContainer{ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(resLoc); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 190); - this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION); + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+172, 0, 0, 176, 86); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java index 47d0b9c99..76e16a332 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiGrinder.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityGrinder; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -13,8 +13,8 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiGrinder extends GuiContainer{ - private static final ResourceLocation resLoc = Util.getGuiLocation("guiGrinder"); - private static final ResourceLocation resLocDouble = Util.getGuiLocation("guiGrinderDouble"); + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder"); + private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble"); private TileEntityGrinder tileGrinder; private boolean isDouble; @@ -30,7 +30,7 @@ public class GuiGrinder extends GuiContainer{ public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION); + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); this.mc.getTextureManager().bindTexture(this.isDouble ? resLocDouble : resLoc); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java index e82771d7d..fba4f7905 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiInputter.java @@ -6,7 +6,8 @@ import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.PacketInputterButton; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityInputter; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; @@ -21,7 +22,7 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiInputter extends GuiContainer{ - private static final ResourceLocation resLoc = Util.getGuiLocation("guiInputter"); + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); private TileEntityInputter tileInputter; private int x; @@ -35,13 +36,13 @@ public class GuiInputter extends GuiContainer{ private SmallerButton buttonSlotPullM; public static final String[] sideString = new String[]{ - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.disabled"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.up"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.down"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.north"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.east"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.south"), - StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.west")}; + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.down"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.north"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.east"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.south"), + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.west")}; public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){ super(new ContainerInputter(inventory, tile)); @@ -83,20 +84,20 @@ public class GuiInputter extends GuiContainer{ public void drawGuiContainerBackgroundLayer(float f, int x, int y){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION); + 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); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.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, 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32, 4210752); this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 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.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 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); } @Override @@ -117,7 +118,7 @@ public class GuiInputter extends GuiContainer{ public class SmallerButton extends GuiButton{ - private final ResourceLocation resLoc = Util.getGuiLocation("guiInputter"); + private final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); public SmallerButton(int id, int x, int y, String display){ super(id, x, y, 16, 16, display); diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index 4f9b98407..f03124c42 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.items; import ellpeck.actuallyadditions.items.tools.*; import ellpeck.actuallyadditions.material.InitItemMaterials; +import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -18,6 +19,8 @@ public class InitItems{ public static Item itemCrafterOnAStick; public static Item itemDust; public static Item itemSpecialDrop; + public static Item itemLeafBlower; + public static Item itemLeafBlowerAdvanced; public static Item itemPickaxeEmerald; public static Item itemAxeEmerald; @@ -35,39 +38,45 @@ public class InitItems{ Util.logInfo("Initializing Items..."); itemFertilizer = new ItemFertilizer(); - Util.register(itemFertilizer); + ItemUtil.register(itemFertilizer); itemMisc = new ItemMisc(); - Util.register(itemMisc); + ItemUtil.register(itemMisc); itemFoods = new ItemFoods(); - Util.register(itemFoods); + ItemUtil.register(itemFoods); itemKnife = new ItemKnife(); - Util.register(itemKnife); + ItemUtil.register(itemKnife); itemCrafterOnAStick = new ItemCrafterOnAStick(); - Util.register(itemCrafterOnAStick); + ItemUtil.register(itemCrafterOnAStick); itemDust = new ItemDust(); - Util.register(itemDust); + ItemUtil.register(itemDust); itemSpecialDrop = new ItemSpecialDrop(); - Util.register(itemSpecialDrop); + ItemUtil.register(itemSpecialDrop); + + itemLeafBlower = new ItemLeafBlower(false); + ItemUtil.register(itemLeafBlower); + + itemLeafBlowerAdvanced = new ItemLeafBlower(true); + ItemUtil.register(itemLeafBlowerAdvanced); 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); itemSwordEmerald = new ItemSwordAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemSwordEmerald", EnumRarity.rare); itemHoeEmerald = new ItemHoeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemHoeEmerald", EnumRarity.rare); - Util.registerItems(new Item[]{itemPickaxeEmerald, itemAxeEmerald, itemShovelEmerald, itemSwordEmerald, itemHoeEmerald}); + ItemUtil.registerItems(new Item[]{itemPickaxeEmerald, itemAxeEmerald, itemShovelEmerald, itemSwordEmerald, itemHoeEmerald}); itemPickaxeObsidian = new ItemPickaxeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemPickaxeObsidian", EnumRarity.uncommon); itemAxeObsidian = new ItemAxeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemAxeObsidian", EnumRarity.uncommon); itemShovelObsidian = new ItemShovelAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemShovelObsidian", EnumRarity.uncommon); itemSwordObsidian = new ItemSwordAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemSwordObsidian", EnumRarity.uncommon); itemHoeObsidian = new ItemHoeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemHoeObsidian", EnumRarity.uncommon); - Util.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian}); + ItemUtil.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian}); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java index ca38f5c13..cb7f05fe9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java @@ -5,7 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +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; @@ -26,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(Util.addStandardInformation(this)); + list.add(ItemUtil.addStandardInformation(this)); } @Override @@ -37,7 +38,7 @@ public class ItemCrafterOnAStick extends Item implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java index fd59ecfa1..35fcc18df 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java @@ -4,7 +4,9 @@ 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.Util; +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.player.EntityPlayer; @@ -56,8 +58,8 @@ public class ItemDust extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allDusts[stack.getItemDamage()].getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allDusts[stack.getItemDamage()].getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -74,6 +76,6 @@ public class ItemDust extends Item implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java index 295349c87..72b8391cb 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java @@ -3,7 +3,8 @@ 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.Util; +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; @@ -35,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(Util.addStandardInformation(this)); + list.add(ItemUtil.addStandardInformation(this)); } @Override @@ -46,7 +47,7 @@ public class ItemFertilizer extends Item implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java index ecbd8b636..55b547ec7 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java @@ -4,7 +4,9 @@ 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.Util; +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; @@ -92,12 +94,12 @@ public class ItemFoods extends ItemFood implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allFoods[stack.getItemDamage()].getName() + ".desc")); - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".hunger.desc") + ": " + allFoods[stack.getItemDamage()].healAmount); - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allFoods[stack.getItemDamage()].getName() + ".desc")); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".hunger.desc") + ": " + allFoods[stack.getItemDamage()].healAmount); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation); } - else list.add(Util.shiftForInfo()); + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -109,7 +111,7 @@ public class ItemFoods extends ItemFood implements IName{ @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allFoods[i].getName()); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + allFoods[i].getName()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java index 3671b01c6..c0eac80dd 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java @@ -4,13 +4,16 @@ 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.util.Util; +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.entity.player.EntityPlayer; 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; @@ -44,7 +47,12 @@ public class ItemKnife extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(Util.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 @@ -60,7 +68,7 @@ public class ItemKnife extends Item implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java new file mode 100644 index 000000000..043673120 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -0,0 +1,136 @@ +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.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +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 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; + + private final boolean isAdvanced; + + public ItemLeafBlower(boolean isAdvanced){ + this.isAdvanced = isAdvanced; + this.setMaxStackSize(1); + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int time){ + if(!player.worldObj.isRemote){ + if(time <= getMaxItemUseDuration(stack) && time % 2 == 0){ + this.breakStuff(player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ); + if(this.hasSound) player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); + } + } + } + + public void breakStuff(World world, int x, int y, int z){ + ArrayList theCoords = new ArrayList(); + + 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)); + } + } + } + } + + 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; + } + + @Override + public EnumAction getItemUseAction(ItemStack stack){ + return EnumAction.none; + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + return stack; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return this.isAdvanced ? EnumRarity.epic : EnumRarity.rare; + } + + @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(StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemLeafBlower.desc.2")); + list.add(StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemLeafBlower.desc.3")); + } + else list.add(ItemUtil.shiftForInfo()); + } + + @Override + public boolean getShareTag(){ + return true; + } + + @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.isAdvanced ? "itemLeafBlowerAdvanced" : "itemLeafBlower"; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java index 85582a90f..733f77a18 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java @@ -4,7 +4,9 @@ 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.Util; +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.player.EntityPlayer; @@ -57,8 +59,8 @@ public class ItemMisc extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allMiscItems[stack.getItemDamage()].getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allMiscItems[stack.getItemDamage()].getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -70,7 +72,7 @@ public class ItemMisc extends Item implements IName{ @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allMiscItems[i].getName()); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + allMiscItems[i].getName()); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java index 18749da0c..1a9d7ca0d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -4,7 +4,9 @@ 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.Util; +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.player.EntityPlayer; @@ -57,8 +59,8 @@ public class ItemSpecialDrop extends Item implements IName{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allDrops[stack.getItemDamage()].getName() + ".desc")); - else list.add(Util.shiftForInfo()); + if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allDrops[stack.getItemDamage()].getName() + ".desc")); + else list.add(ItemUtil.shiftForInfo()); } @Override @@ -70,7 +72,7 @@ public class ItemSpecialDrop extends Item implements IName{ @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allDrops[i].getName()); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + allDrops[i].getName()); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java index 9a87b5d71..05ade3244 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java @@ -1,7 +1,7 @@ package ellpeck.actuallyadditions.items.metalists; import ellpeck.actuallyadditions.util.IName; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.item.EnumRarity; public enum TheDusts implements IName{ @@ -11,7 +11,7 @@ public enum TheDusts implements IName{ DIAMOND("Diamond", 292003, EnumRarity.rare), EMERALD("Emerald", 4319527, EnumRarity.epic), LAPIS("Lapis", 1849791, EnumRarity.uncommon), - QUARTZ("Quartz", Util.DECIMAL_COLOR_WHITE, EnumRarity.uncommon), + QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon), COAL("Coal", 0, EnumRarity.uncommon), QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare); diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java index d78dbbb19..ee667e412 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java @@ -13,12 +13,12 @@ public enum TheFoods implements IName{ CARROT_JUICE("CarrotJuice", 6, 0.2F, true, 20, EnumRarity.common), FISH_N_CHIPS("FishNChips", 20, 1F, false, 40, EnumRarity.uncommon), FRENCH_FRIES("FrenchFries", 16, 0.7F, false, 32, EnumRarity.common), - FRENCH_FRY("FrenchFry", 1, 0.01F, false, 3, EnumRarity.common), + FRENCH_FRY("FrenchFry", 3, 0.01F, false, 3, EnumRarity.common), SPAGHETTI("Spaghetti", 18, 0.8F, false, 38, EnumRarity.common), NOODLE("Noodle", 1, 0.01F, false, 3, EnumRarity.common), CHOCOLATE_CAKE("ChocolateCake", 16, 0.45F, false, 45, EnumRarity.uncommon), CHOCOLATE("Chocolate", 5, 0.05F, false, 15, EnumRarity.common), - TOAST("Toast", 7, 0.4F, false, 25, EnumRarity.common), + TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common), SUBMARINE_SANDWICH("SubmarineSandwich", 10, 0.7F, false, 40, EnumRarity.uncommon), BIG_COOKIE("BigCookie", 6, 0.1F, false, 20, EnumRarity.uncommon), HAMBURGER("Hamburger", 14, 0.9F, false, 40, EnumRarity.common), diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java index 8faa77f34..f2717f35d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheSpecialDrops.java @@ -10,10 +10,10 @@ import net.minecraft.item.EnumRarity; public enum TheSpecialDrops implements IName{ - SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 70, 3, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableExperienceDrop), - BLOOD_FRAGMENT("BloodFragment", 30, 1, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableBloodDrop), - HEART_PART("HeartPart", 10, 1, EntityCreature.class, EnumRarity.rare, ConfigValues.enableHeartDrop), - UNKNOWN_SUBSTANCE("UnknownSubstance", 5, 1, EntitySkeleton.class, EnumRarity.epic, ConfigValues.enableSubstanceDrop), + 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", 20, 3, EntityEnderman.class, EnumRarity.epic, ConfigValues.enablePearlShardDrop), EMERALD_SHARD("EmeraldShard", 15, 1, EntityCreeper.class, EnumRarity.rare, ConfigValues.enableEmeraldShardDrop); @@ -24,7 +24,7 @@ public enum TheSpecialDrops implements IName{ public final boolean canDrop; public final EnumRarity rarity; - private 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){ this.name = name; this.chance = chance; this.rarity = rarity; diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java index 723d3bb78..9c503b8e4 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java @@ -3,7 +3,9 @@ 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.Util; +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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,16 +27,15 @@ public class ItemAxeAA extends ItemAxe implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; - this.setUnlocalizedName(Util.setUnlocalizedName(this)); } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(Util.addStandardInformation(this)); - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); + list.add(ItemUtil.addStandardInformation(this)); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } } @@ -51,7 +52,7 @@ public class ItemAxeAA extends ItemAxe implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java index e49b6719c..64c6c2698 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java @@ -3,7 +3,9 @@ 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.Util; +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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,16 +27,15 @@ public class ItemHoeAA extends ItemHoe implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; - this.setUnlocalizedName(Util.setUnlocalizedName(this)); } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - list.add(Util.addStandardInformation(this)); - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); + list.add(ItemUtil.addStandardInformation(this)); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } } @@ -56,7 +57,7 @@ public class ItemHoeAA extends ItemHoe implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java index 899db2e77..127c5bd59 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java @@ -3,7 +3,9 @@ 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.Util; +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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,16 +27,15 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; - this.setUnlocalizedName(Util.setUnlocalizedName(this)); } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(Util.addStandardInformation(this)); - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); + list.add(ItemUtil.addStandardInformation(this)); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } } @@ -56,7 +57,7 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java index e5baf54dc..76695c63c 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java @@ -3,7 +3,9 @@ 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.Util; +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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,16 +27,15 @@ public class ItemShovelAA extends ItemSpade implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; - this.setUnlocalizedName(Util.setUnlocalizedName(this)); } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - list.add(Util.addStandardInformation(this)); - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); + list.add(ItemUtil.addStandardInformation(this)); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } } @@ -56,7 +57,7 @@ public class ItemShovelAA extends ItemSpade implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java index 5def8bdd2..aa791ae42 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java @@ -3,7 +3,9 @@ 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.Util; +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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,16 +27,15 @@ public class ItemSwordAA extends ItemSword implements IName{ this.name = unlocalizedName; this.rarity = rarity; this.repairItem = repairItem; - this.setUnlocalizedName(Util.setUnlocalizedName(this)); } @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - list.add(Util.addStandardInformation(this)); - if(Util.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); + list.add(ItemUtil.addStandardInformation(this)); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } } @@ -56,7 +57,7 @@ public class ItemSwordAA extends ItemSword implements IName{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java index 1ad55b481..f136a8a9a 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java @@ -3,14 +3,14 @@ package ellpeck.actuallyadditions.network; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; -import ellpeck.actuallyadditions.util.Util; +import ellpeck.actuallyadditions.util.ModUtil; public class PacketHandler{ public static SimpleNetworkWrapper theNetwork; public static void init(){ - theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(Util.MOD_ID_LOWER); + theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(ModUtil.MOD_ID_LOWER); theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT); theNetwork.registerMessage(PacketInputterButton.Handler.class, PacketInputterButton.class, 1, Side.SERVER); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 8e1e356a0..d60125a48 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -1,6 +1,7 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; @@ -28,12 +29,12 @@ public class TileEntityBase extends TileEntity{ public static void init(){ Util.logInfo("Registering TileEntities..."); - GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID_LOWER + ":tileEntityCompost"); - GameRegistry.registerTileEntity(TileEntityFeeder.class, Util.MOD_ID_LOWER + ":tileEntityFeeder"); - GameRegistry.registerTileEntity(TileEntityGiantChest.class, Util.MOD_ID_LOWER + ":tileEntityGiantChest"); - GameRegistry.registerTileEntity(TileEntityGrinder.class, Util.MOD_ID_LOWER + ":tileEntityGrinder"); - GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, Util.MOD_ID_LOWER + ":tileEntityFurnaceDouble"); - GameRegistry.registerTileEntity(TileEntityInputter.class, Util.MOD_ID_LOWER + ":tileEntityInputter"); + GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER + ":tileEntityCompost"); + GameRegistry.registerTileEntity(TileEntityFeeder.class, ModUtil.MOD_ID_LOWER + ":tileEntityFeeder"); + GameRegistry.registerTileEntity(TileEntityGiantChest.class, ModUtil.MOD_ID_LOWER + ":tileEntityGiantChest"); + GameRegistry.registerTileEntity(TileEntityGrinder.class, ModUtil.MOD_ID_LOWER + ":tileEntityGrinder"); + GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceDouble"); + GameRegistry.registerTileEntity(TileEntityInputter.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputter"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 45f7e2e7f..b09a17857 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -1,6 +1,7 @@ package ellpeck.actuallyadditions.tile; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -37,38 +38,53 @@ public class TileEntityInputter extends TileEntityInventoryBase{ if(this.placeToPullSlotAmount > 0){ IInventory theInventory = (IInventory)placeToPull; int theSlotToPull = this.slotToPull; + int maxSize = theInventory.getInventoryStackLimit(); + ISidedInventory theSided = null; + if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; ItemStack theStack = null; - if(theSlotToPull != -1) theStack = theInventory.getStackInSlot(theSlotToPull); - else{ - for(int i = 0; i < this.placeToPullSlotAmount; i++){ - ItemStack tempStack = theInventory.getStackInSlot(i); - if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < this.getInventoryStackLimit()))){ + for(int i = (theSlotToPull != -1 ? theSlotToPull : 0); i < (theSlotToPull != -1 ? theSlotToPull+1 : placeToPullSlotAmount); i++){ + ItemStack tempStack = theInventory.getStackInSlot(i); + if(tempStack != null){ + 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(theSided != null){ + for(int j = 0; j < 5; j++){ + if(theSided.canExtractItem(i, tempStack, j)){ + theStack = tempStack; + theSlotToPull = i; + break; + } + } + } + else{ theStack = tempStack; theSlotToPull = i; break; } } } - if(theSlotToPull != -1 && theStack != null){ + if(theStack != null){ if(this.slots[0] != null){ if(theStack.isItemEqual(this.slots[0])){ - if(theStack.stackSize <= this.getInventoryStackLimit() - this.slots[0].stackSize){ + if(theStack.stackSize <= maxSize - this.slots[0].stackSize){ this.slots[0].stackSize += theStack.stackSize; theInventory.setInventorySlotContents(theSlotToPull, null); } - else if(theStack.stackSize > this.getInventoryStackLimit() - this.slots[0].stackSize){ - theStack.stackSize -= (this.getInventoryStackLimit() - this.slots[0].stackSize); - this.slots[0].stackSize = this.getInventoryStackLimit(); + else if(theStack.stackSize > maxSize - this.slots[0].stackSize){ + theInventory.decrStackSize(theSlotToPull, maxSize - this.slots[0].stackSize); + this.slots[0].stackSize = maxSize; } } } else{ ItemStack toBePut = theStack.copy(); - if(theInventory.getInventoryStackLimit() < toBePut.stackSize) toBePut.stackSize = theInventory.getInventoryStackLimit(); + if(maxSize < toBePut.stackSize) toBePut.stackSize = maxSize; this.setInventorySlotContents(0, toBePut); if(theStack.stackSize == toBePut.stackSize) theInventory.setInventorySlotContents(theSlotToPull, null); - else theStack.stackSize -= toBePut.stackSize; + else theInventory.decrStackSize(theSlotToPull, toBePut.stackSize); } } } @@ -78,39 +94,57 @@ public class TileEntityInputter extends TileEntityInventoryBase{ if(this.placeToPutSlotAmount > 0){ IInventory theInventory = (IInventory)placeToPut; int theSlotToPut = this.slotToPut; + int maxSize = theInventory.getInventoryStackLimit(); + ISidedInventory theSided = null; + if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; + boolean can = false; if(this.slots[0] != null){ ItemStack theStack = null; - if(theSlotToPut != -1) theStack = theInventory.getStackInSlot(theSlotToPut); - else{ - for(int i = 0; i < this.placeToPutSlotAmount; i++){ - ItemStack tempStack = theInventory.getStackInSlot(i); - if(tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < theInventory.getInventoryStackLimit())){ + for(int i = (theSlotToPut != -1 ? theSlotToPut : 0); i < (theSlotToPut != -1 ? theSlotToPut+1 : placeToPutSlotAmount); i++){ + ItemStack tempStack = theInventory.getStackInSlot(i); + if(tempStack != null){ + 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(theSided != null){ + for(int j = 0; j < 5; j++){ + if(theSided.canInsertItem(i, this.slots[0], j)){ + theStack = tempStack; + theSlotToPut = i; + can = true; + break; + } + } + } + else{ theStack = tempStack; theSlotToPut = i; + can = true; break; } } } - if(theSlotToPut != -1 && theInventory.isItemValidForSlot(theSlotToPut, this.slots[0])){ + if(can){ if(theStack != null){ if(theStack.isItemEqual(this.slots[0])){ - if(this.slots[0].stackSize <= theInventory.getInventoryStackLimit() - theStack.stackSize){ + if(this.slots[0].stackSize <= maxSize - theStack.stackSize){ theStack.stackSize += this.slots[0].stackSize; this.slots[0] = null; } - else if(this.slots[0].stackSize > theInventory.getInventoryStackLimit() - theStack.stackSize){ - this.slots[0].stackSize -= (theInventory.getInventoryStackLimit() - theStack.stackSize); - theStack.stackSize = theInventory.getInventoryStackLimit(); + else if(this.slots[0].stackSize > maxSize - theStack.stackSize){ + this.decrStackSize(0, maxSize - theStack.stackSize); + theStack.stackSize = maxSize; } } } else{ ItemStack toBePut = this.slots[0].copy(); - if(theInventory.getInventoryStackLimit() < toBePut.stackSize) toBePut.stackSize = theInventory.getInventoryStackLimit(); + if(maxSize < toBePut.stackSize) toBePut.stackSize = maxSize; theInventory.setInventorySlotContents(theSlotToPut, toBePut); if(this.slots[0].stackSize == toBePut.stackSize) this.slots[0] = null; - else this.slots[0].stackSize -= toBePut.stackSize; + else this.decrStackSize(0, toBePut.stackSize); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java new file mode 100644 index 000000000..087034e24 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java @@ -0,0 +1,13 @@ +package ellpeck.actuallyadditions.util; + +import net.minecraft.util.ResourceLocation; + +public class AssetUtil{ + + public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory"); + + public static ResourceLocation getGuiLocation(String file){ + return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/" + file + ".png"); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java new file mode 100644 index 000000000..cc4d59a5c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java @@ -0,0 +1,20 @@ +package ellpeck.actuallyadditions.util; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public class BlockUtil{ + + public static String createUnlocalizedName(Block block){ + return ModUtil.MOD_ID_LOWER + "." + ((IName)block).getName(); + } + + public static void register(Block block, Class itemBlock){ + block.setCreativeTab(CreativeTab.instance); + block.setBlockName(createUnlocalizedName(block)); + GameRegistry.registerBlock(block, itemBlock, ((IName)block).getName()); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/IName.java b/src/main/java/ellpeck/actuallyadditions/util/IName.java index 3800cce34..51a235199 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/IName.java +++ b/src/main/java/ellpeck/actuallyadditions/util/IName.java @@ -2,6 +2,6 @@ package ellpeck.actuallyadditions.util; public interface IName{ - public abstract String getName(); + String getName(); } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java new file mode 100644 index 000000000..ea10fd3aa --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -0,0 +1,35 @@ +package ellpeck.actuallyadditions.util; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import net.minecraft.item.Item; +import net.minecraft.util.StatCollector; + +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(); + } + + public static void registerItems(Item[] items){ + for(Item item : items){ + register(item); + } + } + + public static void register(Item item){ + item.setCreativeTab(CreativeTab.instance); + item.setUnlocalizedName(createUnlocalizedName(item)); + GameRegistry.registerItem(item, ((IName)item).getName()); + } + + public static String createUnlocalizedName(Item item){ + return ModUtil.MOD_ID_LOWER + "." + ((IName)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/KeyUtil.java b/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java new file mode 100644 index 000000000..7db820f5f --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java @@ -0,0 +1,15 @@ +package ellpeck.actuallyadditions.util; + +import org.lwjgl.input.Keyboard; + +public class KeyUtil{ + + public static boolean isShiftPressed(){ + return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + } + + public static boolean isControlPressed(){ + return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java new file mode 100644 index 000000000..74892fe40 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -0,0 +1,16 @@ +package ellpeck.actuallyadditions.util; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ModUtil{ + + public static final String VERSION = "1.7.10-0.0.2.3"; + + public static final String MOD_ID = "ActuallyAdditions"; + public static final String NAME = "Actually Additions"; + public static final String MOD_ID_LOWER = MOD_ID.toLowerCase(); + + public static final Logger AA_LOGGER = LogManager.getLogger(MOD_ID); + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java new file mode 100644 index 000000000..968cda7c5 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java @@ -0,0 +1,31 @@ +package ellpeck.actuallyadditions.util; + +public class StringUtil{ + + public static final String BLACK = (char)167 + "0"; + public static final String BLUE = (char)167 + "1"; + public static final String GREEN = (char)167 + "2"; + public static final String TEAL = (char)167 + "3"; + public static final String RED = (char)167 + "4"; + public static final String PURPLE = (char)167 + "5"; + public static final String ORANGE = (char)167 + "6"; + public static final String LIGHT_GRAY = (char)167 + "7"; + public static final String GRAY = (char)167 + "8"; + public static final String LIGHT_BLUE = (char)167 + "9"; + public static final String BRIGHT_GREEN = (char)167 + "a"; + public static final String BRIGHT_BLUE = (char)167 + "b"; + public static final String LIGHT_RED = (char)167 + "c"; + public static final String PINK = (char)167 + "d"; + public static final String YELLOW = (char)167 + "e"; + public static final String WHITE = (char)167 + "f"; + public static final String BOLD = (char)167 + "l"; + public static final String UNDERLINE = (char)167 + "n"; + public static final String ITALIC = (char)167 + "o"; + public static final String OBFUSCATED = (char)167 + "k"; + public static final String RESET = (char)167 + "r"; + + 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; + +} diff --git a/src/main/java/ellpeck/actuallyadditions/util/Util.java b/src/main/java/ellpeck/actuallyadditions/util/Util.java index 92fab8d98..80f06406d 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/Util.java +++ b/src/main/java/ellpeck/actuallyadditions/util/Util.java @@ -1,109 +1,17 @@ package ellpeck.actuallyadditions.util; import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.creative.CreativeTab; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.OreDictionary; import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Keyboard; @SuppressWarnings("unused") public class Util{ - public static final String VERSION = "1.7.10-0.0.2.1"; - - public static final String MOD_ID = "ActuallyAdditions"; - public static final String NAME = "Actually Additions"; - public static final String MOD_ID_LOWER = MOD_ID.toLowerCase(); - - public static final Logger AA_LOGGER = LogManager.getLogger(MOD_ID); - public static final int WILDCARD = OreDictionary.WILDCARD_VALUE; - public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory"); - - public static final String BLACK = (char)167 + "0"; - public static final String BLUE = (char)167 + "1"; - public static final String GREEN = (char)167 + "2"; - public static final String TEAL = (char)167 + "3"; - public static final String RED = (char)167 + "4"; - public static final String PURPLE = (char)167 + "5"; - public static final String ORANGE = (char)167 + "6"; - public static final String LIGHT_GRAY = (char)167 + "7"; - public static final String GRAY = (char)167 + "8"; - public static final String LIGHT_BLUE = (char)167 + "9"; - public static final String BRIGHT_GREEN = (char)167 + "a"; - public static final String BRIGHT_BLUE = (char)167 + "b"; - public static final String LIGHT_RED = (char)167 + "c"; - public static final String PINK = (char)167 + "d"; - public static final String YELLOW = (char)167 + "e"; - public static final String WHITE = (char)167 + "f"; - public static final String BOLD = (char)167 + "l"; - public static final String UNDERLINE = (char)167 + "n"; - public static final String ITALIC = (char)167 + "o"; - public static final String OBFUSCATED = (char)167 + "k"; - public static final String RESET = (char)167 + "r"; - - 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 boolean isShiftPressed(){ - return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - } - - public static boolean isControlPressed(){ - return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); - } - - public static String shiftForInfo(){ - return GREEN + ITALIC + StatCollector.translateToLocal("tooltip." + MOD_ID_LOWER + ".shiftForInfo.desc"); - } - - public static String addStandardInformation(Item item){ - if(isShiftPressed()) return StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)item).getName() + ".desc"); - else return shiftForInfo(); - } public static void logInfo(String text){ - AA_LOGGER.log(Level.INFO, text); - } - - public static void registerItems(Item[] items){ - for(Item item : items){ - register(item); - } - } - - public static ResourceLocation getGuiLocation(String file){ - return new ResourceLocation(MOD_ID_LOWER, "textures/gui/" + file + ".png"); - } - - public static String setUnlocalizedName(Item item){ - return MOD_ID_LOWER + "." + ((IName)item).getName(); - } - - public static String setUnlocalizedName(Block block){ - return MOD_ID_LOWER + "." + ((IName)block).getName(); - } - - public static void register(Item item){ - item.setCreativeTab(CreativeTab.instance); - item.setUnlocalizedName(setUnlocalizedName(item)); - GameRegistry.registerItem(item, ((IName)item).getName()); - } - - public static void register(Block block, Class itemBlock){ - block.setCreativeTab(CreativeTab.instance); - block.setBlockName(setUnlocalizedName(block)); - GameRegistry.registerBlock(block, itemBlock, ((IName)block).getName()); + ModUtil.AA_LOGGER.log(Level.INFO, text); } public static void registerEvent(Object o){ diff --git a/src/main/resources/assets/actuallyadditions/lang/de_DE.lang b/src/main/resources/assets/actuallyadditions/lang/de_DE.lang index b5f3d6dba..be597fa95 100644 --- a/src/main/resources/assets/actuallyadditions/lang/de_DE.lang +++ b/src/main/resources/assets/actuallyadditions/lang/de_DE.lang @@ -20,7 +20,7 @@ item.actuallyadditions.itemMiscKnifeBlade.name=Messerklinge item.actuallyadditions.itemMiscKnifeHandle.name=Messergriff item.actuallyadditions.itemMiscBlackQuartz.name=Schwarzquartz -item.actuallyadditions.itemKnife.name=Messee +item.actuallyadditions.itemKnife.name=Messer item.actuallyadditions.itemPickaxeEmerald.name=Smaragdspitzhacke item.actuallyadditions.itemAxeEmerald.name=Smaragdaxt item.actuallyadditions.itemShovelEmerald.name=Smaragdspaten @@ -87,7 +87,7 @@ tooltip.actuallyadditions.blockGrinderDouble.desc.1=Macht Staub aus Erzen! tooltip.actuallyadditions.blockGrinderDouble.desc.2=Aus 1 mach 2 und BONI!! tooltip.actuallyadditions.blockGrinderDouble.desc.3=Kann zwei Sachen gleichzeitig verarbeiten! tooltip.actuallyadditions.blockInputter.desc.1=Ich bin eine Biene! -tooltip.actuallyadditions.blockInputter.desc.2=%s%sIch bin klüger als ein Hopper. +tooltip.actuallyadditions.blockInputter.desc.2=Ich bin klüger als ein Hopper. tooltip.actuallyadditions.blockInputter.desc.3=Stell mich ein: tooltip.actuallyadditions.blockInputter.desc.4=-Ein-/Ausgabeseite und tooltip.actuallyadditions.blockInputter.desc.5=-Slots, die verwendet werden sollen. diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 4fef29b52..bcb91d1a3 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -35,6 +35,8 @@ item.actuallyadditions.itemMiscKnifeBlade.name=Knife Blade item.actuallyadditions.itemMiscKnifeHandle.name=Knife Handle item.actuallyadditions.itemMiscBlackQuartz.name=Black Quartz +item.actuallyadditions.itemLeafBlower.name=Leaf Blower +item.actuallyadditions.itemLeafBlowerAdvanced.name=Advanced Leaf Blower item.actuallyadditions.itemKnife.name=Knife item.actuallyadditions.itemPickaxeEmerald.name=Emerald Pickaxe item.actuallyadditions.itemAxeEmerald.name=Emerald Axe @@ -116,6 +118,10 @@ tooltip.actuallyadditions.itemMiscKnifeBlade.desc=Sharp like a tooth! A whale's tooltip.actuallyadditions.itemMiscKnifeHandle.desc=Fits comfortably in your hand. tooltip.actuallyadditions.itemMiscBlackQuartz.desc=Used in the Quartz Enchanter! +tooltip.actuallyadditions.itemLeafBlower.desc.1=Destroys Grass and Flowers around you +tooltip.actuallyadditions.itemLeafBlowerAdvanced.desc.1=Destroys Grass, Flowers and Leaves around you +tooltip.actuallyadditions.itemLeafBlower.desc.2=The Pants once said the Game needed that, +tooltip.actuallyadditions.itemLeafBlower.desc.3=Then the Honka came, said it again. tooltip.actuallyadditions.itemKnife.desc=Cuts things! Only food though, don't think of stuff... tooltip.actuallyadditions.itemPickaxeEmerald.desc=Mines Stone. tooltip.actuallyadditions.itemAxeEmerald.desc=Mines Wood. diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b963953be..6ba8234b4 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "ActuallyAdditions", "name": "Actually Additions", "description": "A bunch of random stuff added to your Game to make it even more fun, exciting and add some more variety!", - "version": "0.0.2.1", + "version": "0.0.2.3", "mcversion": "1.7.10", "url": "https://github.com/Ellpeck/ActuallyAdditions", "updateUrl": "", From c33e11ea5a60a4f8ad2380d118c33b761fc9b825 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 29 Mar 2015 16:07:43 +0200 Subject: [PATCH 3/3] Made some Special Items work --- .../blocks/metalists/TheMiscBlocks.java | 2 +- .../crafting/ItemCrafting.java | 11 +++++++ .../actuallyadditions/items/ItemFoods.java | 1 - .../items/ItemLeafBlower.java | 5 --- .../items/ItemSpecialDrop.java | 14 ++++++++ .../items/metalists/TheDusts.java | 2 +- .../items/metalists/TheFoods.java | 32 +++++++++---------- .../items/metalists/TheMiscItems.java | 2 +- .../actuallyadditions/proxy/IProxy.java | 6 ++-- .../assets/actuallyadditions/lang/en_US.lang | 6 ++-- 10 files changed, 50 insertions(+), 31 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java index 13001ca0e..43e4e64a7 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheMiscBlocks.java @@ -13,7 +13,7 @@ public enum TheMiscBlocks implements IName{ public final String name; public final EnumRarity rarity; - private TheMiscBlocks(String name, EnumRarity rarity){ + TheMiscBlocks(String name, EnumRarity rarity){ this.name = name; this.rarity = rarity; } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 26c666b3f..176200aec 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -7,6 +7,7 @@ import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -27,6 +28,16 @@ public class ItemCrafting{ 'P', new ItemStack(Blocks.piston), 'R', new ItemStack(Items.redstone)); + //Ender Pearl + GameRegistry.addRecipe(new ItemStack(Items.ender_pearl), + "XXX", "XXX", "XXX", + 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.PEARL_SHARD.ordinal())); + + //Emerald + GameRegistry.addRecipe(new ItemStack(Items.emerald), + "XXX", "XXX", "XXX", + 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal())); + //Advanced Leaf Blower if(ConfigValues.enableLeafBlowerAdvancedRecipe) GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java index 55b547ec7..86d4f73e2 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java @@ -27,7 +27,6 @@ public class ItemFoods extends ItemFood implements IName{ super(0, 0.0F, false); this.setHasSubtypes(true); this.setMaxDamage(0); - this.setAlwaysEdible(); TheFoods.setReturnItems(); } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java index 043673120..ca9fe635b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -113,11 +113,6 @@ public class ItemLeafBlower extends Item implements IName{ else list.add(ItemUtil.shiftForInfo()); } - @Override - public boolean getShareTag(){ - return true; - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java index 1a9d7ca0d..3ee14cbe1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -9,14 +9,17 @@ 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.EntityXPOrb; 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 net.minecraft.util.StatCollector; +import net.minecraft.world.World; import java.util.List; +import java.util.Random; public class ItemSpecialDrop extends Item implements IName{ @@ -27,6 +30,17 @@ public class ItemSpecialDrop extends Item implements IName{ this.setHasSubtypes(true); } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + if(!world.isRemote){ + if(stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()){ + world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, 5+new Random().nextInt(6))); + if(!player.capabilities.isCreativeMode) stack.stackSize--; + } + } + return stack; + } + @Override public String getName(){ return "itemSpecial"; diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java index 05ade3244..140981ac1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheDusts.java @@ -19,7 +19,7 @@ public enum TheDusts implements IName{ public final int color; public final EnumRarity rarity; - private TheDusts(String name, int color, EnumRarity rarity){ + TheDusts(String name, int color, EnumRarity rarity){ this.name = name; this.color = color; this.rarity = rarity; diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java index ee667e412..39f175b28 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java @@ -8,22 +8,22 @@ import net.minecraft.item.ItemStack; public enum TheFoods implements IName{ - CHEESE("Cheese", 1, 0.1F, false, 3, EnumRarity.common), - PUMPKIN_STEW("PumpkinStew", 10, 0.4F, true, 30, EnumRarity.common), - CARROT_JUICE("CarrotJuice", 6, 0.2F, true, 20, EnumRarity.common), - FISH_N_CHIPS("FishNChips", 20, 1F, false, 40, EnumRarity.uncommon), - FRENCH_FRIES("FrenchFries", 16, 0.7F, false, 32, EnumRarity.common), - FRENCH_FRY("FrenchFry", 3, 0.01F, false, 3, EnumRarity.common), - SPAGHETTI("Spaghetti", 18, 0.8F, false, 38, EnumRarity.common), - NOODLE("Noodle", 1, 0.01F, false, 3, EnumRarity.common), - CHOCOLATE_CAKE("ChocolateCake", 16, 0.45F, false, 45, EnumRarity.uncommon), - CHOCOLATE("Chocolate", 5, 0.05F, false, 15, EnumRarity.common), + 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, 0.7F, false, 40, EnumRarity.uncommon), - BIG_COOKIE("BigCookie", 6, 0.1F, false, 20, EnumRarity.uncommon), - HAMBURGER("Hamburger", 14, 0.9F, false, 40, EnumRarity.common), - PIZZA("Pizza", 20, 1F, false, 45, EnumRarity.uncommon), - BAGUETTE("Baguette", 7, 0.2F, 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); public static void setReturnItems(){ SPAGHETTI.returnItem = new ItemStack(Items.bowl); @@ -41,7 +41,7 @@ public enum TheFoods implements IName{ public ItemStack returnItem; public final EnumRarity rarity; - private 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){ this.name = name; this.getsDrunken = getsDrunken; this.healAmount = healAmount; diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java index 76324b8da..4ba6712e8 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheMiscItems.java @@ -15,7 +15,7 @@ public enum TheMiscItems implements IName{ public final String name; public final EnumRarity rarity; - private TheMiscItems(String name, EnumRarity rarity){ + TheMiscItems(String name, EnumRarity rarity){ this.name = name; this.rarity = rarity; } diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/IProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/IProxy.java index 94d3d4c97..378d4d555 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/IProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/IProxy.java @@ -2,9 +2,9 @@ package ellpeck.actuallyadditions.proxy; public interface IProxy{ - public abstract void preInit(); + void preInit(); - public abstract void init(); + void init(); - public abstract void postInit(); + void postInit(); } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index bcb91d1a3..9529e45f3 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -153,11 +153,11 @@ tooltip.actuallyadditions.itemFoodPumpkinStew.desc=Like Mushroom Stew or Rabbit tooltip.actuallyadditions.itemFoodCheese.desc=Cheese. tooltip.actuallyadditions.itemSpecialUnknownSubstance.desc=Dropped by Skeletons. BETA INFO: Useless as of yet. -tooltip.actuallyadditions.itemSpecialSolidifiedExperience.desc=Dropped by everyone. BETA INFO: Useless as of yet. +tooltip.actuallyadditions.itemSpecialSolidifiedExperience.desc=Dropped by everyone. Right-Click to get XP. tooltip.actuallyadditions.itemSpecialBloodFragment.desc=Dropped by everyone. BETA INFO: Useless as of yet. tooltip.actuallyadditions.itemSpecialHeartPart.desc=Dropped by everyone. BETA INFO: Useless as of yet. -tooltip.actuallyadditions.itemSpecialPearlShard.desc=Dropped by Endermen. BETA INFO: Useless as of yet. -tooltip.actuallyadditions.itemSpecialEmeraldShard.desc=Dropped by Creepers. BETA INFO: Useless as of yet. +tooltip.actuallyadditions.itemSpecialPearlShard.desc=Dropped by Endermen. 3x3 Crafting to an Ender Pearl +tooltip.actuallyadditions.itemSpecialEmeraldShard.desc=Dropped by Creepers. 3x3 Crafting to an Emerald tooltip.actuallyadditions.itemDustIron.desc=Iron! Crushed in the Crusher! tooltip.actuallyadditions.itemDustGold.desc=Gold! Crushed in the Crusher!