-Made the Coffee Machine less OP

This commit is contained in:
Ellpeck 2015-06-13 20:39:54 +02:00
parent d22e36a215
commit fffa40e90b
11 changed files with 60 additions and 37 deletions

View file

@ -18,7 +18,7 @@ buildscript {
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'maven' apply plugin: 'maven'
version = "1.7.10-0.0.5.4" version = "1.7.10-0.0.5.5"
group = "ellpeck.actuallyadditions" group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"

View file

@ -82,9 +82,9 @@ public enum ConfigIntValues{
LAVA_FACTORY_ENERGY_USED("Lava Factory: Energy Used", ConfigCategories.MACHINE_VALUES, 150000, 10, 3000000, "The amount of Energy used by the Lava Factory per Bucket of Lava produced"), LAVA_FACTORY_ENERGY_USED("Lava Factory: Energy Used", ConfigCategories.MACHINE_VALUES, 150000, 10, 3000000, "The amount of Energy used by the Lava Factory per Bucket of Lava produced"),
LAVA_FACTORY_TIME("Lava Factory: Production Time", ConfigCategories.MACHINE_VALUES, 200, 5, 10000, "The amount of time it takes for the Lava Factory to produce one Bucket"), LAVA_FACTORY_TIME("Lava Factory: Production Time", ConfigCategories.MACHINE_VALUES, 200, 5, 10000, "The amount of time it takes for the Lava Factory to produce one Bucket"),
COFFEE_MACHINE_ENERGY_USED("Coffee Machine: Energy Used", ConfigCategories.MACHINE_VALUES, 150, 10, 3000, "The amount of Energy used by the Coffee Machine per Tick"), COFFEE_MACHINE_ENERGY_USED("Coffee Machine: Energy Use", ConfigCategories.MACHINE_VALUES, 150, 10, 3000, "The amount of Energy used by the Coffee Machine per Tick"),
COFFEE_CACHE_ADDED_PER_ITEM("Coffee Machine: Coffee added per Item", ConfigCategories.MACHINE_VALUES, 1, 1, 300, "The amount of Coffee added by one Coffee Item in the Coffee Machine"), COFFEE_CACHE_ADDED_PER_ITEM("Coffee Machine: Coffee added per Cup", ConfigCategories.MACHINE_VALUES, 1, 1, 300, "The amount of Coffee added by one Coffee Item in the Coffee Machine"),
COFFEE_CACHE_USED_PER_ITEM("Coffee Machine: Coffee used per Item", ConfigCategories.MACHINE_VALUES, 10, 1, 300, "The amount of Coffee used to brew one Coffee in the Coffee Machine"), 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_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");

View file

@ -39,7 +39,7 @@ public class MiscCrafting{
//Knife Blade //Knife Blade
if(ConfigCrafting.KNIFE_BLADE.isEnabled()) if(ConfigCrafting.KNIFE_BLADE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
"KF", "K", "F",
'K', "ingotIron", 'K', "ingotIron",
'F', new ItemStack(Items.flint))); 'F', new ItemStack(Items.flint)));
} }

View file

