From 0ce4d001b9eb1d7eed630fb7b75e57400ed7e64e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 12 Jun 2015 21:29:21 +0200 Subject: [PATCH] -Fixed some tiny Bugs --- .../actuallyadditions/ActuallyAdditions.java | 2 ++ .../blocks/BlockCoffeeMachine.java | 1 + .../crafting/BlockCrafting.java | 3 ++- .../inventory/gui/GuiInputter.java | 2 +- .../actuallyadditions/items/ItemCoffee.java | 26 +++++++++---------- .../nei/CoffeeMachineRecipeHandler.java | 4 +-- .../tile/TileEntityBase.java | 1 + .../tile/TileEntityCoffeeMachine.java | 4 +-- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index b8568fb64..4f4141b1e 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -18,6 +18,7 @@ import ellpeck.actuallyadditions.gen.InitVillager; import ellpeck.actuallyadditions.gen.OreGen; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.ItemCoffee; import ellpeck.actuallyadditions.material.InitItemMaterials; import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.proxy.IProxy; @@ -74,6 +75,7 @@ public class ActuallyAdditions{ Util.logInfo("Starting PostInitialization Phase..."); GrinderCrafting.init(); + ItemCoffee.initIngredients(); proxy.postInit(); Util.logInfo("PostInitialization Finished."); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java index 6ab49eeef..c0dcaf928 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -129,6 +129,7 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { BlockUtil.addInformation(theBlock, list, 5, ""); + BlockUtil.addPowerUsageInfo(list, TileEntityCoffeeMachine.energyUsePerTick); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index a01f4814d..23cc69130 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -7,6 +7,7 @@ import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -159,7 +160,7 @@ public class BlockCrafting{ "CRC", "CBC", "CRC", 'C', "cobblestone", 'R', TheMiscBlocks.STONE_CASING.getOredictName(), - 'B', "coal")); + 'B', new ItemStack(Items.coal, 1, Util.WILDCARD))); //Enderpearl Block GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java index ad2fb619d..ce76bf0e9 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java @@ -120,7 +120,7 @@ public class GuiInputter extends GuiContainer{ this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 4210752); this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java index b3c92331b..13a59170a 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java @@ -29,8 +29,8 @@ public class ItemCoffee extends ItemFood implements INameableItem{ public static ArrayList ingredients = new ArrayList(); - public void initIngredients(){ - this.registerIngredient(new Ingredient(new ItemStack(Items.milk_bucket), null){ + public static void initIngredients(){ + registerIngredient(new Ingredient(new ItemStack(Items.milk_bucket), null){ @Override public void effect(ItemStack stack){ PotionEffect[] effects = getEffectsFromStack(stack); @@ -45,19 +45,20 @@ public class ItemCoffee extends ItemFood implements INameableItem{ ItemCoffee.addEffectToStack(stack, this); } } + this.effects = null; } @Override public String getExtraText(){ return StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.extra.milk"); } }); - this.registerIngredient(new Ingredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 10, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 15, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 60, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 10, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)})); - this.registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 10, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 15, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 60, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 10, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)})); + registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)})); } public ItemCoffee(){ @@ -65,12 +66,11 @@ public class ItemCoffee extends ItemFood implements INameableItem{ this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1); this.setAlwaysEdible(); this.setMaxStackSize(1); - this.initIngredients(); } public static Ingredient getIngredientFromStack(ItemStack stack){ for(Ingredient ingredient : ingredients){ - if(ingredient.ingredient.isItemEqual(stack)) return ingredient; + if(ingredient.ingredient.copy().isItemEqual(stack)) return ingredient; } return null; } @@ -224,13 +224,13 @@ public class ItemCoffee extends ItemFood implements INameableItem{ return "itemCoffee"; } - public void registerIngredient(Ingredient ingredient){ + public static void registerIngredient(Ingredient ingredient){ ingredients.add(ingredient); } public static class Ingredient{ - public ItemStack ingredient; + public final ItemStack ingredient; protected PotionEffect[] effects; public Ingredient(ItemStack ingredient, PotionEffect[] effects){ diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java index 7f21916a1..cd1cf50b6 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java @@ -41,7 +41,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{ public CachedCoffee(ItemCoffee.Ingredient ingredient){ this.cup = new PositionedStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), 45, 39); this.coffeeBeans = new PositionedStack(new ItemStack(InitItems.itemCoffeeBean), 2, 39); - this.ingredientStack = new PositionedStack(ingredient.ingredient, 90, 21); + this.ingredientStack = new PositionedStack(ingredient.ingredient.copy(), 90, 21); this.setupResult(ingredient); this.extraText = ingredient.getExtraText(); } @@ -112,7 +112,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{ ArrayList ingredients = ItemCoffee.ingredients; for(ItemCoffee.Ingredient ingr : ingredients){ - if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient, ingredient)){ + if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){ CachedCoffee theRecipe = new CachedCoffee(ingr); theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient); arecipes.add(theRecipe); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index b65949634..f4c698971 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -40,6 +40,7 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityFluidCollector.TileEntityFluidPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityFluidPlacer"); 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"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index 10cd318e3..a0a445880 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -41,7 +41,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(!worldObj.isRemote){ this.storeCoffee(); - if(this.brewTime > 0 || worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + if(this.brewTime > 0){ this.brew(); } } @@ -127,7 +127,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements @Override public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null && (this.slots[i] == null || this.slots[i].stackSize < 1)) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); + return (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); } @Override