From fb535bb9ec34fda648459021242f8a66400e689f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 21 Jun 2015 02:28:49 +0200 Subject: [PATCH] -Update 0.0.6.0 --- build.gradle | 2 +- .../actuallyadditions/ActuallyAdditions.java | 12 +- .../ellpeck/actuallyadditions/PLANNED.txt | 12 ++ .../blocks/BlockCoalGenerator.java | 14 ++ .../blocks/BlockEnergizer.java | 122 +++++++++++ .../blocks/BlockFurnaceDouble.java | 3 +- .../blocks/BlockItemRepairer.java | 12 +- .../blocks/BlockOilGenerator.java | 14 ++ .../actuallyadditions/blocks/BlockPlant.java | 42 ++-- .../actuallyadditions/blocks/InitBlocks.java | 9 + .../config/ConfigCategories.java | 3 +- .../config/values/ConfigCrafting.java | 13 +- .../config/values/ConfigFloatValues.java | 4 +- .../config/values/ConfigIntValues.java | 19 +- .../crafting/BlockCrafting.java | 16 ++ .../crafting/GrinderCrafting.java | 39 ++-- .../crafting/ItemCrafting.java | 101 ++++++++- .../creative/CreativeTab.java | 162 ++++++++------- .../gen/JamVillagerTradeHandler.java | 2 +- .../inventory/ContainerDrill.java | 195 ++++++++++++++++++ .../inventory/ContainerEnergizer.java | 109 ++++++++++ .../inventory/ContainerEnervator.java | 109 ++++++++++ .../inventory/ContainerGrinder.java | 2 +- .../inventory/GuiHandler.java | 14 ++ .../inventory/gui/GuiDrill.java | 39 ++++ .../inventory/gui/GuiEnergizer.java | 60 ++++++ .../inventory/gui/GuiEnervator.java | 60 ++++++ .../inventory/slot/SlotImmovable.java | 24 +++ .../actuallyadditions/items/InitItems.java | 45 +++- .../actuallyadditions/items/ItemBattery.java | 107 ++++++++++ .../actuallyadditions/items/ItemDrill.java | 178 +++++++++------- .../items/ItemDrillUpgrade.java | 75 +++++-- .../items/ItemResonantRice.java | 2 +- .../actuallyadditions/items/ItemSeed.java | 3 +- .../items/tools/ItemAllToolAA.java | 10 + .../nei/CrusherRecipeHandler.java | 6 +- .../recipe/GrinderRecipeRegistry.java | 22 +- .../recipe/GrinderRecipes.java | 36 ++-- .../tile/TileEntityBase.java | 2 + .../tile/TileEntityBreaker.java | 2 +- .../tile/TileEntityCoalGenerator.java | 10 + .../tile/TileEntityEnergizer.java | 82 ++++++++ .../tile/TileEntityEnervator.java | 92 +++++++++ .../tile/TileEntityFurnaceDouble.java | 17 +- .../tile/TileEntityGrinder.java | 38 ++-- .../tile/TileEntityOilGenerator.java | 10 + .../tile/TileEntityPhantomPlacer.java | 2 +- .../actuallyadditions/util/ModUtil.java | 2 +- .../actuallyadditions/util/WorldUtil.java | 28 --- .../assets/actuallyadditions/lang/en_US.lang | 55 ++++- .../textures/blocks/blockCoalGeneratorTop.png | Bin 550 -> 509 bytes .../textures/blocks/blockGrinderOn.png | Bin 447 -> 1509 bytes .../textures/blocks/blockItemRepairerOn.png | Bin 807 -> 0 bytes .../textures/blocks/blockOilGeneratorTop.png | Bin 537 -> 509 bytes .../textures/gui/guiManual.png | Bin 1859 -> 0 bytes update/changelog.txt | 2 +- update/newestVersion.txt | 2 +- 57 files changed, 1687 insertions(+), 354 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDrill.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java create mode 100644 src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java create mode 100644 src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java create mode 100644 src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java create mode 100644 src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java delete mode 100644 src/main/resources/assets/actuallyadditions/textures/blocks/blockItemRepairerOn.png delete mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png diff --git a/build.gradle b/build.gradle index 03d308b69..12d0a25d9 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'maven' -version = "1.7.10-0.0.5.7" +version = "1.7.10-0.0.6.0" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index 4f4141b1e..2c7456d48 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -13,6 +13,7 @@ import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.config.ConfigurationHandler; import ellpeck.actuallyadditions.crafting.GrinderCrafting; import ellpeck.actuallyadditions.crafting.InitCrafting; +import ellpeck.actuallyadditions.crafting.ItemCrafting; import ellpeck.actuallyadditions.event.InitEvents; import ellpeck.actuallyadditions.gen.InitVillager; import ellpeck.actuallyadditions.gen.OreGen; @@ -36,7 +37,7 @@ public class ActuallyAdditions{ @SidedProxy(clientSide = "ellpeck.actuallyadditions.proxy.ClientProxy", serverSide = "ellpeck.actuallyadditions.proxy.ServerProxy") public static IProxy proxy; - @EventHandler() + @EventHandler public void preInit(FMLPreInitializationEvent event){ Util.logInfo("Starting PreInitialization Phase..."); @@ -52,8 +53,7 @@ public class ActuallyAdditions{ Util.logInfo("PreInitialization Finished."); } - @SuppressWarnings("unused") - @EventHandler() + @EventHandler public void init(FMLInitializationEvent event){ Util.logInfo("Starting Initialization Phase..."); @@ -69,13 +69,13 @@ public class ActuallyAdditions{ Util.logInfo("Initialization Finished."); } - @SuppressWarnings("unused") - @EventHandler() + @EventHandler public void postInit(FMLPostInitializationEvent event){ Util.logInfo("Starting PostInitialization Phase..."); - GrinderCrafting.init(); ItemCoffee.initIngredients(); + GrinderCrafting.init(); + ItemCrafting.initMashedFoodRecipes(); proxy.postInit(); Util.logInfo("PostInitialization Finished."); diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index f88cf0aa5..b3e7fb03f 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -97,3 +97,15 @@ -XP Solidifier -Block that creates Solidified Experience from Player's Levels -Has a GUI with Buttons + +-Alarm + -Gets triggered when Mobs are in the Area + -Configurable Range + -Configurable Mobs + +-Industrial Fertilizer + -Grows the whole Plant with one Click + +-Dog Bones + -Breed Dogs faster + -Makes them have Babies too diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java index b57296420..637beffdb 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java @@ -20,6 +20,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.List; +import java.util.Random; public class BlockCoalGenerator extends BlockContainerBase implements INameableItem{ @@ -30,6 +31,19 @@ public class BlockCoalGenerator extends BlockContainerBase implements INameableI this.setHarvestLevel("pickaxe", 0); this.setHardness(1.0F); this.setStepSound(soundTypeStone); + this.setTickRandomly(true); + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand){ + int meta = world.getBlockMetadata(x, y, z); + + if (meta == 1){ + for(int i = 0; i < 5; i++){ + world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D); + } + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java new file mode 100644 index 000000000..872c55f45 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java @@ -0,0 +1,122 @@ +package ellpeck.actuallyadditions.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.tile.TileEntityEnergizer; +import ellpeck.actuallyadditions.tile.TileEntityEnervator; +import ellpeck.actuallyadditions.util.BlockUtil; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import java.util.List; + +public class BlockEnergizer extends BlockContainerBase implements INameableItem{ + + private IIcon topIcon; + private IIcon sideIcon; + private boolean isEnergizer; + + public BlockEnergizer(boolean isEnergizer){ + super(Material.rock); + this.isEnergizer = isEnergizer; + this.setHarvestLevel("pickaxe", 0); + this.setHardness(2.0F); + this.setStepSound(soundTypeStone); + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @Override + public TileEntity createNewTileEntity(World world, int par2){ + return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator(); + } + + @Override + public IIcon getIcon(int side, int meta){ + return side == 1 ? this.topIcon : (side == 0 ? this.blockIcon : this.sideIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconReg){ + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); + this.sideIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Side"); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(!world.isRemote){ + if(this.isEnergizer){ + TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(x, y, z); + if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERGIZER_ID, world, x, y, z); + } + else{ + TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(x, y, z); + if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERVATOR_ID, world, x, y, z); + } + return true; + } + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int par6){ + this.dropInventory(world, x, y, z); + super.breakBlock(world, x, y, z, block, par6); + } + + @Override + public String getName(){ + return this.isEnergizer ? "blockEnergizer" : "blockEnervator"; + } + + public static class TheItemBlock extends ItemBlock{ + + private Block theBlock; + + public TheItemBlock(Block block){ + super(block); + this.theBlock = block; + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.uncommon; + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + BlockUtil.addInformation(theBlock, list, 2, ""); + } + + @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..f6f4901c3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -3,6 +3,7 @@ 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.TileEntityFurnaceDouble; import ellpeck.actuallyadditions.util.BlockUtil; @@ -171,7 +172,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { BlockUtil.addInformation(theBlock, list, 1, ""); - BlockUtil.addPowerUsageInfo(list, TileEntityFurnaceDouble.energyUsePerTick); + BlockUtil.addPowerUsageInfo(list, ConfigIntValues.FURNACE_ENERGY_USED.getValue()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 10be6b9a1..905b3d0ce 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -21,12 +21,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.List; -import java.util.Random; public class BlockItemRepairer extends BlockContainerBase implements INameableItem{ private IIcon topIcon; - private IIcon onIcon; private IIcon bottomIcon; public BlockItemRepairer(){ @@ -54,24 +52,16 @@ public class BlockItemRepairer extends BlockContainerBase implements INameableIt @Override public IIcon getIcon(int side, int meta){ - if(side == 1 && meta != 1) return this.topIcon; - if(side == 1) return this.onIcon; + if(side == 1) return this.topIcon; if(side == 0) return this.bottomIcon; return this.blockIcon; } - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random rand){ - - } - @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); - this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "On"); this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom"); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java index 28e8d6568..6fc338596 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java @@ -20,6 +20,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.List; +import java.util.Random; public class BlockOilGenerator extends BlockContainerBase implements INameableItem{ @@ -30,6 +31,19 @@ public class BlockOilGenerator extends BlockContainerBase implements INameableIt this.setHarvestLevel("pickaxe", 0); this.setHardness(1.0F); this.setStepSound(soundTypeStone); + this.setTickRandomly(true); + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand){ + int meta = world.getBlockMetadata(x, y, z); + + if (meta == 1){ + for(int i = 0; i < 5; i++){ + world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D); + } + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java index f9298b9ac..a0acb372e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java @@ -21,7 +21,6 @@ import powercrystals.minefactoryreloaded.api.HarvestType; import powercrystals.minefactoryreloaded.api.IFactoryFertilizable; import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; @@ -31,7 +30,8 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar private IIcon[] textures; private String name; public Item seedItem; - public ItemStack returnItem; + public Item returnItem; + public int returnMeta; private int minDropAmount; private int addDropAmount; @@ -48,25 +48,8 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar } @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune){ - ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); - if(metadata >= 7){ - for(int i = 0; i < 3; ++i){ - if(world.rand.nextInt(6) == 0) ret.add(new ItemStack(this.seedItem)); - } - - ItemStack stack = this.returnItem.copy(); - stack.stackSize = new Random().nextInt(addDropAmount)+minDropAmount; - ret.add(stack); - } - else ret.add(new ItemStack(this.seedItem)); - - return ret; - } - - @Override - public Item getItemDropped(int meta, Random rand, int i){ - return null; + public int quantityDropped(int meta, int fortune, Random random){ + return random.nextInt(addDropAmount)+minDropAmount; } @Override @@ -89,9 +72,24 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar return this.seedItem; } + @Override + public Item getItemDropped(int meta, Random rand, int par3){ + return meta >= 7 ? this.func_149865_P() : this.func_149866_i(); + } + @Override public Item func_149865_P(){ - return this.returnItem.getItem(); + return this.returnItem; + } + + @Override + public int damageDropped(int meta){ + return this.returnMeta; + } + + @Override + public int getDamageValue(World world, int x, int y, int z){ + return 0; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 6044ab5df..713d56dc8 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -64,9 +64,18 @@ public class InitBlocks{ public static Block blockPhantomBooster; + public static Block blockEnergizer; + public static Block blockEnervator; + public static void init(){ Util.logInfo("Initializing Blocks..."); + blockEnergizer = new BlockEnergizer(true); + BlockUtil.register(blockEnergizer, BlockEnergizer.TheItemBlock.class); + + blockEnervator = new BlockEnergizer(false); + BlockUtil.register(blockEnervator, BlockEnergizer.TheItemBlock.class); + blockLavaFactoryController = new BlockLavaFactoryController(); BlockUtil.register(blockLavaFactoryController, BlockLavaFactoryController.TheItemBlock.class); diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java index fac93403a..dc14d923a 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigCategories.java @@ -12,7 +12,8 @@ public enum ConfigCategories{ WORLD_GEN("world gen"), POTION_RING_CRAFTING("ring crafting"), OTHER("other"), - FLUIDS("fluids"); + FLUIDS("fluids"), + DRILL_VALUES("drill values"); public final String name; diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java index 58449b28f..530c36472 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java @@ -94,7 +94,18 @@ public enum ConfigCrafting{ ENDER_CASING("Ender Casing", ConfigCategories.BLOCKS_CRAFTING), PHANTOM_BOOSTER("Phantom Booster", ConfigCategories.BLOCKS_CRAFTING), COFFEE_MACHINE("Coffee Machine", ConfigCategories.BLOCKS_CRAFTING), - LAVA_FACTORY("Lava Factory", ConfigCategories.BLOCKS_CRAFTING); + LAVA_FACTORY("Lava Factory", ConfigCategories.BLOCKS_CRAFTING), + + DRILL("Drill", ConfigCategories.ITEMS_CRAFTING), + DRILL_SPEED("Drill Speed Upgrades", ConfigCategories.ITEMS_CRAFTING), + DRILL_FORTUNE("Drill Fortune Upgrades", ConfigCategories.ITEMS_CRAFTING), + DRILL_SIZE("Drill Size Upgrades", ConfigCategories.ITEMS_CRAFTING), + DRILL_PLACING("Drill Placing Upgrade", ConfigCategories.ITEMS_CRAFTING), + DRILL_SILK_TOUCH("Drill Silk Touch Upgrade", ConfigCategories.ITEMS_CRAFTING), + BATTERY("Battery", ConfigCategories.ITEMS_CRAFTING), + + ENERGIZER("Energizer", ConfigCategories.BLOCKS_CRAFTING), + ENERVATOR("Enervator", ConfigCategories.BLOCKS_CRAFTING); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java index 1af7ea863..e8d94df86 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java @@ -9,7 +9,9 @@ public enum ConfigFloatValues{ EMERALD_MAX_DAMAGE("Emerald: Damage", ConfigCategories.TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals"), OBSIDIAN_SPEED("Obsidian: Efficiency", ConfigCategories.TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are"), - OBSIDIAN_MAX_DAMAGE("Obsidian: Damage", ConfigCategories.TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals"); + OBSIDIAN_MAX_DAMAGE("Obsidian: Damage", ConfigCategories.TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals"), + + DRILL_DAMAGE("Drill: Default Damage", ConfigCategories.DRILL_VALUES, 8.0F, 1.0F, 30.0F, "How much Damage the Drill does to an Entity"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index f5b9fab72..5a2e05617 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -41,7 +41,7 @@ public enum ConfigIntValues{ REPAIRER_SPEED_SLOWDOWN("Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs"), HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"), - HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"), + HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 15000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"), GLASS_TIME_NEEDED("Greenhouse Glass: Time", ConfigCategories.MACHINE_VALUES, 300, 1, 10000, "Time Needed for the Greenhouse Glass to grow a Plant below it"), @@ -53,12 +53,12 @@ public enum ConfigIntValues{ RICE_AMOUNT("Rice Amount", ConfigCategories.WORLD_GEN, 15, 1, 100, "The Chance of Rice generating"), CANOLA_AMOUNT("Canola Amount", ConfigCategories.WORLD_GEN, 10, 1, 50, "The Chance of Canola generating"), FLAX_AMOUNT("Flax Amount", ConfigCategories.WORLD_GEN, 8, 1, 50, "The Chance of Flax generating"), - COFFEE_AMOUNT("Coffee Amount", ConfigCategories.WORLD_GEN, 4, 1, 50, "The Chance of Coffee generating"), + COFFEE_AMOUNT("Coffee Amount", ConfigCategories.WORLD_GEN, 6, 1, 50, "The Chance of Coffee generating"), GRINDER_ENERGY_USED("Energy Use: Crusher", ConfigCategories.MACHINE_VALUES, 40, 1, 500, "The Amount of Energy used by the Crusher per Tick"), GRINDER_DOUBLE_ENERGY_USED("Energy Use: Double Crusher", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy used by the Double Crusher per Tick"), FURNACE_SOLAR_ENERGY_PRODUCED("Energy Production: Furnace Solar", ConfigCategories.MACHINE_VALUES, 15, 1, 500, "The Amount of Energy produced by the Solar per Tick"), - HEAT_COLLECTOR_ENERGY_PRODUCED("Energy Production: Heat Collector", ConfigCategories.MACHINE_VALUES, 30, 1, 500, "The Amount of Energy produced by the Heat Collector per Tick"), + HEAT_COLLECTOR_ENERGY_PRODUCED("Energy Production: Heat Collectors", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy produced by the Heat Collector per Tick"), REPAIRER_ENERGY_USED("Energy Use: Repairer", ConfigCategories.MACHINE_VALUES, 1250, 1, 5000, "The Amount of Energy used by the Repairer per Tick"), FURNACE_ENERGY_USED("Energy Use: Double Furnace", ConfigCategories.MACHINE_VALUES, 25, 1, 500, "The Amount of Energy used by the Double Furnace per Tick"), @@ -87,7 +87,18 @@ public enum ConfigIntValues{ COFFEE_CACHE_USED_PER_ITEM("Coffee Machine: Coffee used per Cup", ConfigCategories.MACHINE_VALUES, 10, 1, 300, "The amount of Coffee used to brew one Coffee in the Coffee Machine"), COFFEE_MACHINE_TIME_USED("Coffee Machine: Time to Brew", ConfigCategories.MACHINE_VALUES, 500, 10, 10000, "The amount of time the Coffee Machine takes to brew a Coffee"), - COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from"); + COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from"), + + DRILL_ENERGY_USE("Drill: Energy Use Per Block or Hit", ConfigCategories.DRILL_VALUES, 100, 5, 10000, "How much Energy the Drill uses per Block"), + + DRILL_SPEED_EXTRA_USE("Speed Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 50, 0, 10000, "How much extra Energy the Speed Upgrade uses"), + DRILL_SPEED_II_EXTRA_USE("Speed II Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 75, 0, 10000, "How much extra Energy the Speed II Upgrade uses"), + DRILL_SPEED_III_EXTRA_USE("Speed III Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 175, 0, 10000, "How much extra Energy the Speed III Upgrade uses"), + DRILL_SILK_EXTRA_USE("Silk Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 30, 0, 10000, "How much extra Energy the Silk Upgrade uses"), + DRILL_FORTUNE_EXTRA_USE("Fortune Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 40, 0, 10000, "How much extra Energy the Fortune Upgrade uses"), + DRILL_FORTUNE_II_EXTRA_USE("Fortune II Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 60, 0, 10000, "How much extra Energy the Fortune II Upgrade uses"), + DRILL_THREE_BY_THREE_EXTRA_USE("3x3 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 10, 0, 10000, "How much extra Energy the 3x3 Upgrade uses"), + DRILL_FIVE_BY_FIVE_EXTRA_USE("5x5 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 30, 0, 10000, "How much extra Energy the 5x5 Upgrade uses"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 23cc69130..5814ccdfb 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -64,6 +64,22 @@ public class BlockCrafting{ 'S', TheMiscBlocks.STONE_CASING.getOredictName(), 'A', TheMiscItems.COIL.getOredictName())); + //Energizer + if(ConfigCrafting.ENERGIZER.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockEnergizer), + "I I", "CAC", "I I", + 'I', "ingotIron", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName(), + 'A', TheMiscBlocks.STONE_CASING.getOredictName())); + + //Energizer + if(ConfigCrafting.ENERVATOR.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockEnervator), + " I ", "CAC", " I ", + 'I', "ingotIron", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName(), + 'A', TheMiscBlocks.STONE_CASING.getOredictName())); + //Lava Factory if(ConfigCrafting.LAVA_FACTORY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLavaFactoryController), diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java index 3ef1a8d0b..28a62a506 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java @@ -13,34 +13,31 @@ import net.minecraft.item.ItemStack; public class GrinderCrafting{ - private static GrinderRecipeRegistry grindRecReg = GrinderRecipeRegistry.instance(); - private static GrinderRecipes grindRec = GrinderRecipes.instance(); - public static void init(){ Util.logInfo("Initializing Crusher Recipes..."); - grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10)); - grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal())); - grindRec.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal())); - grindRec.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal())); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10)); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal())); + GrinderRecipes.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal())); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal())); - grindRec.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand)); - grindRec.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); - grindRec.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone)); - grindRec.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2)); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand)); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); + GrinderRecipes.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone)); + GrinderRecipes.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2)); - grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); - grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); + GrinderRecipes.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); + GrinderRecipes.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); - grindRecReg.searchCases.add(new SearchCase("oreNether", 6)); - grindRecReg.searchCases.add(new SearchCase("denseore", 8)); - grindRecReg.searchCases.add(new SearchCase("ingot", 1)); - grindRecReg.searchCases.add(new SearchCase("gem", 1)); - grindRecReg.searchCases.add(new SearchCase("ore", 2)); + GrinderRecipeRegistry.searchCases.add(new SearchCase("oreNether", 6)); + GrinderRecipeRegistry.searchCases.add(new SearchCase("denseore", 8)); + GrinderRecipeRegistry.searchCases.add(new SearchCase("gem", 1)); + GrinderRecipeRegistry.searchCases.add(new SearchCase("ingot", 1)); + GrinderRecipeRegistry.searchCases.add(new SearchCase("ore", 2)); - grindRecReg.exceptions.add("ingotBrick"); - grindRecReg.exceptions.add("ingotBrickNether"); + GrinderRecipeRegistry.exceptions.add("ingotBrick"); + GrinderRecipeRegistry.exceptions.add("ingotBrickNether"); - grindRecReg.registerFinally(); + GrinderRecipeRegistry.registerFinally(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 5cde60751..b09a62682 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -8,11 +8,13 @@ import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.*; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.Util; +import net.minecraft.block.IGrowable; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.IPlantable; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; @@ -44,6 +46,91 @@ public class ItemCrafting{ 'P', new ItemStack(Blocks.piston), 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); + //Drill + if(ConfigCrafting.DRILL.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill), + "DDD", "CRC", "III", + 'D', "gemDiamond", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName(), + 'R', "dustRedstone", + 'I', "blockIron")); + + //Drill Speed + if(ConfigCrafting.DRILL_SPEED.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeed), + "ISI", "SRS", "ISI", + 'I', "ingotIron", + 'S', Items.sugar, + 'R', "dustRedstone")); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedII), + "ISI", "SCS", "ISI", + 'I', "ingotIron", + 'S', Items.sugar, + 'C', Items.cake)); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedIII), + "ISI", "SFS", "ISI", + 'I', "ingotIron", + 'S', Items.sugar, + 'F', "gemDiamond")); + } + + //Drill Fortune + if(ConfigCrafting.DRILL_FORTUNE.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortune), + "ISI", "SRS", "ISI", + 'I', Blocks.glowstone, + 'S', Items.redstone, + 'R', Blocks.diamond_block)); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortuneII), + "ISI", "SRS", "ISI", + 'I', Blocks.glowstone, + 'S', Items.redstone, + 'R', TheMiscBlocks.ENDER_CASING.getOredictName())); + } + + //Drill Size + if(ConfigCrafting.DRILL_SIZE.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeThreeByThree), + "DID", "ICI", "DID", + 'I', "ingotIron", + 'D', "gemDiamond", + 'C', TheMiscItems.COIL.getOredictName())); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFiveByFive), + "DID", "ICI", "DID", + 'I', "ingotIron", + 'D', "gemDiamond", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); + } + + //Drill Silk Touch + if(ConfigCrafting.DRILL_SILK_TOUCH.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSilkTouch), + "DSD", "SCS", "DSD", + 'D', "gemEmerald", + 'S', "gemDiamond", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); + + //Drill Placing + if(ConfigCrafting.DRILL_PLACING.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing), + "CEC", "RAR", "CEC", + 'C', "cobblestone", + 'E', Items.ender_pearl, + 'A', TheMiscItems.COIL.getOredictName(), + 'R', "ingotIron")); + + //Battery + if(ConfigCrafting.BATTERY.isEnabled()) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBattery), + " R ", "ICI", "III", + 'R', "dustRedstone", + 'I', "ingotIron", + 'C', TheMiscItems.COIL_ADVANCED.getOredictName())); + //Coil if(ConfigCrafting.COIL.isEnabled()) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), @@ -174,10 +261,6 @@ public class ItemCrafting{ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())); - //Mashed Food - if(ConfigCrafting.MASHED_FOOD.isEnabled()) - initMashedFoodRecipes(); - //Rings initPotionRingRecipes(); @@ -226,10 +309,12 @@ public class ItemCrafting{ } public static void initMashedFoodRecipes(){ - for(Object nextIterator : Item.itemRegistry){ - if(nextIterator instanceof ItemFood){ - ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 12, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + if(ConfigCrafting.MASHED_FOOD.isEnabled()){ + for(Object nextIterator : Item.itemRegistry){ + if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){ + ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 156f8d699..aa6dea2ba 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -26,89 +26,103 @@ public class CreativeTab extends CreativeTabs{ public void displayAllReleventItems(List list){ this.list = list; - 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); + add(InitBlocks.blockPhantomface); + add(InitBlocks.blockPhantomEnergyface); + add(InitBlocks.blockPhantomLiquiface); + add(InitBlocks.blockPhantomPlacer); + add(InitBlocks.blockPhantomBreaker); + add(InitBlocks.blockPhantomBooster); + add(InitBlocks.blockCoffeeMachine); + add(InitBlocks.blockInputter); + add(InitBlocks.blockInputterAdvanced); - addBlock(InitBlocks.blockGreenhouseGlass); - addBlock(InitBlocks.blockGrinder); - addBlock(InitBlocks.blockGrinderDouble); - addBlock(InitBlocks.blockFurnaceDouble); - addBlock(InitBlocks.blockLavaFactoryController); + add(InitBlocks.blockGreenhouseGlass); + add(InitBlocks.blockGrinder); + add(InitBlocks.blockGrinderDouble); + add(InitBlocks.blockFurnaceDouble); + add(InitBlocks.blockLavaFactoryController); - 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); + add(InitBlocks.blockEnergizer); + add(InitBlocks.blockEnervator); - addBlock(InitBlocks.blockMisc); - addBlock(InitBlocks.blockFeeder); - addBlock(InitBlocks.blockCompost); - addBlock(InitBlocks.blockGiantChest); - addBlock(InitBlocks.blockCanolaPress); - addBlock(InitBlocks.blockFermentingBarrel); + add(InitBlocks.blockFurnaceSolar); + add(InitBlocks.blockHeatCollector); + add(InitBlocks.blockCoalGenerator); + add(InitBlocks.blockOilGenerator); + add(InitBlocks.blockItemRepairer); + add(InitBlocks.blockFishingNet); + add(InitBlocks.blockBreaker); + add(InitBlocks.blockPlacer); + add(InitBlocks.blockDropper); + add(InitBlocks.blockFluidPlacer); + add(InitBlocks.blockFluidCollector); - //addItem(InitItems.itemDrill); - addItem(InitItems.itemPhantomConnector); - addItem(InitItems.itemBucketCanolaOil); - addItem(InitItems.itemBucketOil); + add(InitBlocks.blockMisc); + add(InitBlocks.blockFeeder); + add(InitBlocks.blockCompost); + add(InitBlocks.blockGiantChest); + add(InitBlocks.blockCanolaPress); + add(InitBlocks.blockFermentingBarrel); - 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); + add(InitItems.itemDrill); + add(InitItems.itemDrillUpgradeSpeed); + add(InitItems.itemDrillUpgradeSpeedII); + add(InitItems.itemDrillUpgradeSpeedIII); + add(InitItems.itemDrillUpgradeSilkTouch); + add(InitItems.itemDrillUpgradeFortune); + add(InitItems.itemDrillUpgradeFortuneII); + add(InitItems.itemDrillUpgradeThreeByThree); + add(InitItems.itemDrillUpgradeFiveByFive); + add(InitItems.itemDrillUpgradeBlockPlacing); + add(InitItems.itemBattery); + + add(InitItems.itemPhantomConnector); + add(InitItems.itemBucketCanolaOil); + add(InitItems.itemBucketOil); - addItem(InitItems.itemCoffee); - addItem(InitItems.itemFoods); - addItem(InitItems.itemKnife); - addItem(InitItems.itemCrafterOnAStick); - addItem(InitItems.itemDust); - addItem(InitItems.itemSpecialDrop); - addItem(InitItems.itemLeafBlower); - addItem(InitItems.itemLeafBlowerAdvanced); + add(InitItems.itemCoffeeSeed); + add(InitItems.itemCoffeeBean); + add(InitItems.itemRiceSeed); + add(InitItems.itemCanolaSeed); + add(InitItems.itemFlaxSeed); + add(InitItems.itemHairyBall); + add(InitItems.itemMisc); + add(InitItems.itemResonantRice); + add(InitItems.itemFertilizer); - addItem(InitItems.woodenPaxel); - addItem(InitItems.stonePaxel); - addItem(InitItems.ironPaxel); - addItem(InitItems.goldPaxel); - addItem(InitItems.diamondPaxel); - addItem(InitItems.emeraldPaxel); - addItem(InitItems.obsidianPaxel); + add(InitItems.itemCoffee); + add(InitItems.itemFoods); + add(InitItems.itemKnife); + add(InitItems.itemCrafterOnAStick); + add(InitItems.itemDust); + add(InitItems.itemSpecialDrop); + add(InitItems.itemLeafBlower); + add(InitItems.itemLeafBlowerAdvanced); - addItem(InitItems.itemPickaxeEmerald); - addItem(InitItems.itemSwordEmerald); - addItem(InitItems.itemAxeEmerald); - addItem(InitItems.itemShovelEmerald); - addItem(InitItems.itemHoeEmerald); + add(InitItems.woodenPaxel); + add(InitItems.stonePaxel); + add(InitItems.ironPaxel); + add(InitItems.goldPaxel); + add(InitItems.diamondPaxel); + add(InitItems.emeraldPaxel); + add(InitItems.obsidianPaxel); - addItem(InitItems.itemPickaxeObsidian); - addItem(InitItems.itemSwordObsidian); - addItem(InitItems.itemAxeObsidian); - addItem(InitItems.itemShovelObsidian); - addItem(InitItems.itemHoeObsidian); + add(InitItems.itemPickaxeEmerald); + add(InitItems.itemSwordEmerald); + add(InitItems.itemAxeEmerald); + add(InitItems.itemShovelEmerald); + add(InitItems.itemHoeEmerald); - addItem(InitItems.itemPotionRing); - addItem(InitItems.itemPotionRingAdvanced); + add(InitItems.itemPickaxeObsidian); + add(InitItems.itemSwordObsidian); + add(InitItems.itemAxeObsidian); + add(InitItems.itemShovelObsidian); + add(InitItems.itemHoeObsidian); - addItem(InitItems.itemJams); + add(InitItems.itemPotionRing); + add(InitItems.itemPotionRingAdvanced); + + add(InitItems.itemJams); } @Override @@ -121,11 +135,11 @@ public class CreativeTab extends CreativeTabs{ return new ItemStack(this.getTabIconItem()); } - private void addItem(Item item){ + private void add(Item item){ item.getSubItems(item, instance, list); } - private void addBlock(Block block){ + private void add(Block block){ block.getSubBlocks(new ItemStack(block).getItem(), instance, list); } } diff --git a/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java index 8cee0c841..e3b287914 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java @@ -55,7 +55,7 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa } public void addWants(String oredictName, int minSize, int maxSize){ - ArrayList stacks = OreDictionary.getOres(oredictName); + ArrayList stacks = (ArrayList)OreDictionary.getOres(oredictName, false); trades.add(new Trade(stacks, minSize, maxSize)); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java new file mode 100644 index 000000000..5d5281aa7 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java @@ -0,0 +1,195 @@ +package ellpeck.actuallyadditions.inventory; + +import ellpeck.actuallyadditions.inventory.slot.SlotImmovable; +import ellpeck.actuallyadditions.items.ItemDrill; +import ellpeck.actuallyadditions.items.ItemDrillUpgrade; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +@InventoryContainer +public class ContainerDrill extends Container{ + + private static final int SLOT_AMOUNT = 5; + + private InventoryDrill drillInventory = new InventoryDrill(); + private InventoryPlayer inventory; + + public ContainerDrill(InventoryPlayer inventory){ + this.inventory = inventory; + + for(int i = 0; i < SLOT_AMOUNT; i++){ + this.addSlotToContainer(new Slot(drillInventory, i, 44+i*18, 19){ + @Override + public boolean isItemValid(ItemStack stack){ + return stack.getItem() instanceof ItemDrillUpgrade; + } + }); + } + + for(int i = 0; i < 3; i++){ + for(int j = 0; j < 9; j++){ + this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 58+i*18)); + } + } + for(int i = 0; i < 9; i++){ + if(i == inventory.currentItem) this.addSlotToContainer(new SlotImmovable(inventory, i, 8+i*18, 116)); + else this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 116)); + } + + ItemStack stack = inventory.getCurrentItem(); + if(stack != null && stack.getItem() instanceof ItemDrill){ + ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem()); + if(slots != null && slots.length > 0) this.drillInventory.slots = slots; + } + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.drillInventory.isUseableByPlayer(player); + } + + @Override + public void onContainerClosed(EntityPlayer player){ + ItemStack stack = inventory.getCurrentItem(); + if(stack != null && stack.getItem() instanceof ItemDrill){ + ((ItemDrill)stack.getItem()).writeSlotsToNBT(this.drillInventory.slots, inventory.getCurrentItem()); + } + super.onContainerClosed(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 5; + final int inventoryEnd = inventoryStart+26; + final int hotbarStart = inventoryEnd+1; + final int hotbarEnd = hotbarStart+8; + + Slot theSlot = (Slot)this.inventorySlots.get(slot); + if(theSlot.getHasStack()){ + ItemStack currentStack = theSlot.getStack(); + ItemStack newStack = currentStack.copy(); + + if(currentStack.getItem() != null){ + if(slot <= hotbarEnd && slot >= inventoryStart){ + if(currentStack.getItem() instanceof ItemDrillUpgrade){ + this.mergeItemStack(newStack, 0, SLOT_AMOUNT, false); + } + } + + if(slot <= hotbarEnd && slot >= hotbarStart){ + this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false); + } + + else if(slot <= inventoryEnd && slot >= inventoryStart){ + this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false); + } + + else if(slot < inventoryStart){ + this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); + } + + if(newStack.stackSize == 0) theSlot.putStack(null); + else theSlot.onSlotChanged(); + if(newStack.stackSize == currentStack.stackSize) return null; + theSlot.onPickupFromSlot(player, newStack); + + return currentStack; + } + } + return null; + } + + public static class InventoryDrill implements IInventory{ + + public ItemStack[] slots = new ItemStack[SLOT_AMOUNT]; + + @Override + public String getInventoryName(){ + return "drill"; + } + + @Override + public boolean hasCustomInventoryName(){ + return false; + } + + @Override + public int getInventoryStackLimit(){ + return 64; + } + + @Override + public void markDirty(){ + + } + + @Override + public void openInventory(){ + + } + + @Override + public void closeInventory(){ + + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack){ + return true; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player){ + return true; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i){ + return getStackInSlot(i); + } + + @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; + } + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java new file mode 100644 index 000000000..c050deaea --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java @@ -0,0 +1,109 @@ +package ellpeck.actuallyadditions.inventory; + +import cofh.api.energy.IEnergyContainerItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.slot.SlotOutput; +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityEnergizer; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +@InventoryContainer +public class ContainerEnergizer extends Container{ + + private TileEntityEnergizer energizer; + + private int lastEnergyStored; + + public ContainerEnergizer(InventoryPlayer inventory, TileEntityBase tile){ + this.energizer = (TileEntityEnergizer)tile; + + this.addSlotToContainer(new Slot(this.energizer, 0, 76, 73)); + this.addSlotToContainer(new SlotOutput(this.energizer, 1, 76, 42)); + + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 9; j++){ + this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); + } + } + for (int i = 0; i < 9; i++){ + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.energizer.isUseableByPlayer(player); + } + + @Override + public void addCraftingToCrafters(ICrafting iCraft){ + super.addCraftingToCrafters(iCraft); + iCraft.sendProgressBarUpdate(this, 0, this.energizer.getEnergyStored(ForgeDirection.UNKNOWN)); + } + + @Override + public void detectAndSendChanges(){ + super.detectAndSendChanges(); + for(Object crafter : this.crafters){ + ICrafting iCraft = (ICrafting)crafter; + + if(this.lastEnergyStored != this.energizer.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.energizer.getEnergyStored(ForgeDirection.UNKNOWN)); + } + + this.lastEnergyStored = this.energizer.getEnergyStored(ForgeDirection.UNKNOWN); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2){ + if(par1 == 0) this.energizer.storage.setEnergyStored(par2); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 2; + final int inventoryEnd = inventoryStart+26; + final int hotbarStart = inventoryEnd+1; + final int hotbarEnd = hotbarStart+8; + + Slot theSlot = (Slot)this.inventorySlots.get(slot); + if(theSlot.getHasStack()){ + ItemStack currentStack = theSlot.getStack(); + ItemStack newStack = currentStack.copy(); + + if(slot <= hotbarEnd && slot >= inventoryStart){ + if(currentStack.getItem() instanceof IEnergyContainerItem){ + this.mergeItemStack(newStack, 0, 1, false); + } + } + + if(slot <= hotbarEnd && slot >= hotbarStart){ + this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false); + } + + else if(slot <= inventoryEnd && slot >= inventoryStart){ + this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false); + } + + else if(slot < inventoryStart){ + this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); + } + + if(newStack.stackSize == 0) theSlot.putStack(null); + else theSlot.onSlotChanged(); + if(newStack.stackSize == currentStack.stackSize) return null; + theSlot.onPickupFromSlot(player, newStack); + + return currentStack; + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java new file mode 100644 index 000000000..b9497be95 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java @@ -0,0 +1,109 @@ +package ellpeck.actuallyadditions.inventory; + +import cofh.api.energy.IEnergyContainerItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.slot.SlotOutput; +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityEnervator; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +@InventoryContainer +public class ContainerEnervator extends Container{ + + private TileEntityEnervator enervator; + + private int lastEnergyStored; + + public ContainerEnervator(InventoryPlayer inventory, TileEntityBase tile){ + this.enervator = (TileEntityEnervator)tile; + + this.addSlotToContainer(new Slot(this.enervator, 0, 76, 73)); + this.addSlotToContainer(new SlotOutput(this.enervator, 1, 76, 42)); + + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 9; j++){ + this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); + } + } + for (int i = 0; i < 9; i++){ + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.enervator.isUseableByPlayer(player); + } + + @Override + public void addCraftingToCrafters(ICrafting iCraft){ + super.addCraftingToCrafters(iCraft); + iCraft.sendProgressBarUpdate(this, 0, this.enervator.getEnergyStored(ForgeDirection.UNKNOWN)); + } + + @Override + public void detectAndSendChanges(){ + super.detectAndSendChanges(); + for(Object crafter : this.crafters){ + ICrafting iCraft = (ICrafting)crafter; + + if(this.lastEnergyStored != this.enervator.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.enervator.getEnergyStored(ForgeDirection.UNKNOWN)); + } + + this.lastEnergyStored = this.enervator.getEnergyStored(ForgeDirection.UNKNOWN); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2){ + if(par1 == 0) this.enervator.storage.setEnergyStored(par2); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 2; + final int inventoryEnd = inventoryStart+26; + final int hotbarStart = inventoryEnd+1; + final int hotbarEnd = hotbarStart+8; + + Slot theSlot = (Slot)this.inventorySlots.get(slot); + if(theSlot.getHasStack()){ + ItemStack currentStack = theSlot.getStack(); + ItemStack newStack = currentStack.copy(); + + if(slot <= hotbarEnd && slot >= inventoryStart){ + if(currentStack.getItem() instanceof IEnergyContainerItem){ + this.mergeItemStack(newStack, 0, 1, false); + } + } + + if(slot <= hotbarEnd && slot >= hotbarStart){ + this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false); + } + + else if(slot <= inventoryEnd && slot >= inventoryStart){ + this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false); + } + + else if(slot < inventoryStart){ + this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); + } + + if(newStack.stackSize == 0) theSlot.putStack(null); + else theSlot.onSlotChanged(); + if(newStack.stackSize == currentStack.stackSize) return null; + theSlot.onPickupFromSlot(player, newStack); + + return currentStack; + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index 9047d05d0..e81b1d0af 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -104,7 +104,7 @@ public class ContainerGrinder extends Container{ if(currentStack.getItem() != null){ if(slot <= hotbarEnd && slot >= inventoryStart){ - if(GrinderRecipes.instance().getOutput(currentStack, false) != null){ + if(GrinderRecipes.getOutput(currentStack, false) != null){ this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false); if(this.isDouble) this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index ef5d7ad73..74204e0e7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -54,6 +54,12 @@ public class GuiHandler implements IGuiHandler{ return new ContainerFluidCollector(entityPlayer.inventory, tile); case COFFEE_MACHINE_ID: return new ContainerCoffeeMachine(entityPlayer.inventory, tile); + case DRILL_ID: + return new ContainerDrill(entityPlayer.inventory); + case ENERGIZER_ID: + return new ContainerEnergizer(entityPlayer.inventory, tile); + case ENERVATOR_ID: + return new ContainerEnervator(entityPlayer.inventory, tile); default: return null; } @@ -102,6 +108,12 @@ 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 DRILL_ID: + return new GuiDrill(entityPlayer.inventory); + case ENERGIZER_ID: + return new GuiEnergizer(entityPlayer.inventory, tile); + case ENERVATOR_ID: + return new GuiEnervator(entityPlayer.inventory, tile); default: return null; } @@ -126,6 +138,8 @@ public class GuiHandler implements IGuiHandler{ 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 ENERGIZER_ID = 19; + public static final int ENERVATOR_ID = 20; public static void init(){ Util.logInfo("Initializing GuiHandler..."); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDrill.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDrill.java new file mode 100644 index 000000000..3c63f9f75 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDrill.java @@ -0,0 +1,39 @@ +package ellpeck.actuallyadditions.inventory.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.ContainerDrill; +import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiDrill extends GuiContainer{ + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiDrill"); + + public GuiDrill(InventoryPlayer inventory){ + super(new ContainerDrill(inventory)); + this.xSize = 176; + this.ySize = 54+86; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".drill"); + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+54, 0, 0, 176, 86); + + this.mc.getTextureManager().bindTexture(resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 54); + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java new file mode 100644 index 000000000..19cc34336 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java @@ -0,0 +1,60 @@ +package ellpeck.actuallyadditions.inventory.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.ContainerEnergizer; +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityEnergizer; +import ellpeck.actuallyadditions.util.AssetUtil; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.ForgeDirection; +import org.lwjgl.opengl.GL11; + +import java.util.Collections; + +@SideOnly(Side.CLIENT) +public class GuiEnergizer extends GuiContainer{ + + private TileEntityEnergizer energizer; + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); + + public GuiEnergizer(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerEnergizer(inventory, tile)); + this.energizer = (TileEntityEnergizer)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.energizer.getInventoryName()); + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); + + this.mc.getTextureManager().bindTexture(resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + + if(this.energizer.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ + int i = this.energizer.getEnergyScaled(83); + drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i); + } + } + + @Override + public void drawScreen(int x, int y, float f){ + super.drawScreen(x, y, f); + String text1 = this.energizer.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.energizer.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF"; + if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){ + this.func_146283_a(Collections.singletonList(text1), x, y); + } + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java new file mode 100644 index 000000000..215fe9909 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java @@ -0,0 +1,60 @@ +package ellpeck.actuallyadditions.inventory.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.inventory.ContainerEnervator; +import ellpeck.actuallyadditions.tile.TileEntityBase; +import ellpeck.actuallyadditions.tile.TileEntityEnervator; +import ellpeck.actuallyadditions.util.AssetUtil; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.ForgeDirection; +import org.lwjgl.opengl.GL11; + +import java.util.Collections; + +@SideOnly(Side.CLIENT) +public class GuiEnervator extends GuiContainer{ + + private TileEntityEnervator enervator; + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); + + public GuiEnervator(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerEnervator(inventory, tile)); + this.enervator = (TileEntityEnervator)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.enervator.getInventoryName()); + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); + + this.mc.getTextureManager().bindTexture(resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + + if(this.enervator.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ + int i = this.enervator.getEnergyScaled(83); + drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i); + } + } + + @Override + public void drawScreen(int x, int y, float f){ + super.drawScreen(x, y, f); + String text1 = this.enervator.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.enervator.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF"; + if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){ + this.func_146283_a(Collections.singletonList(text1), x, y); + } + } +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java new file mode 100644 index 000000000..5a84544b4 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java @@ -0,0 +1,24 @@ +package ellpeck.actuallyadditions.inventory.slot; + +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 canTakeStack(EntityPlayer player){ + return false; + } + + @Override + public boolean isItemValid(ItemStack stack){ + return false; + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index 1f48e906a..8340eb3c9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -69,13 +69,38 @@ public class InitItems{ public static Item emeraldPaxel; public static Item obsidianPaxel; - //public static Item itemDrill; + public static Item itemDrill; + public static Item itemDrillUpgradeSpeed; + public static Item itemDrillUpgradeSpeedII; + public static Item itemDrillUpgradeSpeedIII; + public static Item itemDrillUpgradeSilkTouch; + public static Item itemDrillUpgradeFortune; + public static Item itemDrillUpgradeFortuneII; + public static Item itemDrillUpgradeThreeByThree; + public static Item itemDrillUpgradeFiveByFive; + public static Item itemDrillUpgradeBlockPlacing; + + public static Item itemBattery; public static void init(){ Util.logInfo("Initializing Items..."); - //itemDrill = new ItemDrill(); - //ItemUtil.register(itemDrill); + itemDrill = new ItemDrill(); + ItemUtil.register(itemDrill); + + itemBattery = new ItemBattery(); + ItemUtil.register(itemBattery); + + itemDrillUpgradeSpeed = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED, "itemDrillUpgradeSpeed"); + itemDrillUpgradeSpeedII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II, "itemDrillUpgradeSpeedII"); + itemDrillUpgradeSpeedIII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_III, "itemDrillUpgradeSpeedIII"); + itemDrillUpgradeSilkTouch = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SILK_TOUCH, "itemDrillUpgradeSilkTouch"); + itemDrillUpgradeFortune = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE, "itemDrillUpgradeFortune"); + itemDrillUpgradeFortuneII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE_II, "itemDrillUpgradeFortuneII"); + itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree"); + itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive"); + itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing"); + ItemUtil.registerItems(new Item[]{itemDrillUpgradeSpeed, itemDrillUpgradeSpeedII, itemDrillUpgradeSpeedIII, itemDrillUpgradeSilkTouch, itemDrillUpgradeFortune, itemDrillUpgradeFortuneII, itemDrillUpgradeThreeByThree, itemDrillUpgradeFiveByFive, itemDrillUpgradeBlockPlacing}); itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil"); ItemUtil.register(itemBucketOil); @@ -88,6 +113,9 @@ public class InitItems{ itemFertilizer = new ItemFertilizer(); ItemUtil.register(itemFertilizer); + itemCoffee = new ItemCoffee(); + ItemUtil.register(itemCoffee); + itemPhantomConnector = new ItemPhantomConnector(); ItemUtil.register(itemPhantomConnector); @@ -134,19 +162,19 @@ public class InitItems{ itemCoffeeBean = new ItemCoffeeBean(); ItemUtil.register(itemCoffeeBean); - itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal())); + itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, itemFoods, TheFoods.RICE.ordinal()); ItemUtil.register(itemRiceSeed); FactoryRegistry.sendMessage("registerPlantable", itemRiceSeed); - itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemMisc, 1, TheMiscItems.CANOLA.ordinal())); + itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, itemMisc, TheMiscItems.CANOLA.ordinal()); ItemUtil.register(itemCanolaSeed); FactoryRegistry.sendMessage("registerPlantable", itemCanolaSeed); - itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Blocks.grass, EnumPlantType.Plains, new ItemStack(Items.string)); + itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Blocks.grass, EnumPlantType.Plains, Items.string, 0); ItemUtil.register(itemFlaxSeed); FactoryRegistry.sendMessage("registerPlantable", itemFlaxSeed); - itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemCoffeeBean)); + itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, itemCoffeeBean, 0); ItemUtil.register(itemCoffeeSeed); FactoryRegistry.sendMessage("registerPlantable", itemCoffeeSeed); @@ -172,8 +200,5 @@ public class InitItems{ emeraldPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.epic); obsidianPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.epic); ItemUtil.registerItems(new Item[]{woodenPaxel, stonePaxel, ironPaxel, goldPaxel, diamondPaxel, emeraldPaxel, obsidianPaxel}); - - itemCoffee = new ItemCoffee(); - ItemUtil.register(itemCoffee); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java new file mode 100644 index 000000000..80df95194 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java @@ -0,0 +1,107 @@ +package ellpeck.actuallyadditions.items; + +import cofh.api.energy.ItemEnergyContainer; +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.creativetab.CreativeTabs; +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.util.IIcon; +import net.minecraft.world.World; + +import java.util.List; + +public class ItemBattery extends ItemEnergyContainer implements INameableItem{ + + public ItemBattery(){ + super(1000000, 10000); + this.setMaxStackSize(1); + this.setHasSubtypes(true); + } + + @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 EnumRarity getRarity(ItemStack stack){ + return EnumRarity.rare; + } + + @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); + } + + @Override + @SuppressWarnings("unchecked") + @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); + } + + @Override + public String getName(){ + return "itemBattery"; + } + + @Override + public String getOredictName(){ + return this.getName(); + } + + @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()){ + list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF"); + } + } + + @Override + public boolean getShareTag(){ + return true; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index 1e7923346..e12140994 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -6,29 +6,34 @@ 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.config.values.ConfigFloatValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.items.tools.ItemAllToolAA; -import ellpeck.actuallyadditions.util.*; +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; 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.entity.player.InventoryPlayer; 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.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import org.apache.logging.log4j.Level; import java.util.ArrayList; import java.util.HashSet; @@ -45,15 +50,13 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ } public ItemDrill(){ - super(500000); + super(500000, 5000); this.setMaxStackSize(1); this.setHasSubtypes(true); } - public static float defaultEfficiency = 8.0F; - public static int energyUsePerBlockOrHit = 100; - - public float efficiency = defaultEfficiency; + public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue(); + public static int energyUsePerBlockOrHit = ConfigIntValues.DRILL_ENERGY_USE.getValue(); @Override public double getDurabilityForDisplay(ItemStack stack){ @@ -62,6 +65,37 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ return energyDif/maxAmount; } + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){ + ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); + if(upgrade != null){ + int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); + if(slot >= 0 && slot < InventoryPlayer.getHotbarSize() && slot != player.inventory.currentItem){ + ItemStack equip = player.inventory.getStackInSlot(slot); + if(equip != null){ + if(!world.isRemote){ + boolean placed = false; + try{ + placed = equip.tryPlaceItemIntoWorld(player, world, x, y, z, hitSide, hitX, hitY, hitZ); + } + catch(Exception e){ + player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!")); + ModUtil.LOGGER.log(Level.ERROR, "Player "+player.getDisplayName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!"); + } + + if(placed){ + player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy()); + player.inventoryContainer.detectAndSendChanges(); + return true; + } + } + else return true; + } + } + } + return false; + } + @Override public boolean showDurabilityBar(ItemStack itemStack){ return true; @@ -72,57 +106,44 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ this.setEnergy(stack, 0); } - @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ - this.addEnchantFromUpgrade(Enchantment.silkTouch, ItemDrillUpgrade.UpgradeType.SILK_TOUCH, stack, 1); - this.addEnchantFromUpgrade(Enchantment.fortune, ItemDrillUpgrade.UpgradeType.FORTUNE, stack, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); - } - - public void addEnchantFromUpgrade(Enchantment enchantment, ItemDrillUpgrade.UpgradeType upgrade, ItemStack stack, int level){ - boolean hasEnchant = this.hasEnchantment(stack, enchantment) >= 0; - if(this.getHasUpgrade(stack, upgrade)){ - if(!hasEnchant){ - stack.addEnchantment(enchantment, level); + public float getEfficiencyFromUpgrade(ItemStack stack){ + float efficiency = defaultEfficiency; + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){ + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){ + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)) efficiency += 37.0F; + else efficiency += 28.0F; } + else efficiency += 15.0F; } - else if(hasEnchant) this.removeEnchantment(stack, enchantment); + return efficiency; } public int getEnergyUsePerBlock(ItemStack stack){ int use = energyUsePerBlockOrHit; - ItemDrillUpgrade.UpgradeType[] types = ItemDrillUpgrade.UpgradeType.values(); - for(ItemDrillUpgrade.UpgradeType type : types){ - if(this.getHasUpgrade(stack, type)){ - use += type.extraEnergy; + + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){ + use += ConfigIntValues.DRILL_SPEED_EXTRA_USE.getValue(); + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){ + use += ConfigIntValues.DRILL_SPEED_II_EXTRA_USE.getValue(); + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)) use += ConfigIntValues.DRILL_SPEED_III_EXTRA_USE.getValue(); } } + + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)) use += ConfigIntValues.DRILL_SILK_EXTRA_USE.getValue(); + + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ + use += ConfigIntValues.DRILL_FORTUNE_EXTRA_USE.getValue(); + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)) use += ConfigIntValues.DRILL_FORTUNE_II_EXTRA_USE.getValue(); + } + + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ + use += ConfigIntValues.DRILL_THREE_BY_THREE_EXTRA_USE.getValue(); + if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) use += ConfigIntValues.DRILL_FIVE_BY_FIVE_EXTRA_USE.getValue(); + } + return use; } - 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){ @@ -135,21 +156,22 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ } public boolean getHasUpgrade(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){ - if(upgrade == ItemDrillUpgrade.UpgradeType.THREE_BY_THREE) return true; - if(upgrade == ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE) return true; + return this.getHasUpgradeAsStack(stack, upgrade) != null; + } + public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) return false; + if(compound == null) return null; 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; + if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return slotStack; } } } - return false; + return null; } @Override @@ -222,12 +244,12 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ return slots; } - public void breakBlocks(ItemStack stack, int radius, World world, int x, int y, int z, Entity entity){ + public void breakBlocks(ItemStack stack, int radius, World world, int x, int y, int z, EntityPlayer player){ int xRange = radius; int yRange = radius; int zRange = 0; - MovingObjectPosition pos = WorldUtil.raytraceBlocksFromEntity(world, entity, 4.5D); + MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, false); if(pos != null){ int side = pos.sideHit; if(side == 0 || side == 1){ @@ -246,24 +268,29 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ if(this.getEnergyStored(stack) >= use){ 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)){ + if(hardness > -1.0F && this.canHarvestBlock(block, stack)){ this.extractEnergy(stack, use, 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)){ + if(block.canSilkHarvest(world, player, xPos, yPos, zPos, meta) && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ 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))); + int fortune = this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE) ? (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1) : 0; + drops.addAll(block.getDrops(world, xPos, yPos, zPos, meta, fortune)); + block.dropXpOnBlockBreak(world, x, y, z, block.getExpDrop(world, meta, fortune)); } - world.playAuxSFX(2001, xPos, yPos, zPos, Block.getIdFromBlock(block)+(meta << 12)); + if(!(x == xPos && y == yPos && z == zPos)){ + 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)); + EntityItem item = new EntityItem(world, xPos+0.5, yPos+0.5, zPos+0.5, theDrop); + item.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(item); } } } @@ -286,17 +313,18 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ @Override public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase living){ - int use = this.getEnergyUsePerBlock(stack); - if(this.getEnergyStored(stack) >= use){ - this.extractEnergy(stack, use, false); - if(!world.isRemote){ - if(!living.isSneaking()){ - if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ + if(living instanceof EntityPlayer){ + EntityPlayer player = (EntityPlayer)living; + int use = this.getEnergyUsePerBlock(stack); + if(this.getEnergyStored(stack) >= use){ + if(!world.isRemote){ + if(!living.isSneaking() && 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); + this.breakBlocks(stack, 2, world, x, y, z, player); } - else this.breakBlocks(stack, 1, world, x, y, z, living); + else this.breakBlocks(stack, 1, world, x, y, z, player); } + else this.breakBlocks(stack, 0, world, x, y, z, player); } } } @@ -306,7 +334,7 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ @Override public float func_150893_a(ItemStack stack, Block block){ if(this.getEnergyStored(stack) < this.getEnergyUsePerBlock(stack)) return 0.0F; - if(block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock || allSet.contains(block)) return efficiency; + if(block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock || allSet.contains(block)) return this.getEfficiencyFromUpgrade(stack); else return super.func_150893_a(stack, block); } @@ -326,7 +354,9 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ @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); + if(!world.isRemote && player.isSneaking()){ + player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ); + } return stack; } @@ -350,11 +380,11 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + ItemUtil.addInformation(this, list, 3, ""); if(KeyUtil.isShiftPressed()){ list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF"); } - else list.add(ItemUtil.shiftForInfo()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java index 9d355c990..c73f60e41 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java @@ -3,31 +3,32 @@ 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.KeyUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +import java.util.List; public class ItemDrillUpgrade extends Item implements INameableItem{ public enum UpgradeType{ - SPEED(10), - SPEED_II(20), - SPEED_III(30), - SILK_TOUCH(20), //Done - FORTUNE(40), //Done - FORTUNE_II(60), //Done - THREE_BY_THREE(5), //Done - FIVE_BY_FIVE(5), //Done - VEIN(30), - PLACER(0); - - public int extraEnergy; - - UpgradeType(int extraEnergy){ - this.extraEnergy = extraEnergy; - } + SPEED, + SPEED_II, + SPEED_III, + SILK_TOUCH, + FORTUNE, + FORTUNE_II, + THREE_BY_THREE, + FIVE_BY_FIVE, + PLACER } public UpgradeType type; @@ -36,6 +37,32 @@ public class ItemDrillUpgrade extends Item implements INameableItem{ public ItemDrillUpgrade(UpgradeType type, String unlocName){ this.type = type; this.unlocalizedName = unlocName; + this.setMaxStackSize(1); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + if(!world.isRemote && this.type == UpgradeType.PLACER){ + this.setSlotToPlaceFrom(stack, player.inventory.currentItem); + } + return stack; + } + + public void setSlotToPlaceFrom(ItemStack stack, int slot){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) compound = new NBTTagCompound(); + + compound.setInteger("SlotToPlaceFrom", slot+1); + + stack.setTagCompound(compound); + } + + public static int getSlotToPlaceFrom(ItemStack stack){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound != null){ + return compound.getInteger("SlotToPlaceFrom")-1; + } + return -1; } @Override @@ -58,4 +85,20 @@ public class ItemDrillUpgrade extends Item implements INameableItem{ public String getOredictName(){ return this.getName(); } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + ItemUtil.addInformation(this, list, this.type == UpgradeType.PLACER ? 3 : 1, ""); + if(KeyUtil.isShiftPressed()){ + list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".itemDrillUpgrade.desc")); + if(this.type == UpgradeType.PLACER){ + int slot = getSlotToPlaceFrom(stack); + if(slot >= 0){ + list.add(StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.slot")+": "+(slot+1)); + } + } + } + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java index 79e956b5a..b1f1eff50 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java @@ -36,7 +36,7 @@ public class ItemResonantRice extends Item implements INameableItem{ @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")); + if(KeyUtil.isShiftPressed() && OreDictionary.getOres("nuggetEnderium", false).size() <= 0) list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemResonantRice.uncraftable.desc")); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java index 7f5d1c7d6..fa2b6d5cf 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java @@ -34,7 +34,7 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta public EnumPlantType type; public String name; - public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, ItemStack returnItem){ + public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, Item returnItem, int returnMeta){ super(plant, soilBlock); this.name = name; this.plant = plant; @@ -42,6 +42,7 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta this.type = type; ((BlockPlant)this.plant).seedItem = this; ((BlockPlant)this.plant).returnItem = returnItem; + ((BlockPlant)this.plant).returnMeta = returnMeta; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java index a5818d41e..fd8484ff7 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java @@ -21,6 +21,7 @@ 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; @@ -130,4 +131,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("axe"); + hashSet.add("shovel"); + return hashSet; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java index 9680388bd..b8c70d382 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -84,7 +84,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadCraftingRecipes(String outputId, Object... results){ if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){ - ArrayList recipes = GrinderRecipes.instance().recipes; + ArrayList recipes = GrinderRecipes.recipes; for(GrinderRecipes.GrinderRecipe recipe : recipes){ arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); } @@ -94,7 +94,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadCraftingRecipes(ItemStack result){ - ArrayList recipes = GrinderRecipes.instance().recipes; + ArrayList recipes = GrinderRecipes.recipes; for(GrinderRecipes.GrinderRecipe recipe : recipes){ if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); } @@ -102,7 +102,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadUsageRecipes(ItemStack ingredient){ - ArrayList recipes = GrinderRecipes.instance().recipes; + ArrayList recipes = GrinderRecipes.recipes; for(GrinderRecipes.GrinderRecipe recipe : recipes){ if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){ CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance); diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java index a83769942..f61a6e74f 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeRegistry.java @@ -10,14 +10,8 @@ import java.util.ArrayList; public class GrinderRecipeRegistry{ - private static final GrinderRecipeRegistry instance = new GrinderRecipeRegistry(); - - public static GrinderRecipeRegistry instance(){ - return instance; - } - - public ArrayList searchCases = new ArrayList(); - public ArrayList exceptions = new ArrayList(); + public static ArrayList searchCases = new ArrayList(); + public static ArrayList exceptions = new ArrayList(); public static class SearchCase{ @@ -30,11 +24,11 @@ public class GrinderRecipeRegistry{ } } - public void registerFinally(){ + public static void registerFinally(){ String[] names = OreDictionary.getOreNames(); for(String inputName : names){ - if(!this.exceptions.contains(inputName)){ + if(!exceptions.contains(inputName)){ int resultAmount = 1; String inputNameWithoutPrefix = null; @@ -49,8 +43,8 @@ public class GrinderRecipeRegistry{ if(inputNameWithoutPrefix != null){ String inputWithDustPrefix = "dust" + inputNameWithoutPrefix; - ArrayList allOresOfInitialInputName = OreDictionary.getOres(inputName); - ArrayList allOresWithDustPrefix = OreDictionary.getOres(inputWithDustPrefix); + ArrayList allOresOfInitialInputName = (ArrayList)OreDictionary.getOres(inputName, false); + ArrayList allOresWithDustPrefix = (ArrayList)OreDictionary.getOres(inputWithDustPrefix, false); if(allOresOfInitialInputName != null && allOresOfInitialInputName.size() > 0){ if(allOresWithDustPrefix != null && allOresWithDustPrefix.size() > 0){ for(ItemStack theInput : allOresOfInitialInputName){ @@ -58,8 +52,8 @@ public class GrinderRecipeRegistry{ ItemStack input = theInput.copy(); ItemStack output = theDust.copy(); output.stackSize = resultAmount; - if(!GrinderRecipes.instance().hasRecipe(input, output)){ - GrinderRecipes.instance().registerRecipe(input, output, null, 0); + if(!GrinderRecipes.hasRecipe(input, output)){ + GrinderRecipes.registerRecipe(input, output, null, 0); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java index da55d9e4e..89131880d 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java @@ -7,22 +7,16 @@ import java.util.ArrayList; public class GrinderRecipes{ - private static final GrinderRecipes instance = new GrinderRecipes(); + public static ArrayList recipes = new ArrayList(); - public ArrayList recipes = new ArrayList(); - - public static GrinderRecipes instance(){ - return instance; + public static void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){ + recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance)); } - public void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){ - this.recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance)); - } - - public void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputAmount){ - ArrayList inputStacks = OreDictionary.getOres(input); - ArrayList outputOneStacks = OreDictionary.getOres(outputOne); - ArrayList outputTwoStacks = OreDictionary.getOres(outputTwo); + public static void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputAmount){ + ArrayList inputStacks = (ArrayList)OreDictionary.getOres(input, false); + ArrayList outputOneStacks = (ArrayList)OreDictionary.getOres(outputOne, false); + ArrayList outputTwoStacks = (ArrayList)OreDictionary.getOres(outputTwo, false); if(inputStacks != null && !inputStacks.isEmpty()){ for(ItemStack anInput : inputStacks){ @@ -34,21 +28,21 @@ public class GrinderRecipes{ if(outputTwoStacks != null && !outputTwoStacks.isEmpty()){ for(ItemStack anOutputTwo : outputTwoStacks){ ItemStack theOutputTwo = anOutputTwo.copy(); - this.registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance); + registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance); } } - else this.registerRecipe(theInput, theOutputOne, null, 0); + else registerRecipe(theInput, theOutputOne, null, 0); } } } } } - public void registerRecipe(ItemStack input, ItemStack outputOne){ - this.registerRecipe(input, outputOne, null, 0); + public static void registerRecipe(ItemStack input, ItemStack outputOne){ + registerRecipe(input, outputOne, null, 0); } - public ItemStack getOutput(ItemStack input, boolean wantSecond){ + public static ItemStack getOutput(ItemStack input, boolean wantSecond){ for(GrinderRecipe recipe : recipes){ if(recipe.input.isItemEqual(input)){ return wantSecond ? recipe.secondOutput : recipe.firstOutput; @@ -57,14 +51,14 @@ public class GrinderRecipes{ return null; } - public boolean hasRecipe(ItemStack input, ItemStack outputOne){ + public static boolean hasRecipe(ItemStack input, ItemStack outputOne){ for(GrinderRecipe recipe : recipes){ if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)) return true; } return false; } - public int getSecondChance(ItemStack input){ + public static int getSecondChance(ItemStack input){ for(GrinderRecipe recipe : recipes){ if(recipe.input.isItemEqual(input)){ return recipe.secondChance; @@ -73,7 +67,7 @@ public class GrinderRecipes{ return 0; } - public class GrinderRecipe{ + public static class GrinderRecipe{ public final ItemStack input; public final ItemStack firstOutput; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 870ab38ea..b6bf4319e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -57,6 +57,8 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityLavaFactoryController.class, ModUtil.MOD_ID_LOWER + ":tileEntityLavaFactoryController"); GameRegistry.registerTileEntity(TileEntityCoffeeMachine.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoffeeMachine"); GameRegistry.registerTileEntity(TileEntityPhantomBooster.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBooster"); + GameRegistry.registerTileEntity(TileEntityEnergizer.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnergizer"); + GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java index 8f0d2c28a..4a799dce7 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -63,7 +63,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{ else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){ int theSlot = testInventory(this.slots); this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, this.slots[theSlot])); - if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null; + if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null; } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java index 03f242f1e..cad145cc6 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java @@ -28,6 +28,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + boolean flag = this.currentBurnTime > 0; if(this.currentBurnTime > 0){ this.currentBurnTime--; @@ -52,6 +53,15 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage); WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); } + + if(flag != this.currentBurnTime > 0){ + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if(meta == 1){ + if(!(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0 && energyProducedPerTick*TileEntityFurnace.getItemBurnTime(this.slots[0]) <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN))) + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); + } + else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java new file mode 100644 index 000000000..4103c6008 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java @@ -0,0 +1,82 @@ +package ellpeck.actuallyadditions.tile; + +import cofh.api.energy.EnergyStorage; +import cofh.api.energy.IEnergyContainerItem; +import cofh.api.energy.IEnergyReceiver; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver{ + + public EnergyStorage storage = new EnergyStorage(500000); + + public TileEntityEnergizer(){ + super(2, "energizer"); + } + + @Override + public void updateEntity(){ + if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ + if(this.storage.getEnergyStored() > 0){ + int received = ((IEnergyContainerItem)this.slots[0].getItem()).receiveEnergy(this.slots[0], this.storage.getEnergyStored(), false); + this.storage.extractEnergy(received, false); + } + + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) >= ((IEnergyContainerItem)this.slots[0].getItem()).getMaxEnergyStored(this.slots[0])){ + this.slots[1] = this.slots[0].copy(); + this.slots[0].stackSize--; + if(this.slots[0].stackSize <= 0) this.slots[0] = null; + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + this.storage.readFromNBT(compound); + super.readFromNBT(compound); + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, int side){ + return slot == 0 && stack.getItem() instanceof IEnergyContainerItem; + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, int side){ + return slot == 1; + } + + @SideOnly(Side.CLIENT) + public int getEnergyScaled(int i){ + return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN); + } + + @Override + public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){ + return this.storage.receiveEnergy(maxReceive, simulate); + } + + @Override + public int getEnergyStored(ForgeDirection from){ + return this.storage.getEnergyStored(); + } + + @Override + public int getMaxEnergyStored(ForgeDirection from){ + return this.storage.getMaxEnergyStored(); + } + + @Override + public boolean canConnectEnergy(ForgeDirection from){ + return true; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java new file mode 100644 index 000000000..936635337 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java @@ -0,0 +1,92 @@ +package ellpeck.actuallyadditions.tile; + +import cofh.api.energy.EnergyStorage; +import cofh.api.energy.IEnergyContainerItem; +import cofh.api.energy.IEnergyProvider; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.util.WorldUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider{ + + public EnergyStorage storage = new EnergyStorage(500000); + + public TileEntityEnervator(){ + super(2, "enervator"); + } + + @Override + public void updateEntity(){ + if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) > 0){ + int toReceive = ((IEnergyContainerItem)this.slots[0].getItem()).extractEnergy(this.slots[0], this.storage.getMaxEnergyStored()-this.storage.getEnergyStored(), false); + this.storage.receiveEnergy(toReceive, false); + } + + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) <= 0){ + this.slots[1] = this.slots[0].copy(); + this.slots[0].stackSize--; + if(this.slots[0].stackSize <= 0) this.slots[0] = null; + } + } + + if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); + } + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + this.storage.readFromNBT(compound); + super.readFromNBT(compound); + } + + @Override + public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){ + return this.storage.extractEnergy(maxExtract, simulate); + } + + @Override + public int getEnergyStored(ForgeDirection from){ + return this.storage.getEnergyStored(); + } + + @Override + public int getMaxEnergyStored(ForgeDirection from){ + return this.storage.getMaxEnergyStored(); + } + + @Override + public boolean canConnectEnergy(ForgeDirection from){ + return true; + } + + @SideOnly(Side.CLIENT) + public int getEnergyScaled(int i){ + return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN); + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, int side){ + return slot == 0 && stack.getItem() instanceof IEnergyContainerItem; + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, int side){ + return slot == 1; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 5cc3552f9..ccfc31aa1 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -19,9 +19,9 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public EnergyStorage storage = new EnergyStorage(30000); - public static int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue(); + public int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue(); - public int maxBurnTime = this.getStandardSpeed(); + public int maxBurnTime = ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue(); public int firstSmeltTime; public int secondSmeltTime; @@ -34,6 +34,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + boolean flag = this.firstSmeltTime > 0 || this.secondSmeltTime > 0; boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1); boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2); @@ -62,6 +63,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements else this.secondSmeltTime = 0; if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstSmeltTime > 0 || this.secondSmeltTime > 0) this.storage.extractEnergy(energyUsePerTick, false); + + if(flag != (this.firstSmeltTime > 0 || this.secondSmeltTime > 0)){ + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if(meta > 3){ + if(!this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1) && !this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2)) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta-4, 2); + } + else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta+4, 2); + } } } @@ -135,10 +144,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2; } - public int getStandardSpeed(){ - return ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue(); - } - @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){ return this.storage.receiveEnergy(maxReceive, simulate); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index f6ec5bc46..8eb4df417 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -41,7 +41,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public TileEntityGrinderDouble(){ super(6, "grinderDouble"); this.isDouble = true; - this.maxCrushTime = this.getStandardSpeed(); + this.maxCrushTime = ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue(); energyUsePerTick = ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue(); } @@ -54,7 +54,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public static final int SLOT_OUTPUT_2_1 = 4; public static final int SLOT_OUTPUT_2_2 = 5; - public static int energyUsePerTick; + public int energyUsePerTick; public int maxCrushTime; @@ -70,7 +70,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public TileEntityGrinder(){ super(3, "grinder"); this.isDouble = false; - this.maxCrushTime = this.getStandardSpeed(); + this.maxCrushTime = ConfigIntValues.GRINDER_CRUSH_TIME.getValue(); energyUsePerTick = ConfigIntValues.GRINDER_ENERGY_USED.getValue(); } @@ -78,6 +78,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + boolean flag = this.firstCrushTime > 0 || this.secondCrushTime > 0; + boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); boolean canCrushOnSecond = false; if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); @@ -107,13 +109,21 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstCrushTime > 0 || this.secondCrushTime > 0) this.storage.extractEnergy(energyUsePerTick, false); + + if(flag != (this.firstCrushTime > 0 || this.secondCrushTime > 0)){ + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if(meta == 1){ + if(!this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2) && (!this.isDouble || !this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2))) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); + } + else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } } } public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){ if(this.slots[theInput] != null){ - ItemStack outputOne = GrinderRecipes.instance().getOutput(this.slots[theInput], false); - ItemStack outputTwo = GrinderRecipes.instance().getOutput(this.slots[theInput], true); + ItemStack outputOne = GrinderRecipes.getOutput(this.slots[theInput], false); + ItemStack outputTwo = GrinderRecipes.getOutput(this.slots[theInput], true); if(this.slots[theInput] != null){ if(outputOne != null){ if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){ @@ -126,12 +136,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput){ - ItemStack outputOnFirst = GrinderRecipes.instance().getOutput(this.slots[theInput], false); - if (this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy(); - else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize; + ItemStack outputOnFirst = GrinderRecipes.getOutput(this.slots[theInput], false); + if(outputOnFirst != null){ + if(this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy(); + else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize; + } - int chance = GrinderRecipes.instance().getSecondChance(this.slots[theInput]); - ItemStack outputOnSecond = GrinderRecipes.instance().getOutput(this.slots[theInput], true); + int chance = GrinderRecipes.getSecondChance(this.slots[theInput]); + ItemStack outputOnSecond = GrinderRecipes.getOutput(this.slots[theInput], true); if(outputOnSecond != null){ int rand = new Random().nextInt(100) + 1; if(rand <= chance){ @@ -177,7 +189,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg @Override public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.instance().getOutput(stack, false) != null; + return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.getOutput(stack, false) != null; } @Override @@ -189,8 +201,4 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2; } - - public int getStandardSpeed(){ - return this.isDouble ? ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue() : ConfigIntValues.GRINDER_CRUSH_TIME.getValue(); - } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java index 4daeb5946..78e01fa16 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java @@ -34,6 +34,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + boolean flag = this.currentBurnTime > 0; if(this.currentBurnTime > 0){ this.currentBurnTime--; @@ -64,6 +65,15 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage); WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); } + + if(flag != this.currentBurnTime > 0){ + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if(meta == 1){ + if(!(energyProducedPerTick*this.maxBurnTime <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN) && FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount())) + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); + } + else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java index 3f826e385..4a02b47f9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java @@ -77,7 +77,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{ if(boundWorld.getBlock(boundPosition.posX, boundPosition.posY, boundPosition.posZ).isReplaceable(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ)){ int theSlot = TileEntityBreaker.testInventory(this.slots); this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, this.slots[theSlot])); - if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null; + if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null; } } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 4f213e233..2bfa54782 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger; public class ModUtil{ - public static final String VERSION = "1.7.10-0.0.5.7"; + public static final String VERSION = "1.7.10-0.0.6.0"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 5da1c84d1..97924e489 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -3,17 +3,11 @@ 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; @@ -28,26 +22,6 @@ public class WorldUtil{ return new ChunkCoordinates(x+side.offsetX, y+side.offsetY, z+side.offsetZ); } - public static MovingObjectPosition raytraceBlocksFromEntity(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 breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){ if(side == ForgeDirection.UNKNOWN){ world.setBlockToAir(x, y, z); @@ -65,7 +39,6 @@ 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); } } } @@ -76,7 +49,6 @@ public class WorldUtil{ 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..45416c690 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -19,10 +19,22 @@ tile.actuallyadditions.blockFurnaceSolar.name=Solar Panel tile.actuallyadditions.blockHeatCollector.name=Heat Collector tile.actuallyadditions.blockItemRepairer.name=Item Repairer +item.actuallyadditions.itemDrill.name=Drill +tooltip.actuallyadditions.itemDrill.desc.1=Mines all the Blocks! +tooltip.actuallyadditions.itemDrill.desc.2=Powered by RF! Charge in an Energizer! Discharge in an Enervator! +tooltip.actuallyadditions.itemDrill.desc.3=Drill Upgrades can be applied through Sneak-Right-Clicking! + tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass +tile.actuallyadditions.blockEnergizer.name=Energizer +tooltip.actuallyadditions.blockEnergizer.desc.1=A "Charger", if you will +tooltip.actuallyadditions.blockEnergizer.desc.2=Charges Items that can hold RF +tile.actuallyadditions.blockEnervator.name=Enervator +tooltip.actuallyadditions.blockEnervator.desc.1=A "Discharger", if you will +tooltip.actuallyadditions.blockEnervator.desc.2=Discharges Items that can hold RF + tile.actuallyadditions.blockRice.name=Rice Plant tooltip.actuallyadditions.blockRice.desc=It's growing... kind of.. item.actuallyadditions.itemFoodRice.name=Rice @@ -43,6 +55,9 @@ tooltip.actuallyadditions.blockMiscCharcoal.desc=Crafted from Charcoal item.actuallyadditions.itemMiscRiceSlime.name=Rice Slimeball tooltip.actuallyadditions.itemMiscRiceSlime.desc=It's sticky... and smells kinda good... +item.actuallyadditions.itemBattery.name=Battery +tooltip.actuallyadditions.itemBattery.desc=Stores RF! Charge in an Energizer! Discharge in an Enervator! + tile.actuallyadditions.blockCoalGenerator.name=Coal Generator tooltip.actuallyadditions.blockCoalGenerator.desc=Produces Energy from Coal and other flammable Materials @@ -85,13 +100,13 @@ tile.actuallyadditions.blockFluidPlacer.name=Fluid Placer tooltip.actuallyadditions.blockFluidPlacer.desc=Places Fluids stored inside it tooltip.actuallyadditions.paxel.desc=It's an Axe, Shovel, Sword, Hoe and Pickaxe! Combined! -item.actuallyadditions.woodenPaxel.name=Wooden Paxel -item.actuallyadditions.stonePaxel.name=Stone Paxel -item.actuallyadditions.ironPaxel.name=Iron Paxel -item.actuallyadditions.goldPaxel.name=Golden Paxel -item.actuallyadditions.diamondPaxel.name=Diamond Paxel -item.actuallyadditions.emeraldPaxel.name=Emerald Paxel -item.actuallyadditions.obsidianPaxel.name=Obsidian Paxel +item.actuallyadditions.woodenPaxel.name=Wooden Paxelordoe +item.actuallyadditions.stonePaxel.name=Stone Paxelordoe +item.actuallyadditions.ironPaxel.name=Iron Paxelordoe +item.actuallyadditions.goldPaxel.name=Golden Paxelordoe +item.actuallyadditions.diamondPaxel.name=Diamond Paxelordoe +item.actuallyadditions.emeraldPaxel.name=Emerald Paxelordoe +item.actuallyadditions.obsidianPaxel.name=Obsidian Paxelordoe tile.actuallyadditions.blockFluidCollector.name=Fluid Collector tooltip.actuallyadditions.blockFluidCollector.desc=Stores Fluids in front of it inside it @@ -169,6 +184,29 @@ tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO +item.actuallyadditions.itemDrillUpgradeSpeed.name=Drill Speed I Augment +item.actuallyadditions.itemDrillUpgradeSpeedII.name=Drill Speed II Augment +item.actuallyadditions.itemDrillUpgradeSpeedIII.name=Drill Speed III Augment +item.actuallyadditions.itemDrillUpgradeSilkTouch.name=Drill Silk Touch Augment +item.actuallyadditions.itemDrillUpgradeFortune.name=Drill Fortune I Augment +item.actuallyadditions.itemDrillUpgradeFortuneII.name=Drill Fortune II Augment +item.actuallyadditions.itemDrillUpgradeBlockPlacing.name=Drill Block Placing Augment +item.actuallyadditions.itemDrillUpgradeThreeByThree.name=Drill Three By Three Mining Augment +item.actuallyadditions.itemDrillUpgradeFiveByFive.name=Drill Five By Five Mining Augment + +tooltip.actuallyadditions.itemDrillUpgradeSpeed.desc=Makes the Drill faster! +tooltip.actuallyadditions.itemDrillUpgradeSpeedII.desc=Makes the Drill even faster! Requires Tier 1. +tooltip.actuallyadditions.itemDrillUpgradeSpeedIII.desc=Insta-Mine! Requires Tier 1 and 2. +tooltip.actuallyadditions.itemDrillUpgradeSilkTouch.desc=Makes the Drill silky. +tooltip.actuallyadditions.itemDrillUpgradeFortune.desc=Gives the Drill Fortune I. +tooltip.actuallyadditions.itemDrillUpgradeFortuneII.desc=Gives the Drill Fortune III! Requires Tier 1. +tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.1=Places Blocks from your Hotbar when Right-Clicking with the Drill! +tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.2=You can define the Slot on your Hotbar to place from! +tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.3=Sneak-Right-Click this Upgrade in the desired Slot to store it! +tooltip.actuallyadditions.itemDrillUpgradeThreeByThree.desc=Lets you mine a 3x3 Area! +tooltip.actuallyadditions.itemDrillUpgradeFiveByFive.desc=Lets you mine a 5x5 Area! Requires the 3x3 Upgrade. +tooltip.actuallyadditions.itemDrillUpgrade.desc=Sneak-Right-Click the Drill to apply Upgrades! + tile.actuallyadditions.blockMiscEnderCasing.name=Ender Casing tooltip.actuallyadditions.blockMiscEnderCasing.desc=Extremely sturdy casing, used for crafting @@ -450,6 +488,9 @@ 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.drill.name=Drill +container.actuallyadditions.energizer.name=Energizer +container.actuallyadditions.enervator.name=Enervator container.nei.actuallyadditions.crushing.name=Crusher container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoalGeneratorTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoalGeneratorTop.png index deef7462dd24f68b26551a8296fc3b9d06eb9a27..85181259b5d1592dc692a8441a111fbf2976de4c 100644 GIT binary patch delta 410 zcmV;L0cHNC1pNb$NgcZY01mqW$N1DX00007bV*G`2j2q*7A!WSR{*1tQzw60Nklqj$;J!3-o`Y&QG-zN#wq9}K(*fR&EyFbs)cBIbNP z7e!$j7z4OougXJ*+A&}bASoqDf*PfxLtvp4kdlhj^E{2}MyV`IYZ&rfmxU5To}?q> z!LVMhrL=oEoldZ0{M1GVvVtJco!Aa-+hWk75sd~u)#3eqTLTY<%jI&SO;eT!=&Z!2 zX{uIq=%Br`Cqa1{HBlBA^2bx+YPzng>za`;oQK1q@B7#5 zh4g;E%Rsta641>X`v8%eOqu_`RqPbzRP4VEkh!k=3)SG9bNxXv`2YX_07*qoM6N<$ Ef-)h*aR2}S delta 452 zcmV;#0XzQv1EvI!NeaUN01m?e$8V@)k!B}&Qo2k<$-~N|pU;e_*Xtp+EGwJM%A4p6 zr_%`ro#4tI8NJTu^TlF8s&>1Lg%h_1LX^l7aTAM1^@s67+?BV00006VoOIv0RI600RN!9r<0LBAAbcB4kjiB z0YB{k00nYML_t(Y$L*F&Y#Y}VhQE7SO+Mt5EIu?Wyz76uGtk+jS1iXv%ZHUZk8Y2p;#Btc>&X^ZrcNQxzz)KDZv4oOij zlQVN~7nBqWt(_D>yC`}#bAN%EbM86!-1E&Z(&@AY$Ye5Pvsolv6YMv=^HjHd3n0?z zw4R!pqEWXA1Ok*-Ru~9{sFX^WrVqz)F-;#MsWDv7V{?0(dcDCwILzGK95R#1P+BQ6 zl1Q+%zD|23B1I5?A{V4Ch{U#gh>-6>Y(P%a~l}_V$9SlBP z5mu~aT*u+v+1c(p0e_T=MFM^ksTBqqADTC^zvR&${{#SuW;*j-u4bP_3W;g@&D!6_tYgG$Xvih;2}^#qJW9XN%U?PMpI*G z1c}iUS6;k~hs52v)Q*r`%|6R?<~t}UIT}ykGfn(~o^A#TSSgnoj>YJ>9z(GNo;2{J z0e~kYo-}yng@4No$CF6YN-ISG zlB1(^92bq?%MU)t%}$3>xy;!3#HSl3c541t!z4cII7>dG{bzVkuT_z^@IdYGz{>wK z4`eo*MJYwmvS`+A3^cV$8Ld2g+N1wKFR9~qQL&a$u75*5mm?AmGdw)pJ+oVRpd5#i zRiM{2iI1i*wBk@Cf>s`e@+f~24_0<~u-T~5tdtl#emB8jh_z}N1I0jSfVyqpo(Jcq z9|EOVTPcHswO|MXYr>FM70 z)uP2;-+#Hr()kH)F5wYnwj@?d*&gK|EH*Xhu*YkR#8Mh;{6{S1wy=snnn zR%*{@F9QRO@?7GhV>Bx(Y}6_|{JrnfvTMBY(u+irDMCkvKuT`R&mm2dO0AB#C!N+4 zW1}=}o2G5k>o?hK)Hs&D2cg03bZ|YF!u16_x_^^76i;yC)L)E3`V1@wbt;E zga(Ibwbodg|A2w$FbBhj|2-ZEDXH5wo{(7i8*Dqy|9S9V=Yde(J{~N7T74jP^g+Py z=S2DxRV&X%YmEcJ5GY0SPWoV%2Zr)kuU0^HHNx1jxj(Ht{BeEeg5&}uSq`U@ET07%K7X0I_6Pk#J+-<|FB{a*sr zO?~nGKXUika{!E=x|jEU`Xp_w@q`3n?0@+f!_nvy0n;QD3}UZVC@##=EEgF+buS0| zgM9SociG(9COR>RK+>q&98DwgTqJh2%IjBNMhfxCJed32U&viw=+-MG{T@e# f@TBp-%7cFZFRjy<@G-dK00000NkvXXu0mjfq#x6D delta 434 zcmV;j0Zsnp3%>)97k>~40ssI2kdbIM00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj532;bRa{vGiy8r+Vy8*}e)HVPB00(qQO+^Ra0|pl$Fy}*ntpET37<5HgbW?9; zba!ELWdLwtX>N2bZe?^JG%heMHD!e|WdHyH9Z5t%R5(v{l7BIagFq04@BajZbT&2t zu@#RfiXei8f}q4E*a>zv0gL;)_nEh>UN|2ZW@o-PyG-WGd260$1!uCrW@y_s%d)a8 zgCIzf#Pht{?WW(Vs>qY{eLs%l&44wEqUZB@zuztTeYq6ZD}gdaQ2>Nt2)x}ul;^q7 zx~{vfgHF>_v43pKvNTO&p7eM;ls$4b&{eeS``#F+k)kFE{cr-fu4@cxK-TK@7J;?t z!Mj0^kwAamk_Vb9W7rM2H5O`WZw;nLno20CodoWFU8GbZ8()Nlj2>E@cM*00N6iL_t(I%Vm9+M{JwjC=NxhE`c+-*?IV{jP%4$k=L+O=Ir=yE z!14V<030aiI5IK_ zfQkyFsq6q$Ba3bk^F0Ml-+sWvg;P{2zX{?9EE7Le)Rt>4!vfXFb}S@`1tI_qCvMCz zdFc!}*I}U=puW|xGd6FlJ~~oly0U<7YC0AS&|sJbFQ%s$8!iJdJ~F_uecJ#S+f!op z$@6v}($wex)<>Bn2^-HFUp z8OOW5TW4a3p5UkW9 lw2WEx6e?9{okH5&-9LlJ1vQuQY0m%v002ovPDHLkV1mZ-S5N=| diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGeneratorTop.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGeneratorTop.png index 5d560937edc6f61776aee0b067d9da5bf378e7ac..85181259b5d1592dc692a8441a111fbf2976de4c 100644 GIT binary patch delta 424 zcmV;Z0ayN+1pNb$Bnkm@Qb$4nuFf3kks%u$y8r+Vy8*}e)HVPB00(qQO+^Ra0|pi> zHltSnqmf1@e_KgJK~y+TO_Du}gFqOBZLYMixXLoWBTZVXASprwArLSYNgzeUA|Vho zLGc8Or18Jr*2*5LnMBs?cvTU_l zZMWMWgFMf7yWMiRd^{ev+bxb`1o8|9d{Gn~kH^pFe>0!Y7mEesIN5AA`~AMED)k=> zya<4mj_fcDiC`k;d_EUNVHy|%xL&WyLxskuaQx!=dl{*XxD!e!t5=x?K{`%^Ujwk(x}I|G!o26y{XyzYUPNuKNqs;GA>) SK{5FN0000&Y4#EKyC`y2lW+#7_NklJN(F*wVgWkSG&`Nn z`W zfa!EfhVghjnM@EDi^U%WBCFL3i)OP48)iy|K%ofw{XR8t7X(4K+udw7mjx*E1S*A zo9GOu(+LKh;L08uz0T+J#bQCKcDs#*7Vtwb7z~&_C=?0^XjG2OfMO6J6Kh=(v*()e zaV=E5SvgYD@pu$LoI!f$;thI$YTGs)lTExp?Ejt;-j~aTDY0TEvgh;3+d-9V&~Pu; xB>{PPC66IN*(4+XU#mouP*c(0Hh^Xr#xIqC+`uAT;?@8F002ovPDHLkV1lv5*5m*H diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiManual.png deleted file mode 100644 index 8e9d776c0ba9c59522eeef67676f2ce455799ff5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1859 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP~62^QA&dRf`N&DBm;)v@9e6; zXy+{Oh%9Dc;M)YkjE1Im+kt`-C9V-A!TD(=<%vb93~dIox?sjWt- z3=B*wJzX3_D&pSWxS03IK*TkW?biSQPkcDqZy&3aj0`S#yfr>4GH|Yr!>V_wk$RuE zt;ydXWA{Aw_m9o>94EnZ{7UAFxpRY2h$GI+HY^) z{J)_8BMDTjLBI*+a0Z5yKt_fMuB;DS7`7j8coAJ|z5l!Pg=@Bgr*`MRWh^?sv7E0j z?x(QDoxgA9#*4soHtf4@`;Os8F5?N!e!g;h<_XgG1c7p94dFg5ZEPoUo~@oggCq6( z1p$W2X<6ImJKTRQSI+Qe8^e<+?(MthGoIjm&vAg8vG2dB&1v5EFQzg$v%yUM(A9Zi z!d3GHZ`swHoS&(~gc&BduVY|1v51L5p__}LL1)!{?gXVPX-ZeNGc!1ZMKctgI)LG? zxzYz*R-AQNksT|nbJH4 z;e}?x3-`$~Fl@TTG$EJ`s1^zw`^HIJdGYEa#DdsbFZZDPm=C z5WBjQ(Wm8>Ps^_|pf9qx9sDFM;7S-OpMbqo%shi*>r9TXZy6XSTor4WV^n}p^67*q z(1jt-*$f1;j0IoaW@J!Ut;=AU`T(Ki$wY0S3s;=uB_d!R?DuW?77f%skKr;~LQ%tO z*@T^U)?ePnq%(a@dd}ZJ(?b*PU7H@yxQx$X-DNg~>zT|GUTbP0l+XkKv#%gT diff --git a/update/changelog.txt b/update/changelog.txt index bc3039296..e4b0687d2 100644 --- a/update/changelog.txt +++ b/update/changelog.txt @@ -1 +1 @@ -Fixed a Bug caused by fixing the last Bug... Whoops... \ No newline at end of file +Drills, Drill Upgrades, Energizer, Enervator, Batteries \ No newline at end of file diff --git a/update/newestVersion.txt b/update/newestVersion.txt index f5e6e48fe..4846cf078 100644 --- a/update/newestVersion.txt +++ b/update/newestVersion.txt @@ -1 +1 @@ -1.7.10-0.0.5.7 \ No newline at end of file +1.7.10-0.0.6.0 \ No newline at end of file