From 446f122feedfdfbcde52441df8a2418b3382dd96 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 5 Oct 2015 19:55:28 +0200 Subject: [PATCH] Long-Range Breaker Localization & Documentation --- .../booklet/InitBooklet.java | 1 + .../config/values/ConfigCrafting.java | 3 +- .../config/values/ConfigIntValues.java | 5 +- .../crafting/BlockCrafting.java | 9 ++++ .../creative/CreativeTab.java | 1 + .../actuallyadditions/items/ItemEnergy.java | 12 ++--- .../nei/BookletInfoRecipeHandler.java | 20 +++---- .../tile/TileEntityDirectionalBreaker.java | 4 +- .../tile/TileEntityInventoryBase.java | 5 +- .../tile/TileEntityPhantomface.java | 53 ++++++++++--------- .../actuallyadditions/util/WorldUtil.java | 17 +++--- .../assets/actuallyadditions/lang/en_US.lang | 8 ++- 12 files changed, 81 insertions(+), 57 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index ab8d25f67..d4a7c7040 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -79,6 +79,7 @@ public class InitBooklet{ new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeLavaFactory).setNoText()); new BookletChapter("energizer", entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); new BookletChapter("repairer", entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("", ConfigIntValues.REPAIRER_ENERGY_USED.getValue())); + new BookletChapter("longRangeBreaker", entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.DIRECTIONAL_BREAKER_RF_PER_BLOCK.getValue()).addTextReplacement("", ConfigIntValues.DIRECTIONAL_BREAKER_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker)); //RF Generating Blocks new BookletChapter("coalGen", entryGeneratingRF, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", ConfigIntValues.COAL_GEN_ENERGY_PRODUCED.getValue())); diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java index 141da5ec0..04b4cac1e 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java @@ -149,7 +149,8 @@ public enum ConfigCrafting{ MAGNET_RING("Magnet Ring", ConfigCategories.ITEMS_CRAFTING), WATER_RING("Water Ring", ConfigCategories.ITEMS_CRAFTING), - GROWTH_RING("Growth Ring", ConfigCategories.ITEMS_CRAFTING); + GROWTH_RING("Growth Ring", ConfigCategories.ITEMS_CRAFTING), + DIRECTIONAL_BREAKER("Long-Range Breaker", ConfigCategories.BLOCKS_CRAFTING); 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 78a9741f8..78b394769 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -164,7 +164,10 @@ public enum ConfigIntValues{ LEAF_GENERATOR_ENERGY_PRODUCED("Leaf Generator: Energy Produce", ConfigCategories.MACHINE_VALUES, 40, 1, 10000, "How much Energy the Leaf Generator produces per Leaf broken"), LEAF_GENERATOR_COOLDOWN_TIME("Leaf Generator: Cooldown Time", ConfigCategories.MACHINE_VALUES, 5, 0, 100, "The amount of ticks that it takes util another Leaf gets proken"), - LEAF_GENERATOR_RANGE("Leaf Generator: Range", ConfigCategories.MACHINE_VALUES, 7, 1, 100, "The radius of a leaf generator"); + LEAF_GENERATOR_RANGE("Leaf Generator: Range", ConfigCategories.MACHINE_VALUES, 7, 1, 100, "The radius of a leaf generator"), + + DIRECTIONAL_BREAKER_RF_PER_BLOCK("Directional Breaker: RF per Block", ConfigCategories.MACHINE_VALUES, 5, 0, 1000, "The amount of RF the Directional Breaker uses to break each block"), + DIRECTIONAL_BREAKER_RANGE("Directional Breaker: Range", ConfigCategories.MACHINE_VALUES, 8, 1, 1000, "The range of the Directional Breaker"); 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 8cd064ce3..12ca89097 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -74,9 +74,18 @@ public class BlockCrafting{ public static IRecipe[] recipesLamps = new IRecipe[BlockColoredLamp.allLampTypes.length]; public static IRecipe recipePowerer; public static IRecipe recipeLeafGen; + public static IRecipe recipeDirectionalBreaker; public static void init(){ + //Directional Breaker + if(ConfigCrafting.DIRECTIONAL_BREAKER.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDirectionalBreaker), + "BBB", + 'B', new ItemStack(InitBlocks.blockBreaker))); + recipeDirectionalBreaker = Util.GetRecipes.lastIRecipe(); + } + //Smiley Cloud if(ConfigCrafting.CLOUD.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockSmileyCloud), diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 034305fda..eecf2f30d 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -81,6 +81,7 @@ public class CreativeTab extends CreativeTabs{ add(InitBlocks.blockItemRepairer); add(InitBlocks.blockFishingNet); add(InitBlocks.blockBreaker); + add(InitBlocks.blockDirectionalBreaker); add(InitBlocks.blockPlacer); add(InitBlocks.blockDropper); add(InitBlocks.blockFluidPlacer); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java b/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java index 5354d7ad9..9d37ae944 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java @@ -41,6 +41,12 @@ public abstract class ItemEnergy extends ItemEnergyContainer implements IActAddI this.setEnergy(stack, 0); } + @SuppressWarnings("unchecked") + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ + list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF"); + } + @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) @@ -72,12 +78,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer implements IActAddI return false; } - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ - list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF"); - } - public void setEnergy(ItemStack stack, int energy){ NBTTagCompound compound = stack.getTagCompound(); if(compound == null){ diff --git a/src/main/java/ellpeck/actuallyadditions/nei/BookletInfoRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/BookletInfoRecipeHandler.java index 4b57dae81..4fa0ec40b 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/BookletInfoRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/BookletInfoRecipeHandler.java @@ -42,6 +42,11 @@ public class BookletInfoRecipeHandler extends TemplateRecipeHandler implements I return ((CachedInfoStack)this.arecipes.get(page)).theStack; } + @Override + public void loadTransferRects(){ + transferRects.add(new RecipeTransferRect(new Rectangle(0, 18, 165, Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), NAME)); + } + @SuppressWarnings("unchecked") @Override public void loadCraftingRecipes(String outputId, Object... results){ @@ -112,6 +117,11 @@ public class BookletInfoRecipeHandler extends TemplateRecipeHandler implements I } } + @Override + public Class getGuiClass(){ + return GuiFurnaceDouble.class; + } + @Override public void drawBackground(int recipe){ @@ -124,16 +134,6 @@ public class BookletInfoRecipeHandler extends TemplateRecipeHandler implements I this.drawExtras(recipe); } - @Override - public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(0, 18, 165, Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), NAME)); - } - - @Override - public Class getGuiClass(){ - return GuiFurnaceDouble.class; - } - @Override public int recipiesPerPage(){ return 1; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java index f6bd322d5..ab2c4cbbc 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java @@ -43,8 +43,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem public void updateEntity(){ if(!worldObj.isRemote){ if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ - int usagePerBlock = 5; //TODO Config - int range = 8; //TODO Config + int usagePerBlock = ConfigIntValues.DIRECTIONAL_BREAKER_RF_PER_BLOCK.getValue(); + int range = ConfigIntValues.DIRECTIONAL_BREAKER_RANGE.getValue(); if(this.storage.getEnergyStored() >= usagePerBlock*range){ if(this.currentTime > 0){ this.currentTime--; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index c583ebdbc..287117205 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -75,13 +75,14 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements else{ return new int[0]; } - } @Override + } + + @Override public int getInventoryStackLimit(){ return 64; } - @Override public boolean isUseableByPlayer(EntityPlayer player){ return player.getDistanceSq(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) <= 64; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index 2b040cb15..01e6c1e19 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -222,9 +222,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.getHandler().fill(from, resource, doFill); } return 0; - } @Override - public boolean isBoundThingInRange(){ - return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler; } @Override @@ -233,6 +230,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.getHandler().drain(from, resource, doDrain); } return null; + } @Override + public boolean isBoundThingInRange(){ + return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler; } @Override @@ -281,9 +281,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){ return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0; - } @Override - public boolean isBoundThingInRange(){ - return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider); } @Override @@ -297,6 +294,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } return 0; + } @Override + public boolean isBoundThingInRange(){ + return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider); } @Override @@ -310,6 +310,26 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } return 0; + } + + public IEnergyProvider getProvider(){ + if(this.boundPosition != null && this.boundPosition.getWorld() != null){ + TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); + if(tile instanceof IEnergyProvider){ + return (IEnergyProvider)tile; + } + } + return null; + } + + public IEnergyReceiver getReceiver(){ + if(this.boundPosition != null && this.boundPosition.getWorld() != null){ + TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); + if(tile instanceof IEnergyReceiver){ + return (IEnergyReceiver)tile; + } + } + return null; } @Override public void updateEntity(){ super.updateEntity(); @@ -326,15 +346,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } - public IEnergyReceiver getReceiver(){ - if(this.boundPosition != null && this.boundPosition.getWorld() != null){ - TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IEnergyReceiver){ - return (IEnergyReceiver)tile; - } - } - return null; - } + private void pushEnergy(ForgeDirection side){ TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord); @@ -349,17 +361,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP - public IEnergyProvider getProvider(){ - if(this.boundPosition != null && this.boundPosition.getWorld() != null){ - TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IEnergyProvider){ - return (IEnergyProvider)tile; - } - } - return null; - } - - @Override diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 692d16a11..afee76b1c 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -48,6 +48,10 @@ public class WorldUtil{ */ public static final ForgeDirection[] CARDINAL_DIRECTIONS_ORDER = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.WEST}; + public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){ + breakBlockAtSide(side, world, x, y, z, 0); + } + public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z, int offset){ if(side == ForgeDirection.UNKNOWN){ world.setBlockToAir(x, y, z); @@ -59,10 +63,6 @@ public class WorldUtil{ } } - public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){ - breakBlockAtSide(side, world, x, y, z, 0); - } - public static WorldPos getCoordsFromSide(ForgeDirection side, World world, int x, int y, int z, int offset){ if(side == ForgeDirection.UNKNOWN){ return null; @@ -253,8 +253,9 @@ public class WorldUtil{ /** * Add an ArrayList of ItemStacks to an Array of slots - * @param slots The slots to try to put the items into - * @param stacks The stacks to be put into the slots (Items don't actually get removed from there!) + * + * @param slots The slots to try to put the items into + * @param stacks The stacks to be put into the slots (Items don't actually get removed from there!) * @param actuallyDo Do it or just test if it works? * @return Does it work? */ @@ -278,9 +279,9 @@ public class WorldUtil{ } else{ if(actuallyDo){ - slots[i].stackSize+=stackToPutIn.stackSize; + slots[i].stackSize += stackToPutIn.stackSize; } - testSlots[i].stackSize+=stackToPutIn.stackSize; + testSlots[i].stackSize += stackToPutIn.stackSize; } working++; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 319799713..a63090101 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -103,6 +103,7 @@ tile.actuallyadditions.blockCoffeeMachine.name=Coffee Machine tile.actuallyadditions.blockXPSolidifier.name=Experience Solidifier tile.actuallyadditions.blockSmileyCloud.name=Smiley Cloud tile.actuallyadditions.blockLeafGenerator.name=Leaf-Eating Generator +tile.actuallyadditions.blockDirectionalBreaker.name=Long-Range Breaker #ESD tile.actuallyadditions.blockInputter.name=ESD @@ -348,6 +349,7 @@ container.actuallyadditions.enervator.name=Enervator container.actuallyadditions.xpSolidifier.name=Experience Solidifier container.actuallyadditions.oreMagnet.name=Magnetic Miner container.actuallyadditions.cloud.name=Smiley Cloud +container.actuallyadditions.directionalBreaker.name=Long-Range Breaker #Update Information info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}] @@ -542,4 +544,8 @@ booklet.actuallyadditions.chapter.batteries.text.1=Batteries are a good booklet.actuallyadditions.chapter.leafGen.name=Leaf-Eating Generator booklet.actuallyadditions.chapter.leafGen.text.1=The Leaf Generator can generate RF just by being placed alongside some Leaves. It will destroy the leaves, generating RF per leaf broken in the process. By right-clicking the generator, you can see how much RF it has stored. It has a range of blocks. -booklet.actuallyadditions.chapter.leafGen.text.2=Munchy \ No newline at end of file +booklet.actuallyadditions.chapter.leafGen.text.2=Munchy + +booklet.actuallyadditions.chapter.longRangeBreaker.name=Long-Range Breaker +booklet.actuallyadditions.chapter.longRangeBreaker.text.1=The Long-Range Breaker works like a normal Breaker, but it can break up to blocks in front of it. Per block broken, it uses RF. Breaking the th wall +booklet.actuallyadditions.chapter.longRangeBreaker.text.2=Sequence Breaking \ No newline at end of file