diff --git a/build.gradle b/build.gradle index ce3772547..b3797a3db 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" minecraft { - version = "1.7.10-10.13.3.1428-1.7.10" + version = "1.7.10-10.13.4.1448-1.7.10" runDir = "idea" } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java index e46eb1296..d4379a444 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityBreaker; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -22,8 +21,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class BlockBreaker extends BlockContainerBase implements INameableItem{ private IIcon frontIcon; @@ -120,13 +117,6 @@ public class BlockBreaker extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java index 16ca12ff4..167bf6a02 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java @@ -100,7 +100,6 @@ public class BlockCanolaPress extends BlockContainerBase implements INameableIte @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); BlockUtil.addPowerUsageInfo(list, TileEntityCanolaPress.energyUsedPerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java index b57296420..030e05169 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java @@ -99,8 +99,7 @@ public class BlockCoalGenerator extends BlockContainerBase implements INameableI @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ BlockUtil.addPowerProductionInfo(list, TileEntityCoalGenerator.energyProducedPerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java index c0dcaf928..309231119 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -6,7 +6,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -22,8 +21,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import java.util.List; - public class BlockCoffeeMachine extends BlockContainerBase implements INameableItem{ public BlockCoffeeMachine(){ @@ -124,14 +121,6 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 5, ""); - BlockUtil.addPowerUsageInfo(list, TileEntityCoffeeMachine.energyUsePerTick); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index 8953a197e..9fda45de0 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -8,7 +8,6 @@ import ellpeck.actuallyadditions.items.ItemFertilizer; import ellpeck.actuallyadditions.items.ItemMisc; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.tile.TileEntityCompost; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -149,13 +148,6 @@ public class BlockCompost extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java index 7779a84eb..d4737dfdb 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityDropper; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -22,8 +21,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class BlockDropper extends BlockContainerBase implements INameableItem{ private IIcon frontIcon; @@ -117,13 +114,6 @@ public class BlockDropper extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java index e135def6d..a72632581 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFeeder; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -19,8 +18,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class BlockFeeder extends BlockContainerBase implements INameableItem{ private IIcon topIcon; @@ -96,13 +93,6 @@ public class BlockFeeder extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java index 68ab2eb43..3ac6685dc 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -19,8 +18,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class BlockFermentingBarrel extends BlockContainerBase implements INameableItem{ private IIcon iconTop; @@ -96,13 +93,6 @@ public class BlockFermentingBarrel extends BlockContainerBase implements INameab return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int meta){ return meta; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java index d6cd5edcd..37b3b7ca6 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java @@ -4,12 +4,10 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; @@ -18,8 +16,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class BlockFishingNet extends BlockContainerBase implements INameableItem{ public BlockFishingNet(){ @@ -92,13 +88,6 @@ public class BlockFishingNet extends BlockContainerBase implements INameableItem return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int meta){ return meta; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java index 5c7ec84af..5cc8ba797 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFluidCollector; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -22,8 +21,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class BlockFluidCollector extends BlockContainerBase implements INameableItem{ private IIcon frontIcon; @@ -120,13 +117,6 @@ public class BlockFluidCollector extends BlockContainerBase implements INameable return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java index c60c1f7a4..02b11aff4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java @@ -2,13 +2,11 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -18,8 +16,6 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -import java.util.List; - public class BlockFluidFlowing extends BlockFluidClassic implements INameableItem{ private String name; @@ -88,13 +84,6 @@ public class BlockFluidFlowing extends BlockFluidClassic implements INameableIte return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index a0986d1c9..958d16555 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -22,7 +21,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; import java.util.Random; public class BlockFurnaceDouble extends BlockContainerBase implements INameableItem{ @@ -166,14 +164,6 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - BlockUtil.addPowerUsageInfo(list, TileEntityFurnaceDouble.energyUsePerTick); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java index 36949cd77..071b520e1 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java @@ -95,8 +95,7 @@ public class BlockFurnaceSolar extends BlockContainerBase implements INameableIt @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ BlockUtil.addPowerProductionInfo(list, TileEntityFurnaceSolar.energyProducedPerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java index 509dca6fe..2238fed2a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -19,8 +18,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class BlockGiantChest extends BlockContainerBase implements INameableItem{ private IIcon topIcon; @@ -98,13 +95,6 @@ public class BlockGiantChest extends BlockContainerBase implements INameableItem return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java index 60f0291cf..a2699b179 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java @@ -3,13 +3,11 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -19,8 +17,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class BlockGreenhouseGlass extends BlockContainerBase implements INameableItem{ public BlockGreenhouseGlass(){ @@ -100,13 +96,6 @@ public class BlockGreenhouseGlass extends BlockContainerBase implements INameabl return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index 1c63f53f6..0a159ad7e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -3,10 +3,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; -import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGrinder; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -21,7 +19,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; import java.util.Random; public class BlockGrinder extends BlockContainerBase implements INameableItem{ @@ -130,14 +127,6 @@ public class BlockGrinder extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, ((BlockGrinder)theBlock).isDouble ? 3 : 4, ""); - BlockUtil.addPowerUsageInfo(list, ((BlockGrinder)theBlock).isDouble ? ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue() : ConfigIntValues.GRINDER_ENERGY_USED.getValue()); - } - @Override public int getMetadata(int meta){ return meta; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java index c026c01dd..2b5cf366a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java @@ -83,8 +83,7 @@ public class BlockHeatCollector extends BlockContainerBase implements INameableI @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 3, ""); + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ BlockUtil.addPowerProductionInfo(list, TileEntityHeatCollector.energyProducedPerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 5f9495cde..5030fe972 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -5,7 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityInputter; -import ellpeck.actuallyadditions.util.*; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,7 +19,6 @@ 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 BlockInputter extends BlockContainerBase implements INameableItem{ @@ -115,20 +115,6 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{ return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY)); - for(int i = 1; i < 6; i++){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + (i + 1))); - } - if((((BlockInputter)theBlock).isAdvanced)) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)theBlock).getName() + ".desc")); - } - else list.add(ItemUtil.shiftForInfo()); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 10be6b9a1..81db9ff99 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -121,7 +121,6 @@ public class BlockItemRepairer extends BlockContainerBase implements INameableIt @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); BlockUtil.addPowerUsageInfo(list, TileEntityItemRepairer.energyUsePerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java index 782eb30f2..55fde2db3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java @@ -3,9 +3,7 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityLavaFactoryController; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -20,8 +18,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - public class BlockLavaFactoryController extends BlockContainerBase implements INameableItem{ private IIcon topIcon; @@ -100,16 +96,6 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IN return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 3, ""); - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".uses.desc") + " " + TileEntityLavaFactoryController.energyNeededToProduceLava + " RF/B"); - } - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java index 513a52bcc..5fa59a537 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java @@ -3,14 +3,12 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -87,13 +85,6 @@ public class BlockMisc extends Block implements INameableItem{ return this.getUnlocalizedName() + (stack.getItemDamage() >= allMiscBlocks.length ? " ERROR!" : allMiscBlocks[stack.getItemDamage()].getName()); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName()); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java index 28e8d6568..3af1ded7e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java @@ -99,8 +99,7 @@ public class BlockOilGenerator extends BlockContainerBase implements INameableIt @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ BlockUtil.addPowerProductionInfo(list, TileEntityOilGenerator.energyProducedPerTick); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java index 268276d99..ae6835f3c 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java @@ -4,12 +4,10 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityPhantomBooster; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; @@ -18,8 +16,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class BlockPhantomBooster extends BlockContainerBase implements INameableItem{ public BlockPhantomBooster(){ @@ -94,13 +90,6 @@ public class BlockPhantomBooster extends BlockContainerBase implements INameable return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 2, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java index 06b5c994f..148a9a573 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java @@ -7,7 +7,8 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer; import ellpeck.actuallyadditions.tile.TileEntityPhantomface; -import ellpeck.actuallyadditions.util.*; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -155,15 +156,8 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 2, ""); - if(KeyUtil.isShiftPressed()){ - if(((BlockPhantomface)this.theBlock).type == LIQUIFACE){ - list.add(StringUtil.ORANGE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.3")); - list.add(StringUtil.ORANGE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.4")); - } - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + ((BlockPhantomface)theBlock).range); - } + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + ((BlockPhantomface)theBlock).range); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java index f9298b9ac..ea2402abb 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java @@ -3,13 +3,11 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.ItemSeed; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; 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.ItemBlock; @@ -133,13 +131,6 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar return this.getUnlocalizedName(); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); - } - @Override public int getMetadata(int damage){ return damage; diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index d601fa893..9a718cc65 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -26,88 +26,89 @@ public class CreativeTab extends CreativeTabs{ public void displayAllReleventItems(List list){ this.list = list; - this.addBlock(InitBlocks.blockPhantomface); - this.addBlock(InitBlocks.blockPhantomEnergyface); - this.addBlock(InitBlocks.blockPhantomLiquiface); - this.addBlock(InitBlocks.blockPhantomPlacer); - this.addBlock(InitBlocks.blockPhantomBreaker); - this.addBlock(InitBlocks.blockPhantomBooster); - this.addBlock(InitBlocks.blockCoffeeMachine); - this.addBlock(InitBlocks.blockInputter); - this.addBlock(InitBlocks.blockInputterAdvanced); + addBlock(InitBlocks.blockPhantomface); + addBlock(InitBlocks.blockPhantomEnergyface); + addBlock(InitBlocks.blockPhantomLiquiface); + addBlock(InitBlocks.blockPhantomPlacer); + addBlock(InitBlocks.blockPhantomBreaker); + addBlock(InitBlocks.blockPhantomBooster); + addBlock(InitBlocks.blockCoffeeMachine); + addBlock(InitBlocks.blockInputter); + addBlock(InitBlocks.blockInputterAdvanced); - this.addBlock(InitBlocks.blockGreenhouseGlass); - this.addBlock(InitBlocks.blockGrinder); - this.addBlock(InitBlocks.blockGrinderDouble); - this.addBlock(InitBlocks.blockFurnaceDouble); - this.addBlock(InitBlocks.blockLavaFactoryController); + addBlock(InitBlocks.blockGreenhouseGlass); + addBlock(InitBlocks.blockGrinder); + addBlock(InitBlocks.blockGrinderDouble); + addBlock(InitBlocks.blockFurnaceDouble); + addBlock(InitBlocks.blockLavaFactoryController); - this.addBlock(InitBlocks.blockFurnaceSolar); - this.addBlock(InitBlocks.blockHeatCollector); - this.addBlock(InitBlocks.blockCoalGenerator); - this.addBlock(InitBlocks.blockOilGenerator); - this.addBlock(InitBlocks.blockItemRepairer); - this.addBlock(InitBlocks.blockFishingNet); - this.addBlock(InitBlocks.blockBreaker); - this.addBlock(InitBlocks.blockPlacer); - this.addBlock(InitBlocks.blockDropper); - this.addBlock(InitBlocks.blockFluidPlacer); - this.addBlock(InitBlocks.blockFluidCollector); + addBlock(InitBlocks.blockFurnaceSolar); + addBlock(InitBlocks.blockHeatCollector); + addBlock(InitBlocks.blockCoalGenerator); + addBlock(InitBlocks.blockOilGenerator); + addBlock(InitBlocks.blockItemRepairer); + addBlock(InitBlocks.blockFishingNet); + addBlock(InitBlocks.blockBreaker); + addBlock(InitBlocks.blockPlacer); + addBlock(InitBlocks.blockDropper); + addBlock(InitBlocks.blockFluidPlacer); + addBlock(InitBlocks.blockFluidCollector); - this.addBlock(InitBlocks.blockMisc); - this.addBlock(InitBlocks.blockFeeder); - this.addBlock(InitBlocks.blockCompost); - this.addBlock(InitBlocks.blockGiantChest); - this.addBlock(InitBlocks.blockCanolaPress); - this.addBlock(InitBlocks.blockFermentingBarrel); + addBlock(InitBlocks.blockMisc); + addBlock(InitBlocks.blockFeeder); + addBlock(InitBlocks.blockCompost); + addBlock(InitBlocks.blockGiantChest); + addBlock(InitBlocks.blockCanolaPress); + addBlock(InitBlocks.blockFermentingBarrel); - this.addItem(InitItems.itemPhantomConnector); - this.addItem(InitItems.itemBucketCanolaOil); - this.addItem(InitItems.itemBucketOil); + addItem(InitItems.itemDrill); + addItem(InitItems.itemPhantomConnector); + addItem(InitItems.itemBucketCanolaOil); + addItem(InitItems.itemBucketOil); - this.addItem(InitItems.itemCoffeeSeed); - this.addItem(InitItems.itemCoffeeBean); - this.addItem(InitItems.itemRiceSeed); - this.addItem(InitItems.itemCanolaSeed); - this.addItem(InitItems.itemFlaxSeed); - this.addItem(InitItems.itemHairyBall); - this.addItem(InitItems.itemMisc); - this.addItem(InitItems.itemResonantRice); - this.addItem(InitItems.itemFertilizer); + addItem(InitItems.itemCoffeeSeed); + addItem(InitItems.itemCoffeeBean); + addItem(InitItems.itemRiceSeed); + addItem(InitItems.itemCanolaSeed); + addItem(InitItems.itemFlaxSeed); + addItem(InitItems.itemHairyBall); + addItem(InitItems.itemMisc); + addItem(InitItems.itemResonantRice); + addItem(InitItems.itemFertilizer); - this.addItem(InitItems.itemCoffee); - this.addItem(InitItems.itemFoods); - this.addItem(InitItems.itemKnife); - this.addItem(InitItems.itemCrafterOnAStick); - this.addItem(InitItems.itemDust); - this.addItem(InitItems.itemSpecialDrop); - this.addItem(InitItems.itemLeafBlower); - this.addItem(InitItems.itemLeafBlowerAdvanced); + addItem(InitItems.itemCoffee); + addItem(InitItems.itemFoods); + addItem(InitItems.itemKnife); + addItem(InitItems.itemCrafterOnAStick); + addItem(InitItems.itemDust); + addItem(InitItems.itemSpecialDrop); + addItem(InitItems.itemLeafBlower); + addItem(InitItems.itemLeafBlowerAdvanced); - this.addItem(InitItems.woodenPaxel); - this.addItem(InitItems.stonePaxel); - this.addItem(InitItems.ironPaxel); - this.addItem(InitItems.goldPaxel); - this.addItem(InitItems.diamondPaxel); - this.addItem(InitItems.emeraldPaxel); - this.addItem(InitItems.obsidianPaxel); + addItem(InitItems.woodenPaxel); + addItem(InitItems.stonePaxel); + addItem(InitItems.ironPaxel); + addItem(InitItems.goldPaxel); + addItem(InitItems.diamondPaxel); + addItem(InitItems.emeraldPaxel); + addItem(InitItems.obsidianPaxel); - this.addItem(InitItems.itemPickaxeEmerald); - this.addItem(InitItems.itemSwordEmerald); - this.addItem(InitItems.itemAxeEmerald); - this.addItem(InitItems.itemShovelEmerald); - this.addItem(InitItems.itemHoeEmerald); + addItem(InitItems.itemPickaxeEmerald); + addItem(InitItems.itemSwordEmerald); + addItem(InitItems.itemAxeEmerald); + addItem(InitItems.itemShovelEmerald); + addItem(InitItems.itemHoeEmerald); - this.addItem(InitItems.itemPickaxeObsidian); - this.addItem(InitItems.itemSwordObsidian); - this.addItem(InitItems.itemAxeObsidian); - this.addItem(InitItems.itemShovelObsidian); - this.addItem(InitItems.itemHoeObsidian); + addItem(InitItems.itemPickaxeObsidian); + addItem(InitItems.itemSwordObsidian); + addItem(InitItems.itemAxeObsidian); + addItem(InitItems.itemShovelObsidian); + addItem(InitItems.itemHoeObsidian); - this.addItem(InitItems.itemPotionRing); - this.addItem(InitItems.itemPotionRingAdvanced); + addItem(InitItems.itemPotionRing); + addItem(InitItems.itemPotionRingAdvanced); - this.addItem(InitItems.itemJams); + addItem(InitItems.itemJams); } @Override @@ -121,10 +122,10 @@ public class CreativeTab extends CreativeTabs{ } private void addItem(Item item){ - item.getSubItems(item, this, list); + item.getSubItems(item, instance, list); } private void addBlock(Block block){ - block.getSubBlocks(new ItemStack(block).getItem(), this, list); + block.getSubBlocks(new ItemStack(block).getItem(), instance, list); } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java index 638251ebc..64d78776f 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.event; +import ellpeck.actuallyadditions.manual.InventoryEvents; import ellpeck.actuallyadditions.util.Util; public class InitEvents{ @@ -15,6 +16,8 @@ public class InitEvents{ Util.registerEvent(new EntityLivingEvent()); Util.registerEvent(new WorldDecorationEvent()); Util.registerEvent(new BucketFillEvent()); + Util.registerEvent(new InventoryEvents.InitGuiEvent()); + Util.registerEvent(new InventoryEvents.ButtonPressedEvent()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 61ce9c16c..fc898626e 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -4,6 +4,8 @@ import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.gui.*; +import ellpeck.actuallyadditions.manual.ContainerManual; +import ellpeck.actuallyadditions.manual.GuiManual; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.util.Util; import net.minecraft.entity.player.EntityPlayer; @@ -14,7 +16,7 @@ public class GuiHandler implements IGuiHandler{ @Override public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ TileEntityBase tile = null; - if(id != CRAFTER_ID){ + if(id != CRAFTER_ID && id != DRILL_ID && id != MANUAL_ID){ tile = (TileEntityBase)world.getTileEntity(x, y, z); } switch(id){ @@ -54,6 +56,8 @@ public class GuiHandler implements IGuiHandler{ return new ContainerFluidCollector(entityPlayer.inventory, tile); case COFFEE_MACHINE_ID: return new ContainerCoffeeMachine(entityPlayer.inventory, tile); + case MANUAL_ID: + return new ContainerManual(); default: return null; } @@ -62,7 +66,7 @@ public class GuiHandler implements IGuiHandler{ @Override public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ TileEntityBase tile = null; - if(id != CRAFTER_ID){ + if(id != CRAFTER_ID && id != DRILL_ID && id != MANUAL_ID){ tile = (TileEntityBase)world.getTileEntity(x, y, z); } switch(id){ @@ -102,6 +106,8 @@ public class GuiHandler implements IGuiHandler{ return new GuiFluidCollector(entityPlayer.inventory, tile); case COFFEE_MACHINE_ID: return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world); + case MANUAL_ID: + return new GuiManual(); default: return null; } @@ -125,6 +131,8 @@ public class GuiHandler implements IGuiHandler{ public static final int PHANTOM_PLACER_ID = 15; public static final int FLUID_COLLECTOR_ID = 16; public static final int COFFEE_MACHINE_ID = 17; + public static final int DRILL_ID = 18; + public static final int MANUAL_ID = 19; public static void init(){ Util.logInfo("Initializing GuiHandler..."); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java index ce76bf0e9..e5570d9c1 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java @@ -156,9 +156,9 @@ public class GuiInputter extends GuiContainer{ PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer)); } - public class SmallerButton extends GuiButton{ + public static class SmallerButton extends GuiButton{ - private final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); + public 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 d3f758f23..ead653068 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -69,9 +69,14 @@ public class InitItems{ public static Item emeraldPaxel; public static Item obsidianPaxel; + public static Item itemDrill; + public static void init(){ Util.logInfo("Initializing Items..."); + itemDrill = new ItemDrill(); + ItemUtil.register(itemDrill); + itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil"); ItemUtil.register(itemBucketOil); FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java index 6c106c564..ac429ce64 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java @@ -3,19 +3,15 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - public class ItemBucketAA extends ItemBucket implements INameableItem{ private String name; @@ -31,12 +27,6 @@ public class ItemBucketAA extends ItemBucket implements INameableItem{ return EnumRarity.uncommon; } - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 1, ""); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java index 17c36aaf2..9c9b80818 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java @@ -5,8 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -203,22 +201,17 @@ public class ItemCoffee extends ItemFood implements INameableItem{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.1")); - list.add(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.2", this.getMaxDamage()+1)); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+this.func_150905_g(stack)); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+this.func_150906_h(stack)); - list.add(""); + list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+this.func_150905_g(stack)); + list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+this.func_150906_h(stack)); + list.add(""); - PotionEffect[] effects = getEffectsFromStack(stack); - if(effects != null && effects.length > 0){ - for(PotionEffect effect : effects){ - list.add(StatCollector.translateToLocal(effect.getEffectName())+" "+(effect.getAmplifier()+1)+ " (" + Potion.getDurationString(new PotionEffect(0, effect.getDuration()*20, 0)) + ")"); - } + PotionEffect[] effects = getEffectsFromStack(stack); + if(effects != null && effects.length > 0){ + for(PotionEffect effect : effects){ + list.add(StatCollector.translateToLocal(effect.getEffectName())+" "+(effect.getAmplifier()+1)+ " (" + Potion.getDurationString(new PotionEffect(0, effect.getDuration()*20, 0)) + ")"); } - else list.add("No Effects"); } - else list.add(ItemUtil.shiftForInfo()); + else list.add("No Effects"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java index 08a55cd57..1deb06518 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java @@ -3,17 +3,13 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - public class ItemCoffeeBean extends ItemFood implements INameableItem{ public ItemCoffeeBean(){ @@ -31,13 +27,6 @@ public class ItemCoffeeBean extends ItemFood implements INameableItem{ return EnumRarity.rare; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - ItemUtil.addInformation(this, list, 1, ""); - } - @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int pass){ diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java index 04e43ba5d..ed99912d9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -15,21 +14,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class ItemCrafterOnAStick extends Item implements INameableItem{ public ItemCrafterOnAStick(){ this.setMaxStackSize(1); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 1, ""); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java new file mode 100644 index 000000000..ef7b9baae --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -0,0 +1,364 @@ +package ellpeck.actuallyadditions.items; + +import cofh.api.energy.ItemEnergyContainer; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.items.tools.ItemAllToolAA; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.KeyUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.WorldUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.IIcon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@SuppressWarnings("unchecked") +public class ItemDrill extends ItemEnergyContainer implements INameableItem{ + + private static final Set allSet = Sets.newHashSet(); + static{ + allSet.addAll(ItemAllToolAA.pickSet); + allSet.addAll(ItemAllToolAA.shovelSet); + } + + public ItemDrill(){ + super(3000000); + this.setMaxStackSize(1); + this.setHasSubtypes(true); + } + + public static float defaultEfficiency = 8.0F; + + public int energyUsePerBlockOrHit = 100; + public float efficiency = defaultEfficiency; + + @Override + public double getDurabilityForDisplay(ItemStack stack){ + double energyDif = getMaxEnergyStored(stack)-getEnergyStored(stack); + double maxAmount = getMaxEnergyStored(stack); + return energyDif/maxAmount; + } + + @Override + public boolean showDurabilityBar(ItemStack itemStack){ + return true; + } + + @Override + public void onCreated(ItemStack stack, World world, EntityPlayer player){ + this.setEnergy(stack, 0); + } + + @Override + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ + boolean hasSilkTouch = this.hasEnchantment(stack, Enchantment.silkTouch) >= 0; + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ + if(!hasSilkTouch){ + //TODO Add more Energy Use as Variable Change (Like Efficiency!) + stack.addEnchantment(Enchantment.silkTouch, 1); + } + } + else if(hasSilkTouch) this.removeEnchantment(stack, Enchantment.silkTouch); + + boolean hasFortune = this.hasEnchantment(stack, Enchantment.fortune) >= 0; + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ + if(!hasFortune){ + //TODO Add more Energy Use as Variable Change (Like Efficiency!) + stack.addEnchantment(Enchantment.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); + } + } + else if(hasFortune) this.removeEnchantment(stack, Enchantment.fortune); + } + + public void removeEnchantment(ItemStack stack, Enchantment ench){ + NBTTagList list = stack.getEnchantmentTagList(); + if(list != null){ + int hasEnchantment = this.hasEnchantment(stack, ench); + if(hasEnchantment >= 0){ + list.removeTag(hasEnchantment); + } + } + } + + public int hasEnchantment(ItemStack stack, Enchantment ench){ + NBTTagList list = stack.getEnchantmentTagList(); + if(list != null){ + for(int i = 0; i < list.tagCount(); i++){ + NBTTagCompound compound = list.getCompoundTagAt(i); + short id = compound.getShort("id"); + if(id == ench.effectId){ + return i; + } + } + } + return -1; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean hasEffect(ItemStack stack, int pass){ + return false; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.epic; + } + + public boolean getHasUpgrade(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){ + if(upgrade == ItemDrillUpgrade.UpgradeType.SILK_TOUCH) return true; + if(upgrade == ItemDrillUpgrade.UpgradeType.THREE_BY_THREE) return true; + + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) return false; + + ItemStack[] slots = this.getSlotsFromNBT(stack); + if(slots != null && slots.length > 0){ + for(ItemStack slotStack : slots){ + if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){ + if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return true; + } + } + } + return false; + } + + @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()); + } + + public void setEnergy(ItemStack stack, int energy){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) compound = new NBTTagCompound(); + compound.setInteger("Energy", energy); + stack.setTagCompound(compound); + } + + public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) compound = new NBTTagCompound(); + + if(slots != null && slots.length > 0){ + compound.setInteger("SlotAmount", slots.length); + NBTTagList tagList = new NBTTagList(); + for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){ + if(slots[currentIndex] != null){ + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte)currentIndex); + slots[currentIndex].writeToNBT(tagCompound); + tagList.appendTag(tagCompound); + } + } + compound.setTag("Items", tagList); + } + stack.setTagCompound(compound); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list){ + ItemStack stackFull = new ItemStack(this); + this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull)); + list.add(stackFull); + + ItemStack stackEmpty = new ItemStack(this); + this.setEnergy(stackEmpty, 0); + list.add(stackEmpty); + } + + public ItemStack[] getSlotsFromNBT(ItemStack stack){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) return null; + + int slotAmount = compound.getInteger("SlotAmount"); + ItemStack[] slots = new ItemStack[slotAmount]; + + if(slots.length > 0){ + NBTTagList tagList = compound.getTagList("Items", 10); + for(int i = 0; i < tagList.tagCount(); i++){ + NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); + byte slotIndex = tagCompound.getByte("Slot"); + if(slotIndex >= 0 && slotIndex < slots.length){ + slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); + } + } + } + return slots; + } + + public void breakBlocks(ItemStack stack, int radius, World world, int x, int y, int z, Entity entity){ + int xRange = radius; + int yRange = radius; + int zRange = 0; + + MovingObjectPosition pos = WorldUtil.raytraceEntity(world, entity, 4.5D); + if(pos != null){ + int side = pos.sideHit; + if(side == 0 || side == 1){ + zRange = radius; + yRange = 0; + } + if(side == 4 || side == 5){ + xRange = 0; + zRange = radius; + } + + for(int xPos = x-xRange; xPos <= x+xRange; xPos++){ + for(int yPos = y-yRange; yPos <= y+yRange; yPos++){ + for(int zPos = z-zRange; zPos <= z+zRange; zPos++){ + if(this.getEnergyStored(stack) >= this.energyUsePerBlockOrHit){ + Block block = world.getBlock(xPos, yPos, zPos); + float hardness = block.getBlockHardness(world, xPos, yPos, zPos); + if(!(xPos == x && yPos == y && zPos == z) && hardness > -1.0F && this.canHarvestBlock(block, stack)){ + this.extractEnergy(stack, this.energyUsePerBlockOrHit, false); + + ArrayList drops = new ArrayList(); + int meta = world.getBlockMetadata(xPos, yPos, zPos); + + if(block.canSilkHarvest(world, (EntityPlayer)entity, xPos, yPos, zPos, meta) && EnchantmentHelper.getSilkTouchModifier((EntityPlayer)entity)){ + drops.add(new ItemStack(block, 1, meta)); + } + else{ + drops.addAll(block.getDrops(world, xPos, yPos, zPos, meta, EnchantmentHelper.getFortuneModifier((EntityPlayer)entity))); + block.dropXpOnBlockBreak(world, x, y, z, block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier((EntityPlayer)entity))); + } + + world.playAuxSFX(2001, xPos, yPos, zPos, Block.getIdFromBlock(block)+(meta << 12)); + world.setBlockToAir(xPos, yPos, zPos); + for(ItemStack theDrop : drops){ + world.spawnEntityInWorld(new EntityItem(world, xPos+0.5, yPos+0.5, zPos+0.5, theDrop)); + } + } + } + else return; + } + } + } + } + } + + @Override + public String getName(){ + return "itemDrill"; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase living){ + if(this.getEnergyStored(stack) >= this.energyUsePerBlockOrHit){ + this.extractEnergy(stack, this.energyUsePerBlockOrHit, false); + if(!world.isRemote){ + if(!living.isSneaking()){ + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){ + this.breakBlocks(stack, 2, world, x, y, z, living); + } + else this.breakBlocks(stack, 1, world, x, y, z, living); + } + } + } + } + return true; + } + + @Override + public float func_150893_a(ItemStack stack, Block block){ + if(this.getEnergyStored(stack) < this.energyUsePerBlockOrHit) return 0.0F; + if(block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock || allSet.contains(block)) return efficiency; + else return super.func_150893_a(stack, block); + } + + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2){ + if(this.getEnergyStored(stack) >= this.energyUsePerBlockOrHit){ + this.extractEnergy(stack, this.energyUsePerBlockOrHit, false); + } + return true; + } + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack){ + return this.func_150893_a(stack, block) > super.func_150893_a(stack, block); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + if(!world.isRemote && player.isSneaking()) player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ); + return stack; + } + + @Override + public int getHarvestLevel(ItemStack stack, String toolClass){ + return ToolMaterial.EMERALD.getHarvestLevel(); + } + + @Override + public Set getToolClasses(ItemStack stack){ + HashSet hashSet = new HashSet(); + hashSet.add("pickaxe"); + hashSet.add("shovel"); + return hashSet; + } + + @Override + public float getDigSpeed(ItemStack stack, Block block, int meta){ + return this.func_150893_a(stack, block); + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + if(KeyUtil.isShiftPressed()){ + list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF"); + } + } + + @Override + public Multimap getAttributeModifiers(ItemStack stack){ + Multimap map = super.getAttributeModifiers(stack); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", this.getEnergyStored(stack) >= this.energyUsePerBlockOrHit ? 8.0F : 0.0F, 0)); + return map; + } + + @Override + public boolean getShareTag(){ + return true; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java new file mode 100644 index 000000000..9afd3848a --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java @@ -0,0 +1,55 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemDrillUpgrade extends Item implements INameableItem{ + + public enum UpgradeType{ + SPEED, + SPEED_II, + SPEED_III, + SILK_TOUCH, //Done + FORTUNE, //Done + FORTUNE_II, //Done + THREE_BY_THREE, //Done + FIVE_BY_FIVE, //Done + VEIN, + PLACER + } + + public UpgradeType type; + public String unlocalizedName; + + public ItemDrillUpgrade(UpgradeType type, String unlocName){ + this.type = type; + this.unlocalizedName = unlocName; + } + + @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.unlocalizedName; + } + + @Override + public String getOredictName(){ + return this.getName(); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java index d81f4d634..321f8126b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java @@ -4,11 +4,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -57,13 +55,6 @@ public class ItemDust extends Item implements INameableItem{ return this.getUnlocalizedName() + (stack.getItemDamage() >= allDusts.length ? " ERROR!" : allDusts[stack.getItemDamage()].getName()); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(stack.getItemDamage() < allDusts.length) ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName()); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java index 6d535bc9d..33495fe50 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java @@ -3,7 +3,6 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -14,8 +13,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - public class ItemFertilizer extends Item implements INameableItem{ @Override @@ -32,13 +29,6 @@ public class ItemFertilizer extends Item implements INameableItem{ return EnumRarity.rare; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 1, ""); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java index 5f1578bb6..6991d913f 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java @@ -4,8 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -99,12 +97,8 @@ public class ItemFoods extends ItemFood implements INameableItem{ @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ if(stack.getItemDamage() < allFoods.length){ - 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(ItemUtil.shiftForInfo()); + 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); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java index 8ce79fdd3..f67c61872 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java @@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.recipe.HairyBallHandler; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; @@ -16,7 +15,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; -import java.util.List; import java.util.Random; public class ItemHairyBall extends Item implements INameableItem{ @@ -45,13 +43,6 @@ public class ItemHairyBall extends Item implements INameableItem{ return EnumRarity.epic; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 2, ""); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java index 5a98848a4..60d06c079 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java @@ -4,8 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheJams; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -18,7 +16,6 @@ import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import java.util.List; @@ -99,22 +96,6 @@ public class ItemJams extends ItemFood implements INameableItem{ return stackToReturn; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(stack.getItemDamage() < allJams.length){ - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.1")); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+allJams[stack.getItemDamage()].getName()+".desc")); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.2")); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+allJams[stack.getItemDamage()].healAmount); - list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+allJams[stack.getItemDamage()].saturation); - } - else list.add(ItemUtil.shiftForInfo()); - } - } - @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamageForRenderPass(int damage, int pass){ diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java index a73b250a2..63d86a0e3 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java @@ -4,8 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -51,13 +49,8 @@ public class ItemKnife extends Item implements INameableItem{ @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")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); - + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java index 945a1ae9b..4cd3e93f3 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -4,7 +4,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues; -import ellpeck.actuallyadditions.util.*; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.BlockLeavesBase; @@ -17,11 +18,9 @@ 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; public class ItemLeafBlower extends Item implements INameableItem{ @@ -101,18 +100,6 @@ public class ItemLeafBlower extends Item implements INameableItem{ 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 IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java index fd77272e5..28835adaa 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java @@ -4,11 +4,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -58,13 +56,6 @@ public class ItemMisc extends Item implements INameableItem{ return this.getUnlocalizedName() + (stack.getItemDamage() >= allMiscItems.length ? " ERROR!" : allMiscItems[stack.getItemDamage()].getName()); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(stack.getItemDamage() < allMiscItems.length) ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName()); - } - @Override public IIcon getIconFromDamage(int par1){ return par1 >= textures.length ? null : textures[par1]; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 04a3e66f9..ffcdfd9e9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer; import ellpeck.actuallyadditions.tile.TileEntityPhantomface; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -144,7 +143,6 @@ public class ItemPhantomConnector extends Item implements INameableItem{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 2, ""); ChunkCoordinates coords = this.getStoredPosition(stack); World world = this.getStoredWorld(stack); if(coords != null && world != null){ diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java index db3fe422c..8ee3b8566 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java @@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.ThePotionRings; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -89,15 +88,6 @@ public class ItemPotionRing extends Item implements INameableItem{ return this.getUnlocalizedName() + (stack.getItemDamage() >= allRings.length ? " ERROR!" : allRings[stack.getItemDamage()].getName()); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(stack.getItemDamage() < allRings.length){ - ItemUtil.addInformation(this, list, 2, ""); - } - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java index 79e956b5a..6350b6db8 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java @@ -2,18 +2,15 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.*; +import ellpeck.actuallyadditions.util.INameableItem; +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 net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.List; public class ItemResonantRice extends Item implements INameableItem{ @@ -31,14 +28,6 @@ public class ItemResonantRice extends Item implements INameableItem{ return EnumRarity.epic; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 1, ""); - if(KeyUtil.isShiftPressed() && OreDictionary.getOres("nuggetEnderium").size() == 0) list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemResonantRice.uncraftable.desc")); - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java index 7f5d1c7d6..b52c6f05d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java @@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.BlockPlant; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -25,8 +24,6 @@ import net.minecraftforge.event.ForgeEventFactory; import powercrystals.minefactoryreloaded.api.IFactoryPlantable; import powercrystals.minefactoryreloaded.api.ReplacementBlock; -import java.util.List; - public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlantable{ public Block plant; @@ -89,12 +86,6 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta return EnumRarity.rare; } - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - ItemUtil.addInformation(this, list, 1, ""); - } - @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 22a758de4..29935517a 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -79,13 +78,6 @@ public class ItemSpecialDrop extends Item implements INameableItem{ return this.getUnlocalizedName() + (stack.getItemDamage() >= allDrops.length ? " ERROR!" : allDrops[stack.getItemDamage()].getName()); } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ - if(stack.getItemDamage() < allDrops.length) ItemUtil.addInformation(this, list, stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal() ? 2 : 1, allDrops[stack.getItemDamage()].getName()); - } - @Override public IIcon getIconFromDamage(int par1){ return par1 >= textures.length ? null : textures[par1]; diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java index e6cb47d7e..500f39c3d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java @@ -1,11 +1,10 @@ package ellpeck.actuallyadditions.items.tools; + import com.google.common.collect.Sets; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -21,15 +20,16 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.UseHoeEvent; +import java.util.HashSet; import java.util.List; import java.util.Set; @SuppressWarnings("unchecked") public class ItemAllToolAA extends ItemTool implements INameableItem{ - private static final Set axeSet = Sets.newHashSet(Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin); - private static final Set pickSet = Sets.newHashSet(Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail); - private static final Set shovelSet = Sets.newHashSet(Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium); + public static final Set axeSet = Sets.newHashSet(Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin); + public static final Set pickSet = Sets.newHashSet(Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail); + public static final Set shovelSet = Sets.newHashSet(Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium); private static final Set allSet = Sets.newHashSet(); static{ @@ -68,16 +68,12 @@ public class ItemAllToolAA extends ItemTool implements INameableItem{ @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+".paxel.desc")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){ - if (!player.canPlayerEdit(x, y, z, side, stack)) return false; + if(!player.canPlayerEdit(x, y, z, side, stack)) return false; else{ UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z); if(MinecraftForge.EVENT_BUS.post(event)) return false; @@ -86,10 +82,10 @@ public class ItemAllToolAA extends ItemTool implements INameableItem{ return true; } Block block = world.getBlock(x, y, z); - if(side != 0 && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)){ + if(side != 0 && world.getBlock(x, y+1, z).isAir(world, x, y+1, z) && (block == Blocks.grass || block == Blocks.dirt)){ Block block1 = Blocks.farmland; - world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F); - if (world.isRemote) return true; + world.playSoundEffect((double)((float)x+0.5F), (double)((float)y+0.5F), (double)((float)z+0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume()+1.0F)/2.0F, block1.stepSound.getPitch()*0.8F); + if(world.isRemote) return true; else{ world.setBlock(x, y, z, block1); stack.damageItem(1, player); @@ -130,4 +126,13 @@ public class ItemAllToolAA extends ItemTool implements INameableItem{ public String getOredictName(){ return oredictName; } + + @Override + public Set getToolClasses(ItemStack stack){ + HashSet hashSet = new HashSet(); + hashSet.add("pickaxe"); + hashSet.add("shovel"); + hashSet.add("axe"); + return hashSet; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java index 6287b62f6..7d993bb59 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java @@ -3,18 +3,12 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.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.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; - -import java.util.List; public class ItemAxeAA extends ItemAxe implements INameableItem{ @@ -31,17 +25,6 @@ public class ItemAxeAA extends ItemAxe implements INameableItem{ this.oredictName = name; } - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); - } - @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ return stack.getItem() == repairItem.getItem(); diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java index 4adf9cf67..a7c6f8ca4 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java @@ -3,8 +3,6 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -35,11 +33,7 @@ public class ItemHoeAA extends ItemHoe implements INameableItem{ @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")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java index 04bf68c14..0307eb6ff 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java @@ -3,8 +3,6 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -35,11 +33,7 @@ public class ItemPickaxeAA extends ItemPickaxe implements INameableItem{ @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")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java index f805278c0..0ebf051c9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java @@ -3,8 +3,6 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -35,11 +33,7 @@ public class ItemShovelAA extends ItemSpade implements INameableItem{ @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")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java index 2b4a84b32..482c1d442 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java @@ -3,8 +3,6 @@ package ellpeck.actuallyadditions.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ItemUtil; -import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -35,11 +33,7 @@ public class ItemSwordAA extends ItemSword implements INameableItem{ @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")); - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); - } - else list.add(ItemUtil.shiftForInfo()); + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/manual/ContainerManual.java b/src/main/java/ellpeck/actuallyadditions/manual/ContainerManual.java new file mode 100644 index 000000000..c7d6f0f14 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/ContainerManual.java @@ -0,0 +1,232 @@ +package ellpeck.actuallyadditions.manual; + +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +import java.util.ArrayList; +import java.util.List; + +public class ContainerManual extends Container{ + + TheInventory inventory = new TheInventory(); + + public ContainerManual(){ + this.addSlotToContainer(new SlotImmovable(this.inventory, 0, 199, 41)); + + for(int i = 0; i < 13; i++){ + for(int j = 0; j < 4; j++){ + this.addSlotToContainer(new SlotImmovable(this.inventory, 1+j+(i*4), 5+j*18, 5+i*18)); + } + } + for(int i = 0; i < 3; i++){ + for(int j = 0; j < 3; j++){ + this.addSlotToContainer(new SlotImmovable(this.inventory, 1+13*4+j+(i*3), 105+j*18, 23+i*18)); + } + } + + for(int i = 1; i < ManualItems.list.size()+1; i++){ + if(i < 1+13*4){ + this.inventory.setInventorySlotContents(i, ManualItems.list.get(i-1).stack.copy()); + } + } + } + + public void scrollTo(float f){ + if(this.needsScrollBars()){ + int i = ManualItems.list.size()/4-13; + int j = (int)((double)(f*(float)i)+0.5D); + + if(j < 0) j = 0; + for(int k = 0; k < 13; ++k){ + for(int l = 0; l < 4; ++l){ + int i1 = l+(k+j)*4; + + if(i1 >= 0 && i1 < ManualItems.list.size()){ + this.inventory.setInventorySlotContents(1+l+k*4, ManualItems.list.get(i1).stack.copy()); + } + else this.inventory.setInventorySlotContents(1+l+k*4, null); + } + } + } + } + + public boolean needsScrollBars(){ + return ManualItems.list.size() > 9*13; + } + + @Override + @SuppressWarnings("unchecked") + public ItemStack slotClick(int slot, int par2, int par3, EntityPlayer player){ + if(slot > 0 && slot < 1+13*4){ + Slot theSlot = this.getSlot(slot); + if(theSlot.getStack() != null){ + this.inventory.setInventorySlotContents(0, theSlot.getStack().copy()); + + for(int i = 0; i < 9; i++) this.inventory.setInventorySlotContents(1+13*4+i, null); + List list = CraftingManager.getInstance().getRecipeList(); + for(IRecipe iRec: list){ + if(iRec instanceof ShapedOreRecipe){ + ShapedOreRecipe recipe = (ShapedOreRecipe)iRec; + if(theSlot.getStack().isItemEqual(recipe.getRecipeOutput())){ + + int width = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, recipe, 4); + int height = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, recipe, 5); + for(int x = 0; x < width; x++){ + for(int y = 0; y < height; y++){ + int i = y*width+x; + ItemStack stack = null; + Object input = recipe.getInput()[i]; + if(input instanceof ItemStack) stack = ((ItemStack)input).copy(); + if(input instanceof ItemStack[]) stack = ((ItemStack[])input)[0]; + if(input instanceof List) stack = ((List)input).get(0); + + int k = 0; + if(x == 0){ + if(y == 0) k = 0; + if(y == 1) k = 3; + if(y == 2) k = 6; + } + if(x == 1){ + if(y == 0) k = 1; + if(y == 1) k = 4; + if(y == 2) k = 7; + } + if(x == 2){ + if(y == 0) k = 2; + if(y == 1) k = 5; + if(y == 2) k = 8; + } + this.inventory.setInventorySlotContents(1+13*4+k, stack); + } + } + break; + } + } + if(iRec instanceof ShapelessOreRecipe){ + ShapelessOreRecipe recipe = (ShapelessOreRecipe)iRec; + if(theSlot.getStack().isItemEqual(recipe.getRecipeOutput())){ + ArrayList ingredients = recipe.getInput(); + for(int i = 0; i < ingredients.size(); i++){ + ItemStack stack = null; + if(ingredients.get(i) instanceof ItemStack) stack = ((ItemStack)ingredients.get(i)).copy(); + if(ingredients.get(i) instanceof ItemStack[]) stack = ((ItemStack[])ingredients.get(i))[0]; + if(ingredients.get(i) instanceof List) stack = ((List)ingredients.get(i)).get(0); + + this.inventory.setInventorySlotContents(1+13*4+i, stack); + } + break; + } + } + } + } + } + return null; + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.inventory.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + return null; + } + + public static class TheInventory implements IInventory{ + + public ItemStack[] slots = new ItemStack[13*4+10]; + + @Override + public void setInventorySlotContents(int i, ItemStack stack){ + this.slots[i] = stack; + this.markDirty(); + } + + @Override + public int getSizeInventory(){ + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int i){ + if(i < this.getSizeInventory()){ + return slots[i]; + } + return null; + } + + @Override + public ItemStack decrStackSize(int i, int j){ + if (slots[i] != null){ + ItemStack stackAt; + if(slots[i].stackSize <= j){ + stackAt = slots[i]; + slots[i] = null; + this.markDirty(); + return stackAt; + } + else{ + stackAt = slots[i].splitStack(j); + if (slots[i].stackSize == 0) slots[i] = null; + this.markDirty(); + return stackAt; + } + } + return null; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i){ + return getStackInSlot(i); + } + + @Override + public String getInventoryName(){ + return "Actually Additions Manual"; + } + + @Override + public boolean hasCustomInventoryName(){ + return false; + } + + @Override + public int getInventoryStackLimit(){ + return 1; + } + + @Override + public void markDirty(){ + + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player){ + return true; + } + + @Override + public void openInventory(){ + + } + + @Override + public void closeInventory(){ + + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/manual/GuiManual.java b/src/main/java/ellpeck/actuallyadditions/manual/GuiManual.java new file mode 100644 index 000000000..58a120c70 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/GuiManual.java @@ -0,0 +1,115 @@ +package ellpeck.actuallyadditions.manual; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiManual extends GuiContainer{ + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiManual"); + + private FontRenderer infoTextRenderer; + + private float currentScroll; + private boolean isScrolling; + private boolean wasClicking; + + public GuiManual(){ + super(new ContainerManual()); + + this.xSize = 256; + this.ySize = 244; + } + + @Override + public void drawScreen(int x, int y, float f){ + if(((ContainerManual)this.inventorySlots).needsScrollBars()){ + boolean flag = Mouse.isButtonDown(0); + int k = this.guiLeft; + int l = this.guiTop; + int i1 = k+78; + int j1 = l+5; + int k1 = i1+12; + int l1 = j1+232; + + if(!this.wasClicking && flag && x >= i1 && y >= j1 && x < k1 && y < l1) this.isScrolling = true; + if(!flag) this.isScrolling = false; + this.wasClicking = flag; + + if(this.isScrolling){ + this.currentScroll = ((float)(y-j1)-7.5F)/((float)(l1-j1)-15.0F); + if(this.currentScroll < 0.0F){ + this.currentScroll = 0.0F; + } + if(this.currentScroll > 1.0F){ + this.currentScroll = 1.0F; + } + ((ContainerManual)this.inventorySlots).scrollTo(this.currentScroll); + } + } + super.drawScreen(x, y, f); + } + + @Override + public void handleMouseInput(){ + super.handleMouseInput(); + if(((ContainerManual)this.inventorySlots).needsScrollBars()){ + int i = Mouse.getEventDWheel(); + + if(i != 0){ + int j = ((ContainerManual)this.inventorySlots).inventory.slots.length/4-13; + + if(i > 0) i = 1; + if(i < 0) i = -1; + this.currentScroll = (float)((double)this.currentScroll-(double)i/(double)j); + if(this.currentScroll < 0.0F) this.currentScroll = 0.0F; + + if(this.currentScroll > 1.0F) this.currentScroll = 1.0F; + ((ContainerManual)this.inventorySlots).scrollTo(this.currentScroll); + } + } + } + + @Override + public void initGui(){ + super.initGui(); + this.infoTextRenderer = new FontRenderer(this.mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.mc.renderEngine, true); + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".manual"); + + ManualItems.InfoTab tab = ManualItems.getTabFromStack(this.inventorySlots.getSlot(0).getStack()); + if(tab != null){ + this.drawCenterString(tab.title, 160, 8); + this.fontRendererObj.drawSplitString(tab.extraForRecipe, 95, 80, 155, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + + this.infoTextRenderer.drawSplitString(tab.text, 95, (tab.extraForRecipe == null || tab.extraForRecipe.length() <= 0 ? 80 : 100), 155, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + } + } + + private void drawCenterString(String text, int xPos, int yPos){ + this.fontRendererObj.drawString(text, xPos - this.fontRendererObj.getStringWidth(text)/2, yPos, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(resLoc); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tabs.png")); + this.drawTexturedModalRect(this.guiLeft+78, this.guiTop+5 + (int)((float)(this.guiTop+5+232-this.guiTop+5-25) * this.currentScroll), 232+(((ContainerManual)this.inventorySlots).needsScrollBars() ? 0 : 12), 0, 12, 15); + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/manual/InventoryEvents.java b/src/main/java/ellpeck/actuallyadditions/manual/InventoryEvents.java new file mode 100644 index 000000000..79eb9352c --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/InventoryEvents.java @@ -0,0 +1,56 @@ +package ellpeck.actuallyadditions.manual; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ellpeck.actuallyadditions.inventory.gui.GuiInputter; +import ellpeck.actuallyadditions.network.PacketHandler; +import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.util.StatCollector; +import net.minecraftforge.client.event.GuiScreenEvent; + +public class InventoryEvents{ + + private static final int MANUAL_BUTTON_ID = 123782; + + public static class InitGuiEvent{ + @SubscribeEvent + @SuppressWarnings("unchecked") + public void onInitGuiEvent(GuiScreenEvent.InitGuiEvent.Post event){ + if(event.gui instanceof GuiInventory && !Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode){ + int k = (event.gui.width-176)/2; + int l = (event.gui.height-166)/2; + + ManualButton button = new ManualButton(MANUAL_BUTTON_ID, k+160, l+166, "!"); + event.buttonList.add(button); + } + } + } + + public static class ButtonPressedEvent{ + @SubscribeEvent + public void onButtonPressedEvent(GuiScreenEvent.ActionPerformedEvent.Post event){ + if(event.gui instanceof GuiInventory && event.button.id == MANUAL_BUTTON_ID){ + PacketHandler.theNetwork.sendToServer(new PacketOpenManual()); + } + } + } + + public static class ManualButton extends GuiInputter.SmallerButton{ + + public ManualButton(int id, int x, int y, String display){ + super(id, x, y, display); + } + + @Override + public void drawButton(Minecraft mc, int x, int y){ + super.drawButton(mc, x, y); + boolean hovering = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; + if(this.getHoverState(hovering) == 2){ + String manual = StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".manual.name"); + mc.fontRenderer.drawString(manual, this.xPosition+this.width/2-mc.fontRenderer.getStringWidth(manual)/2 , this.yPosition+this.height+5, StringUtil.DECIMAL_COLOR_WHITE); + } + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/manual/ManualItems.java b/src/main/java/ellpeck/actuallyadditions/manual/ManualItems.java new file mode 100644 index 000000000..76cc79bf9 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/ManualItems.java @@ -0,0 +1,77 @@ +package ellpeck.actuallyadditions.manual; + +import ellpeck.actuallyadditions.blocks.InitBlocks; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +public class ManualItems{ + + public static ArrayList list = new ArrayList(); + + static{ + addBlock(InitBlocks.blockPhantomface, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch", "OreDictionary!"); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockBreaker, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockCoalGenerator, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomPlacer, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockFeeder, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockCanolaPress, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockFluidCollector, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomLiquiface, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockBreaker, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + addBlock(InitBlocks.blockPhantomBooster, "The Phantomface is a Block that is very nice and amazing and can transmit stuff if you connect it with stuff this is a text message so I don't care anyways bla bla bla bla bla Penis ficken arsch also das hier ist eine echt lange Message und ich weiß nicht was ich hier weiter schrieben soll das kommt eh späüter alles in die Lang datei", ""); + + } + + private static void addItem(Item item, String text, String extraForRecipe){ + addStack(new ItemStack(item), text, extraForRecipe); + } + + private static void addBlock(Block block, String text, String extraForRecipe){ + addStack(new ItemStack(block), text, extraForRecipe); + } + + private static void addStack(ItemStack stack, String text, String extraForRecipe){ + list.add(new InfoTab(stack.copy(), text, extraForRecipe)); + } + + public static InfoTab getTabFromStack(ItemStack stack){ + for(InfoTab tab : list){ + if(stack != null && tab.stack != null && stack.isItemEqual(tab.stack)) return tab; + } + return null; + } + + public static class InfoTab{ + public ItemStack stack; + public String text; + public String title; + public String extraForRecipe; + + public InfoTab(ItemStack stack, String text, String extraForRecipe){ + this.stack = stack; + this.title = stack.getDisplayName(); + this.text = text; + this.extraForRecipe = extraForRecipe; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/manual/PacketOpenManual.java b/src/main/java/ellpeck/actuallyadditions/manual/PacketOpenManual.java new file mode 100644 index 000000000..b94c9fab4 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/PacketOpenManual.java @@ -0,0 +1,35 @@ +package ellpeck.actuallyadditions.manual; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.inventory.GuiHandler; +import io.netty.buffer.ByteBuf; + +public class PacketOpenManual implements IMessage{ + + @SuppressWarnings("unused") + public PacketOpenManual(){ + + } + + @Override + public void fromBytes(ByteBuf buf){ + + } + + @Override + public void toBytes(ByteBuf buf){ + + } + + public static class Handler implements IMessageHandler{ + + @Override + public IMessage onMessage(PacketOpenManual message, MessageContext ctx){ + ctx.getServerHandler().playerEntity.openGui(ActuallyAdditions.instance, GuiHandler.MANUAL_ID, ctx.getServerHandler().playerEntity.worldObj, (int)ctx.getServerHandler().playerEntity.posX, (int)ctx.getServerHandler().playerEntity.posY, (int)ctx.getServerHandler().playerEntity.posZ); + return null; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/manual/SlotImmovable.java b/src/main/java/ellpeck/actuallyadditions/manual/SlotImmovable.java new file mode 100644 index 000000000..651cd5024 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/manual/SlotImmovable.java @@ -0,0 +1,23 @@ +package ellpeck.actuallyadditions.manual; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotImmovable extends Slot{ + + public SlotImmovable(IInventory inventory, int id, int x, int y){ + super(inventory, id, x, y); + } + + @Override + public boolean isItemValid(ItemStack stack){ + return false; + } + + @Override + public boolean canTakeStack(EntityPlayer player){ + return false; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java index 23daabe01..ce741d06b 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/network/PacketHandler.java @@ -3,6 +3,7 @@ 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.manual.PacketOpenManual; import ellpeck.actuallyadditions.network.gui.PacketGuiButton; import ellpeck.actuallyadditions.util.ModUtil; @@ -16,5 +17,6 @@ public class PacketHandler{ theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT); theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 1, Side.SERVER); theNetwork.registerMessage(PacketFluidCollectorToClient.Handler.class, PacketFluidCollectorToClient.class, 2, Side.CLIENT); + theNetwork.registerMessage(PacketOpenManual.Handler.class, PacketOpenManual.class, 3, Side.SERVER); } } diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java index 8c3ccc31d..aef05af84 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java @@ -22,16 +22,16 @@ public class ClientProxy implements IProxy{ @Override public void preInit(){ Util.logInfo("PreInitializing ClientProxy..."); + + if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled()){ + new UpdateChecker().init(); + } } @Override public void init(){ Util.logInfo("Initializing ClientProxy..."); - if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled()){ - new UpdateChecker().init(); - } - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost())); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index f4c698971..870ab38ea 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -4,11 +4,27 @@ 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.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntityBase extends TileEntity{ + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + this.readFromNBT(pkt.func_148857_g()); + } + public static void init(){ Util.logInfo("Registering TileEntities..."); GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER + ":tileEntityCompost"); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index e9c031d52..b0bb6e74b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -164,7 +164,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ if(receive != null){ int actualReceive = ((IFluidHandler)tile).fill(side.getOpposite(), receive, true); this.drain(side, new FluidStack(receive.getFluid(), actualReceive), true); - worldObj.markBlockForUpdate(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ); } } } @@ -256,7 +255,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ int receive = this.extractEnergy(side, Math.min(((IEnergyReceiver)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN)-((IEnergyReceiver)tile).getEnergyStored(ForgeDirection.UNKNOWN), this.getEnergyStored(ForgeDirection.UNKNOWN)), true); int actualReceive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), receive, false); this.extractEnergy(side, actualReceive, false); - worldObj.markBlockForUpdate(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java index ff35bbba2..966e20dc5 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java @@ -17,16 +17,6 @@ public class BlockUtil{ return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName(); } - @SuppressWarnings("unchecked") - public static void addInformation(Block block, List list, int lines, String extraName){ - if(KeyUtil.isShiftPressed()){ - for(int i = 0; i < lines; i++){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); - } - } - else list.add(ItemUtil.shiftForInfo()); - } - @SuppressWarnings("unchecked") public static void addPowerUsageInfo(List list, int usage){ if(KeyUtil.isShiftPressed()){ @@ -36,9 +26,7 @@ public class BlockUtil{ @SuppressWarnings("unchecked") public static void addPowerProductionInfo(List list, int produce){ - if(KeyUtil.isShiftPressed()){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".produces.desc") + " " + produce + " RF/t"); - } + list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".produces.desc") + " " + produce + " RF/t"); } public static final ArrayList wailaRegisterList = new ArrayList(); diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java index b38dd0e51..19473d002 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -4,23 +4,10 @@ import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.creative.CreativeTab; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import java.util.List; - public class ItemUtil{ - @SuppressWarnings("unchecked") - public static void addInformation(Item item, List list, int lines, String extraName){ - if(KeyUtil.isShiftPressed()){ - for(int i = 0; i < lines; i++){ - list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); - } - } - else list.add(shiftForInfo()); - } - public static void registerItems(Item[] items){ for(Item item : items){ register(item); @@ -50,8 +37,4 @@ public class ItemUtil{ public static String createUnlocalizedName(Item item){ return ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName(); } - - public static String shiftForInfo(){ - return StringUtil.GREEN + StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".shiftForInfo.desc"); - } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 94485205f..788a79906 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -3,11 +3,17 @@ package ellpeck.actuallyadditions.util; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; import net.minecraft.block.Block; +import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.IPlantable; @@ -39,18 +45,36 @@ public class WorldUtil{ if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite())){ int receive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), Math.min(storage.getMaxExtract(), storage.getEnergyStored()), false); storage.extractEnergy(receive, false); - world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ); } } } + public static MovingObjectPosition raytraceEntity(World world, Entity player, double range){ + float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*1.0F; + float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*1.0F; + double d0 = player.prevPosX+(player.posX-player.prevPosX)*1.0D; + double d1 = player.prevPosY+(player.posY-player.prevPosY)*1.0D; + if(!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D; + double d2 = player.prevPosZ+(player.posZ-player.prevPosZ)*1.0D; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + float f3 = MathHelper.cos(-f2*0.017453292F-(float)Math.PI); + float f4 = MathHelper.sin(-f2*0.017453292F-(float)Math.PI); + float f5 = -MathHelper.cos(-f1*0.017453292F); + float f6 = MathHelper.sin(-f1*0.017453292F); + float f7 = f4*f5; + float f8 = f3*f5; + double d3 = range; + if(player instanceof EntityPlayerMP) d3 = ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance(); + Vec3 vec31 = vec3.addVector((double)f7*d3, (double)f6*d3, (double)f8*d3); + return world.func_147447_a(vec3, vec31, false, true, false); + } + public static void pushFluid(World world, int x, int y, int z, ForgeDirection side, FluidTank tank){ TileEntity tile = getTileEntityFromSide(side, world, x, y, z); if(tile != null && tank.getFluid() != null && tile instanceof IFluidHandler){ if(((IFluidHandler)tile).canFill(side.getOpposite(), tank.getFluid().getFluid())){ int receive = ((IFluidHandler)tile).fill(side.getOpposite(), tank.getFluid(), true); tank.drain(receive, true); - world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ); } } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 308f4baf9..edfb1c215 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -134,7 +134,7 @@ tooltip.actuallyadditions.itemResonantRice.uncraftable.desc=Uncraftable because tile.actuallyadditions.blockCanolaPress.name=Canola Press tooltip.actuallyadditions.blockCanolaPress.desc=Makes Canola Oil from Canola tile.actuallyadditions.blockFermentingBarrel.name=Fermenting Barrel -tooltip.actuallyadditions.blockFermentingBarrel.desc=Ferments Canola Oil made in a Press to Canola +tooltip.actuallyadditions.blockFermentingBarrel.desc=Ferments Canola Oil made in a Press to Oil tile.actuallyadditions.blockCanolaOil.name=Canola Oil tooltip.actuallyadditions.blockCanolaOil.desc=Oil made from Canola @@ -264,7 +264,8 @@ item.actuallyadditions.itemDustQuartz.name=Crushed Quartz item.actuallyadditions.itemDustCoal.name=Crushed Coal item.actuallyadditions.itemDustQuartzBlack.name=Crushed Black Quartz -tooltip.actuallyadditions.shiftForInfo.desc=Press Shift for Info +tooltip.actuallyadditions.moreInfo.desc.1=Open the Actually Additions Manual +tooltip.actuallyadditions.moreInfo.desc.2=with the Button in your Inventory! tooltip.actuallyadditions.hunger.desc=Fills tooltip.actuallyadditions.saturation.desc=Saturation tooltip.actuallyadditions.durability.desc=Durability @@ -450,6 +451,7 @@ container.actuallyadditions.energyface.name=Energyface container.actuallyadditions.fluidPlacer.name=Fluid Placer container.actuallyadditions.fluidCollector.name=Fluid Collector container.actuallyadditions.coffeeMachine.name=Coffee Machine +container.actuallyadditions.manual.name=Actually Additions Manual container.nei.actuallyadditions.crushing.name=Crusher container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png new file mode 100644 index 000000000..2c18e2191 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png differ