Added configuration for energy powered Rings

This commit is contained in:
OneEyeMaker 2017-09-25 10:21:15 +03:00
parent 2f31b855ae
commit e2169c3641
4 changed files with 23 additions and 10 deletions

View file

@ -36,7 +36,16 @@ public enum ConfigIntValues{
DRILL_ENERGY_USE("Drill: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 100, 1, 1000000000, "Amount of energy Drill uses to mine block."),
HANDHELD_FILLER_ENERGY_CAPACITY("Handheld Filler: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 500000, 1000, 1000000000, "Amount of energy Handheld Filler can store."),
HANDHELD_FILLER_ENERGY_TRANSFER("Handheld Filler: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Handheld Filler can receive per tick."),
HANDHELD_FILLER_ENERGY_USE("Handheld Filler: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 1500, 1, 1000000000, "Amount of energy Handheld Filler uses to place block.");
HANDHELD_FILLER_ENERGY_USE("Handheld Filler: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 1500, 1, 1000000000, "Amount of energy Handheld Filler uses to place block."),
GROWTH_RING_ENERGY_CAPACITY("Ring Of Growth: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 1000000, 1000, 1000000000, "Amount of energy Ring Of Growth can store."),
GROWTH_RING_ENERGY_TRANSFER("Ring Of Growth: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 2000, 1, 1000000000, "Amount of energy Ring Of Growth can receive per tick."),
GROWTH_RING_ENERGY_USE("Ring Of Growth: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 300, 1, 1000000000, "Amount of energy Ring Of Growth uses to fertilize plant."),
MAGNETISM_RING_ENERGY_CAPACITY("Ring Of Magnetism: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 200000, 1000, 1000000000, "Amount of energy Ring Of Magnetism can store."),
MAGNETISM_RING_ENERGY_TRANSFER("Ring Of Magnetism: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Ring Of Magnetism can receive per tick."),
MAGNETISM_RING_ENERGY_USE("Ring Of Magnetism: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 50, 1, 1000000000, "Amount of energy Ring Of Magnetism uses to pick up item."),
LIQUID_BANNING_RING_ENERGY_CAPACITY("Ring Of Liquid Banning: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 800000, 1000, 1000000000, "Amount of energy Ring Of Liquid Banning can store."),
LIQUID_BANNING_RING_ENERGY_TRANSFER("Ring Of Liquid Banning: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Ring Of Liquid Banning can receive per tick."),
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.");
public final String name;
public final String category;

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
@ -31,7 +32,7 @@ import java.util.List;
public class ItemGrowthRing extends ItemEnergy{
public ItemGrowthRing(String name){
super(1000000, 2000, name);
super(ConfigIntValues.GROWTH_RING_ENERGY_CAPACITY.getValue(), ConfigIntValues.GROWTH_RING_ENERGY_TRANSFER.getValue(), name);
}
@Override
@ -43,7 +44,7 @@ public class ItemGrowthRing extends ItemEnergy{
EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getHeldItemMainhand();
int energyUse = 300;
int energyUse = ConfigIntValues.GROWTH_RING_ENERGY_USE.getValue();
if(StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse){
List<BlockPos> blocks = new ArrayList<BlockPos>();
@ -80,11 +81,12 @@ public class ItemGrowthRing extends ItemEnergy{
IBlockState newState = world.getBlockState(pos);
if(newState.getBlock().getMetaFromState(newState) != metaBefore){
world.playEvent(2005, pos, 0);
// Consume energy only if plant was fertilized
if(!player.capabilities.isCreativeMode){
this.extractEnergyInternal(stack, energyUse, false);
}
}
if(!player.capabilities.isCreativeMode){
this.extractEnergyInternal(stack, energyUse, false);
}
}
else{
break;

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -29,7 +30,7 @@ import java.util.ArrayList;
public class ItemMagnetRing extends ItemEnergy{
public ItemMagnetRing(String name){
super(200000, 1000, name);
super(ConfigIntValues.MAGNETISM_RING_ENERGY_CAPACITY.getValue(), ConfigIntValues.MAGNETISM_RING_ENERGY_TRANSFER.getValue(), name);
}
@Override
@ -49,7 +50,7 @@ public class ItemMagnetRing extends ItemEnergy{
if(!items.isEmpty()){
for(EntityItem item : items){
if(!item.isDead && !item.cannotPickup()){
int energyForItem = 50*StackUtil.getStackSize(item.getItem());
int energyForItem = ConfigIntValues.MAGNETISM_RING_ENERGY_USE.getValue()*StackUtil.getStackSize(item.getItem());
if(this.getEnergyStored(stack) >= energyForItem){
ItemStack oldItem = StackUtil.validateCopy(item.getItem());

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
@ -26,7 +27,7 @@ import net.minecraft.world.World;
public class ItemWaterRemovalRing extends ItemEnergy{
public ItemWaterRemovalRing(String name){
super(800000, 1000, name);
super(ConfigIntValues.LIQUID_BANNING_RING_ENERGY_CAPACITY.getValue(), ConfigIntValues.LIQUID_BANNING_RING_ENERGY_TRANSFER.getValue(), name);
}
@Override
@ -38,7 +39,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{
EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getHeldItemMainhand();
int energyUse = 150;
int energyUse = ConfigIntValues.LIQUID_BANNING_RING_ENERGY_USE.getValue();
if(StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse){
//Setting everything to air