@ -30,14 +30,14 @@ public class ItemCoffee extends ItemFood implements INameableItem{
public static ArrayList<Ingredient> ingredients = new ArrayList<Ingredient>(); public static ArrayList<Ingredient> ingredients = new ArrayList<Ingredient>();
public static void initIngredients(){ public static void initIngredients(){
registerIngredient(new Ingredient(new ItemStack(Items.milk_bucket), null){ registerIngredient(new Ingredient(new ItemStack(Items.milk_bucket), null, 0){
@Override @Override
public void effect(ItemStack stack){ public boolean effect(ItemStack stack){
PotionEffect[] effects = getEffectsFromStack(stack); PotionEffect[] effects = getEffectsFromStack(stack);
ArrayList<PotionEffect> effectsNew = new ArrayList<PotionEffect>(); ArrayList<PotionEffect> effectsNew = new ArrayList<PotionEffect>();
if(effects != null && effects.length > 0){ if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){ for(PotionEffect effect : effects){
if(effect.getAmplifier() > 0) effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+150, effect.getAmplifier()-1)); if(effect.getAmplifier() > 0) effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+120, effect.getAmplifier()-1));
} }
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
if(effectsNew.size() > 0){ if(effectsNew.size() > 0){
@ -46,19 +46,20 @@ public class ItemCoffee extends ItemFood implements INameableItem{
} }
} }
this.effects = null; this.effects = null;
return true;
} }
@Override @Override
public String getExtraText(){ public String getExtraText(){
return StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.extra.milk"); return StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.extra.milk");
} }
}); });
registerIngredient(new Ingredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)}, 4));
registerIngredient(new Ingredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 10, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 20, 0)}, 1));
registerIngredient(new Ingredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 15, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 10, 0)}, 1));
registerIngredient(new Ingredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 60, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 30, 0)}, 1));
registerIngredient(new Ingredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 10, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 5, 0)}, 3));
registerIngredient(new Ingredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)}, 4));
registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)})); registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 1));
} }
public ItemCoffee(){ public ItemCoffee(){
@ -104,17 +105,28 @@ public class ItemCoffee extends ItemFood implements INameableItem{
stack.setTagCompound(tag); stack.setTagCompound(tag);
} }
public static void addEffectToStack(ItemStack stack, Ingredient ingredient){ public static boolean addEffectToStack(ItemStack stack, Ingredient ingredient){
boolean worked = false;
if(ingredient != null){ if(ingredient != null){
PotionEffect[] effects = ingredient.getEffects(); PotionEffect[] effects = ingredient.getEffects();
if(effects != null && effects.length > 0){ if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){ for(PotionEffect effect : effects){
if(hasEffect(stack, effect)) addEffectProperties(stack, effect, false, true); PotionEffect effectHas = getSameEffectFromStack(stack, effect);
else addEffectToStack(stack, effect); if(effectHas != null){
if(effectHas.getAmplifier() < ingredient.maxAmplifier-1){
addEffectProperties(stack, effect, false, true);
worked = true;
}
}
else{
addEffectToStack(stack, effect);
worked = true;
} }
} }
} }
} }
return worked;
}
public static PotionEffect[] getEffectsFromStack(ItemStack stack){ public static PotionEffect[] getEffectsFromStack(ItemStack stack){
ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>(); ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
@ -133,14 +145,14 @@ public class ItemCoffee extends ItemFood implements INameableItem{
return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null; return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
} }
public static boolean hasEffect(ItemStack stack, PotionEffect effect){ public static PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect){
PotionEffect[] effectsStack = getEffectsFromStack(stack); PotionEffect[] effectsStack = getEffectsFromStack(stack);
if(effectsStack != null && effectsStack.length > 0){ if(effectsStack != null && effectsStack.length > 0){
for(PotionEffect effectStack : effectsStack){ for(PotionEffect effectStack : effectsStack){
if(effect.getPotionID() == effectStack.getPotionID()) return true; if(effect.getPotionID() == effectStack.getPotionID()) return effectStack;
} }
} }
return false; return null;
} }
public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){ public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){
@ -233,10 +245,12 @@ public class ItemCoffee extends ItemFood implements INameableItem{
public final ItemStack ingredient; public final ItemStack ingredient;
protected PotionEffect[] effects; protected PotionEffect[] effects;
public final int maxAmplifier;
public Ingredient(ItemStack ingredient, PotionEffect[] effects){ public Ingredient(ItemStack ingredient, PotionEffect[] effects, int maxAmplifier){
this.ingredient = ingredient.copy(); this.ingredient = ingredient.copy();
this.effects = effects; this.effects = effects;
this.maxAmplifier = maxAmplifier;
} }
public String getExtraText(){ public String getExtraText(){
@ -247,8 +261,8 @@ public class ItemCoffee extends ItemFood implements INameableItem{
return this.effects; return this.effects;
} }
public void effect(ItemStack stack){ public boolean effect(ItemStack stack){
ItemCoffee.addEffectToStack(stack, this); return ItemCoffee.addEffectToStack(stack, this);
} }
} }
} }

View file

