From 160067c273d8286762a8248fc24e3f3c16173c0d Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Mon, 25 Sep 2017 10:56:07 +0300 Subject: [PATCH] Added configuration for Leaf Blower and Potion Rings --- .../mod/config/values/ConfigIntValues.java | 6 +++++- .../ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java | 4 +++- .../ellpeck/actuallyadditions/mod/items/ItemPotionRing.java | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java index bdee844ad..88505f606 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java @@ -48,7 +48,11 @@ public enum ConfigIntValues{ LIQUID_BANNING_RING_ENERGY_USE("Ring Of Liquid Banning: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Ring Of Liquid Banning uses to remove liquid block."), TELEPORT_STAFF_ENERGY_CAPACITY("Teleport Staff: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 250000, 1000, 1000000000, "Amount of energy Teleport Staff can store."), TELEPORT_STAFF_ENERGY_TRANSFER("Teleport Staff: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Teleport Staff can receive per tick."), - TELEPORT_STAFF_ENERGY_USE("Teleport Staff: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 200, 1, 1000000000, "Amount of energy Teleport Staff uses to teleport per block."); + TELEPORT_STAFF_ENERGY_USE("Teleport Staff: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 200, 1, 1000000000, "Amount of energy Teleport Staff uses to teleport per block."), + LEAF_BLOWER_ENERGY_USE("Leaf Blower: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 60, 1, 1000000, "Amount of energy Leaf Blower uses per tick while placed on Display Stand."), + ADVANCED_LEAF_BLOWER_ENERGY_USE("Advanced Leaf Blower: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 60, 1, 1000000, "Amount of energy Advanced Leaf Blower uses per tick while placed on Display Stand."), + POTION_RINGS_ENERGY_USE("Potion Rings: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 325, 1, 1000000, "Amount of energy Potion Rings use per tick while placed on Display Stand."), + ADVANCED_POTION_RINGS_ENERGY_USE("Advanced Potion Rings: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 325, 1, 1000000, "Amount of energy Advanced Potion Rings use per tick while placed on Display Stand."); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index 9a7396e5f..b746e4859 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -11,7 +11,9 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; +import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.state.IBlockState; @@ -139,6 +141,6 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ @Override public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks){ - return 60; + return StackUtil.isValid(stack) && ((ItemLeafBlower) stack.getItem()).isAdvanced ? ConfigIntValues.ADVANCED_LEAF_BLOWER_ENERGY_USE.getValue() : ConfigIntValues.LEAF_BLOWER_ENERGY_USE.getValue(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 93c35ab72..40d79f1e1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; @@ -189,7 +190,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi boolean advanced = ((ItemPotionRing)stack.getItem()).isAdvanced; int range = advanced ? 48 : 16; List entities = tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(tile.getPos().getX()-range, tile.getPos().getY()-range, tile.getPos().getZ()-range, tile.getPos().getX()+range, tile.getPos().getY()+range, tile.getPos().getZ()+range)); - if(entities != null && !entities.isEmpty()){ + if(!entities.isEmpty()){ if(advanced){ //Give all entities the effect for(EntityLivingBase entity : entities){ @@ -226,7 +227,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks){ - return 325; + return StackUtil.isValid(stack) && ((ItemPotionRing) stack.getItem()).isAdvanced ? ConfigIntValues.ADVANCED_POTION_RINGS_ENERGY_USE.getValue() : ConfigIntValues.POTION_RINGS_ENERGY_USE.getValue(); } private boolean effectEntity(EntityLivingBase thePlayer, ItemStack stack, boolean canUseBasic){