mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 15:48:34 +01:00
Added configuration for energy powered Rings
This commit is contained in:
parent
2f31b855ae
commit
e2169c3641
4 changed files with 23 additions and 10 deletions
|
@ -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."),
|
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_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_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 name;
|
||||||
public final String category;
|
public final String category;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
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.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -31,7 +32,7 @@ import java.util.List;
|
||||||
public class ItemGrowthRing extends ItemEnergy{
|
public class ItemGrowthRing extends ItemEnergy{
|
||||||
|
|
||||||
public ItemGrowthRing(String name){
|
public ItemGrowthRing(String name){
|
||||||
super(1000000, 2000, name);
|
super(ConfigIntValues.GROWTH_RING_ENERGY_CAPACITY.getValue(), ConfigIntValues.GROWTH_RING_ENERGY_TRANSFER.getValue(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,7 +44,7 @@ public class ItemGrowthRing extends ItemEnergy{
|
||||||
EntityPlayer player = (EntityPlayer)entity;
|
EntityPlayer player = (EntityPlayer)entity;
|
||||||
ItemStack equipped = player.getHeldItemMainhand();
|
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){
|
if(StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse){
|
||||||
List<BlockPos> blocks = new ArrayList<BlockPos>();
|
List<BlockPos> blocks = new ArrayList<BlockPos>();
|
||||||
|
|
||||||
|
@ -80,11 +81,12 @@ public class ItemGrowthRing extends ItemEnergy{
|
||||||
IBlockState newState = world.getBlockState(pos);
|
IBlockState newState = world.getBlockState(pos);
|
||||||
if(newState.getBlock().getMetaFromState(newState) != metaBefore){
|
if(newState.getBlock().getMetaFromState(newState) != metaBefore){
|
||||||
world.playEvent(2005, pos, 0);
|
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{
|
else{
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
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.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -29,7 +30,7 @@ import java.util.ArrayList;
|
||||||
public class ItemMagnetRing extends ItemEnergy{
|
public class ItemMagnetRing extends ItemEnergy{
|
||||||
|
|
||||||
public ItemMagnetRing(String name){
|
public ItemMagnetRing(String name){
|
||||||
super(200000, 1000, name);
|
super(ConfigIntValues.MAGNETISM_RING_ENERGY_CAPACITY.getValue(), ConfigIntValues.MAGNETISM_RING_ENERGY_TRANSFER.getValue(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +50,7 @@ public class ItemMagnetRing extends ItemEnergy{
|
||||||
if(!items.isEmpty()){
|
if(!items.isEmpty()){
|
||||||
for(EntityItem item : items){
|
for(EntityItem item : items){
|
||||||
if(!item.isDead && !item.cannotPickup()){
|
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){
|
if(this.getEnergyStored(stack) >= energyForItem){
|
||||||
ItemStack oldItem = StackUtil.validateCopy(item.getItem());
|
ItemStack oldItem = StackUtil.validateCopy(item.getItem());
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
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.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -26,7 +27,7 @@ import net.minecraft.world.World;
|
||||||
public class ItemWaterRemovalRing extends ItemEnergy{
|
public class ItemWaterRemovalRing extends ItemEnergy{
|
||||||
|
|
||||||
public ItemWaterRemovalRing(String name){
|
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
|
@Override
|
||||||
|
@ -38,7 +39,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{
|
||||||
EntityPlayer player = (EntityPlayer)entity;
|
EntityPlayer player = (EntityPlayer)entity;
|
||||||
ItemStack equipped = player.getHeldItemMainhand();
|
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){
|
if(StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse){
|
||||||
|
|
||||||
//Setting everything to air
|
//Setting everything to air
|
||||||
|
|
Loading…
Reference in a new issue