@ -37,6 +37,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{
public PositionedStack result; public PositionedStack result;
public PositionedStack ingredientStack; public PositionedStack ingredientStack;
public String extraText; public String extraText;
public int maxAmp;
public CachedCoffee(ItemCoffee.Ingredient ingredient){ public CachedCoffee(ItemCoffee.Ingredient ingredient){
this.cup = new PositionedStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), 45, 39); this.cup = new PositionedStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), 45, 39);
@ -44,6 +45,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{
this.ingredientStack = new PositionedStack(ingredient.ingredient.copy(), 90, 21); this.ingredientStack = new PositionedStack(ingredient.ingredient.copy(), 90, 21);
this.setupResult(ingredient); this.setupResult(ingredient);
this.extraText = ingredient.getExtraText(); this.extraText = ingredient.getExtraText();
this.maxAmp = ingredient.maxAmplifier;
} }
public void setupResult(ItemCoffee.Ingredient ingredient){ public void setupResult(ItemCoffee.Ingredient ingredient){
@ -139,10 +141,14 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{
CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe); CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe);
if(cache.extraText != null){ if(cache.extraText != null){
GuiDraw.drawString(StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.special"), 2, 6, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); GuiDraw.drawString(StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 18, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString(StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
if(cache.maxAmp > 0){
GuiDraw.drawString(StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.maxAmount") + ": " + cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
} }
GuiDraw.drawString("[SHIFT]!", 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
} }
@Override @Override

View file

@ -67,15 +67,16 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
this.brewTime = 0; this.brewTime = 0;
ItemStack output = new ItemStack(InitItems.itemCoffee); ItemStack output = new ItemStack(InitItems.itemCoffee);
for(int i = 3; i < this.slots.length; i++){ for(int i = 3; i < this.slots.length; i++){
if(this.slots[i] != null && ItemCoffee.getIngredientFromStack((this.slots[i])) != null){ if(this.slots[i] != null){
ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[i]); ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[i]);
if(ingredient != null){ if(ingredient != null){
ingredient.effect(output); if(ingredient.effect(output)){
}
this.slots[i].stackSize--; this.slots[i].stackSize--;
if(this.slots[i].stackSize <= 0) this.slots[i] = this.slots[i].getItem().getContainerItem(this.slots[i]); if(this.slots[i].stackSize <= 0) this.slots[i] = this.slots[i].getItem().getContainerItem(this.slots[i]);
} }
} }
}
}
this.slots[SLOT_OUTPUT] = output.copy(); this.slots[SLOT_OUTPUT] = output.copy();
this.slots[SLOT_INPUT].stackSize--; this.slots[SLOT_INPUT].stackSize--;
if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null; if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null;

View file

@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
public class ModUtil{ public class ModUtil{
public static final String VERSION = "1.7.10-0.0.5.4"; public static final String VERSION = "1.7.10-0.0.5.5";
public static final String MOD_ID = "ActuallyAdditions"; public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions"; public static final String NAME = "Actually Additions";

View file

@ -456,8 +456,10 @@ container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage
container.nei.actuallyadditions.compost.name=Compost container.nei.actuallyadditions.compost.name=Compost
container.nei.actuallyadditions.coffee.name=Coffee Machine container.nei.actuallyadditions.coffee.name=Coffee Machine
container.nei.actuallyadditions.coffee.special=Special Feature: container.nei.actuallyadditions.coffee.special=Special Feature
container.nei.actuallyadditions.coffee.extra.milk=+02:30, -1 Level container.nei.actuallyadditions.coffee.maxAmount=Max Amount
container.nei.actuallyadditions.coffee.shift=[SHIFT]!
container.nei.actuallyadditions.coffee.extra.milk=+01:00, -1 Level
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"}] 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"}]
info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}] info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}]

View file

@ -3,7 +3,7 @@
"modid": "ActuallyAdditions", "modid": "ActuallyAdditions",
"name": "Actually Additions", "name": "Actually Additions",
"description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!", "description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!",
"version": "0.0.5.4", "version": "0.0.5.5",
"mcversion": "1.7.10", "mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions", "url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "", "updateUrl": "",

View file

@ -1 +1 @@
Phantom Boosters, Coffee, a Lava Factory and Flax Made the Coffee Machine less OP :P

View file

@ -1 +1 @@
1.7.10-0.0.5.4 1.7.10-0.0.5.5