Added config option to configure energy capacity of Refined Storage items. Fixes #1521

This commit is contained in:
raoulvdberge
2018-06-27 11:22:00 +02:00
parent 8b893aecb7
commit 7dd5119ba8
13 changed files with 49 additions and 22 deletions

View File

@@ -13,6 +13,7 @@ NOTE: Worlds that used Refined Storage 1.5.x are fully compatible with Refined S
- Autocrafting tasks that take longer than 5 seconds to calculate are automatically stopped to avoid server strain (raoulvdberge) - Autocrafting tasks that take longer than 5 seconds to calculate are automatically stopped to avoid server strain (raoulvdberge)
- Added new storage disk system where the storage disk data (items, fluids) are stored off the disk itself, in another file (refinedstorage_disks.dat). The disk itself only stores its ID (raoulvdberge) - Added new storage disk system where the storage disk data (items, fluids) are stored off the disk itself, in another file (refinedstorage_disks.dat). The disk itself only stores its ID (raoulvdberge)
- Added /createdisk command which creates a disk based on the disk ID. Turn on advanced tooltips to see the disk ID on a disk item (raoulvdberge) - Added /createdisk command which creates a disk based on the disk ID. Turn on advanced tooltips to see the disk ID on a disk item (raoulvdberge)
- Added config option to configure energy capacity of Refined Storage items (raoulvdberge)
- Changed fluid storage progression to be 64k - 256k - 1024k - 4096k (raoulvdberge) - Changed fluid storage progression to be 64k - 256k - 1024k - 4096k (raoulvdberge)
- You can no longer put a Filter in filter slots to gain additional filter slots (raoulvdberge) - You can no longer put a Filter in filter slots to gain additional filter slots (raoulvdberge)
- You can now re-insert Processing Patterns in the Pattern Grid and have the inputs and outputs be completed (raoulvdberge) - You can now re-insert Processing Patterns in the Pattern Grid and have the inputs and outputs be completed (raoulvdberge)

View File

@@ -72,6 +72,7 @@ public class RSConfig {
//region Wireless Grid //region Wireless Grid
public boolean wirelessGridUsesEnergy; public boolean wirelessGridUsesEnergy;
public int wirelessGridCapacity;
public int wirelessGridOpenUsage; public int wirelessGridOpenUsage;
public int wirelessGridExtractUsage; public int wirelessGridExtractUsage;
public int wirelessGridInsertUsage; public int wirelessGridInsertUsage;
@@ -79,6 +80,7 @@ public class RSConfig {
//region Portable Grid //region Portable Grid
public boolean portableGridUsesEnergy; public boolean portableGridUsesEnergy;
public int portableGridCapacity;
public int portableGridOpenUsage; public int portableGridOpenUsage;
public int portableGridExtractUsage; public int portableGridExtractUsage;
public int portableGridInsertUsage; public int portableGridInsertUsage;
@@ -86,6 +88,7 @@ public class RSConfig {
//region Wireless Fluid Grid //region Wireless Fluid Grid
public boolean wirelessFluidGridUsesEnergy; public boolean wirelessFluidGridUsesEnergy;
public int wirelessFluidGridCapacity;
public int wirelessFluidGridOpenUsage; public int wirelessFluidGridOpenUsage;
public int wirelessFluidGridExtractUsage; public int wirelessFluidGridExtractUsage;
public int wirelessFluidGridInsertUsage; public int wirelessFluidGridInsertUsage;
@@ -93,6 +96,7 @@ public class RSConfig {
//region Wireless Crafting Monitor //region Wireless Crafting Monitor
public boolean wirelessCraftingMonitorUsesEnergy; public boolean wirelessCraftingMonitorUsesEnergy;
public int wirelessCraftingMonitorCapacity;
public int wirelessCraftingMonitorOpenUsage; public int wirelessCraftingMonitorOpenUsage;
public int wirelessCraftingMonitorCancelUsage; public int wirelessCraftingMonitorCancelUsage;
public int wirelessCraftingMonitorCancelAllUsage; public int wirelessCraftingMonitorCancelAllUsage;
@@ -207,6 +211,7 @@ public class RSConfig {
//region Wireless Grid //region Wireless Grid
wirelessGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_GRID, true, "Whether the Wireless Grid uses energy"); wirelessGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_GRID, true, "Whether the Wireless Grid uses energy");
wirelessGridCapacity = config.getInt("capacity", WIRELESS_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Grid");
wirelessGridOpenUsage = config.getInt("open", WIRELESS_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to open"); wirelessGridOpenUsage = config.getInt("open", WIRELESS_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to open");
wirelessGridInsertUsage = config.getInt("insert", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to insert items"); wirelessGridInsertUsage = config.getInt("insert", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to insert items");
wirelessGridExtractUsage = config.getInt("extract", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to extract items"); wirelessGridExtractUsage = config.getInt("extract", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to extract items");
@@ -214,13 +219,15 @@ public class RSConfig {
//region Portable Grid //region Portable Grid
portableGridUsesEnergy = config.getBoolean("usesEnergy", PORTABLE_GRID, true, "Whether the Portable Grid uses energy"); portableGridUsesEnergy = config.getBoolean("usesEnergy", PORTABLE_GRID, true, "Whether the Portable Grid uses energy");
portableGridCapacity = config.getInt("capacity", PORTABLE_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Portable Grid");
portableGridOpenUsage = config.getInt("open", PORTABLE_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to open"); portableGridOpenUsage = config.getInt("open", PORTABLE_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to open");
portableGridInsertUsage = config.getInt("insert", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to insert items"); portableGridInsertUsage = config.getInt("insert", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to insert items");
portableGridExtractUsage = config.getInt("extract", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to extract items"); portableGridExtractUsage = config.getInt("extract", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to extract items");
//endregion //endregion
//region Wireless Grid //region Wireless Fluid Grid
wirelessFluidGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_FLUID_GRID, true, "Whether the Fluid Wireless Grid uses energy"); wirelessFluidGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_FLUID_GRID, true, "Whether the Fluid Wireless Grid uses energy");
wirelessFluidGridCapacity = config.getInt("capacity", WIRELESS_FLUID_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Fluid Grid");
wirelessFluidGridOpenUsage = config.getInt("open", WIRELESS_FLUID_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Fluid Wireless Grid to open"); wirelessFluidGridOpenUsage = config.getInt("open", WIRELESS_FLUID_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Fluid Wireless Grid to open");
wirelessFluidGridInsertUsage = config.getInt("insert", WIRELESS_FLUID_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Fluid Grid to insert items"); wirelessFluidGridInsertUsage = config.getInt("insert", WIRELESS_FLUID_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Fluid Grid to insert items");
wirelessFluidGridExtractUsage = config.getInt("extract", WIRELESS_FLUID_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Fluid Grid to extract items"); wirelessFluidGridExtractUsage = config.getInt("extract", WIRELESS_FLUID_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Fluid Grid to extract items");
@@ -228,6 +235,7 @@ public class RSConfig {
//region Wireless Crafting Monitor //region Wireless Crafting Monitor
wirelessCraftingMonitorUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_CRAFTING_MONITOR, true, "Whether the Wireless Crafting Monitor uses energy"); wirelessCraftingMonitorUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_CRAFTING_MONITOR, true, "Whether the Wireless Crafting Monitor uses energy");
wirelessCraftingMonitorCapacity = config.getInt("capacity", WIRELESS_CRAFTING_MONITOR, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Crafting Monitor");
wirelessCraftingMonitorOpenUsage = config.getInt("open", WIRELESS_CRAFTING_MONITOR, 35, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to open"); wirelessCraftingMonitorOpenUsage = config.getInt("open", WIRELESS_CRAFTING_MONITOR, 35, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to open");
wirelessCraftingMonitorCancelUsage = config.getInt("cancel", WIRELESS_CRAFTING_MONITOR, 4, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to cancel a task"); wirelessCraftingMonitorCancelUsage = config.getInt("cancel", WIRELESS_CRAFTING_MONITOR, 4, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to cancel a task");
wirelessCraftingMonitorCancelAllUsage = config.getInt("cancelAll", WIRELESS_CRAFTING_MONITOR, 5, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to cancel all tasks"); wirelessCraftingMonitorCancelAllUsage = config.getInt("cancelAll", WIRELESS_CRAFTING_MONITOR, 5, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to cancel all tasks");

View File

@@ -12,9 +12,11 @@ import javax.annotation.Nullable;
public class CapabilityProviderEnergy implements ICapabilityProvider { public class CapabilityProviderEnergy implements ICapabilityProvider {
private ItemStack stack; private ItemStack stack;
private int energyCapacity;
public CapabilityProviderEnergy(ItemStack stack) { public CapabilityProviderEnergy(ItemStack stack, int energyCapacity) {
this.stack = stack; this.stack = stack;
this.energyCapacity = energyCapacity;
} }
@Override @Override
@@ -24,6 +26,6 @@ public class CapabilityProviderEnergy implements ICapabilityProvider {
@Override @Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
return capability == CapabilityEnergy.ENERGY ? CapabilityEnergy.ENERGY.cast(new ItemEnergyForge(stack, ItemEnergyItem.CAPACITY)) : null; return capability == CapabilityEnergy.ENERGY ? CapabilityEnergy.ENERGY.cast(new ItemEnergyForge(stack, energyCapacity)) : null;
} }
} }

View File

@@ -21,16 +21,20 @@ public abstract class ItemBlockEnergyItem extends ItemBlockBase {
public static final int TYPE_NORMAL = 0; public static final int TYPE_NORMAL = 0;
public static final int TYPE_CREATIVE = 1; public static final int TYPE_CREATIVE = 1;
public ItemBlockEnergyItem(Block block, Direction direction) { private int energyCapacity;
public ItemBlockEnergyItem(Block block, Direction direction, int energyCapacity) {
super(block, direction, true); super(block, direction, true);
setMaxDamage(ItemEnergyItem.CAPACITY); this.energyCapacity = energyCapacity;
setMaxDamage(energyCapacity);
setMaxStackSize(1); setMaxStackSize(1);
} }
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) { public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) {
return new CapabilityProviderEnergy(stack); return new CapabilityProviderEnergy(stack, energyCapacity);
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package com.raoulvdberge.refinedstorage.item; package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSBlocks; import com.raoulvdberge.refinedstorage.RSBlocks;
import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid; import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
@@ -19,7 +20,7 @@ import java.util.List;
public class ItemBlockPortableGrid extends ItemBlockEnergyItem { public class ItemBlockPortableGrid extends ItemBlockEnergyItem {
public ItemBlockPortableGrid() { public ItemBlockPortableGrid() {
super(RSBlocks.PORTABLE_GRID, RSBlocks.PORTABLE_GRID.getDirection()); super(RSBlocks.PORTABLE_GRID, RSBlocks.PORTABLE_GRID.getDirection(), RS.INSTANCE.config.portableGridCapacity);
} }
@Override @Override

View File

@@ -16,22 +16,24 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public abstract class ItemEnergyItem extends ItemBase { public abstract class ItemEnergyItem extends ItemBase {
public static final int CAPACITY = 3200;
public static final int TYPE_NORMAL = 0; public static final int TYPE_NORMAL = 0;
public static final int TYPE_CREATIVE = 1; public static final int TYPE_CREATIVE = 1;
public ItemEnergyItem(String name) { private int energyCapacity;
public ItemEnergyItem(String name, int energyCapacity) {
super(name); super(name);
setMaxDamage(CAPACITY); this.energyCapacity = energyCapacity;
setMaxDamage(energyCapacity);
setMaxStackSize(1); setMaxStackSize(1);
setHasSubtypes(true); setHasSubtypes(true);
} }
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) { public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) {
return new CapabilityProviderEnergy(stack); return new CapabilityProviderEnergy(stack, energyCapacity);
} }
@Override @Override

View File

@@ -26,8 +26,8 @@ public abstract class ItemNetworkItem extends ItemEnergyItem implements INetwork
private static final String NBT_CONTROLLER_Z = "ControllerZ"; private static final String NBT_CONTROLLER_Z = "ControllerZ";
private static final String NBT_DIMENSION_ID = "DimensionID"; private static final String NBT_DIMENSION_ID = "DimensionID";
public ItemNetworkItem(String name) { public ItemNetworkItem(String name, int energyCapacity) {
super(name); super(name, energyCapacity);
addPropertyOverride(new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f); addPropertyOverride(new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
} }

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.item; package com.raoulvdberge.refinedstorage.item;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
@@ -18,7 +19,7 @@ public class ItemWirelessCraftingMonitor extends ItemNetworkItem {
public static final String NBT_TAB_PAGE = "TabPage"; public static final String NBT_TAB_PAGE = "TabPage";
public ItemWirelessCraftingMonitor() { public ItemWirelessCraftingMonitor() {
super("wireless_crafting_monitor"); super("wireless_crafting_monitor", RS.INSTANCE.config.wirelessCraftingMonitorCapacity);
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package com.raoulvdberge.refinedstorage.item; package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
@@ -12,7 +13,7 @@ import javax.annotation.Nonnull;
public class ItemWirelessFluidGrid extends ItemNetworkItem { public class ItemWirelessFluidGrid extends ItemNetworkItem {
public ItemWirelessFluidGrid() { public ItemWirelessFluidGrid() {
super("wireless_fluid_grid"); super("wireless_fluid_grid", RS.INSTANCE.config.wirelessFluidGridCapacity);
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package com.raoulvdberge.refinedstorage.item; package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler; import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
@@ -12,11 +13,11 @@ import javax.annotation.Nonnull;
public class ItemWirelessGrid extends ItemNetworkItem { public class ItemWirelessGrid extends ItemNetworkItem {
public ItemWirelessGrid(String name) { public ItemWirelessGrid(String name) {
super(name); super(name, RS.INSTANCE.config.wirelessGridCapacity);
} }
public ItemWirelessGrid() { public ItemWirelessGrid() {
super("wireless_grid"); super("wireless_grid", RS.INSTANCE.config.wirelessGridCapacity);
} }
@Override @Override

View File

@@ -13,6 +13,10 @@ public class MessageConfigSync implements IMessage, IMessageHandler<MessageConfi
RSConfig serverVersion = new RSConfig(RS.INSTANCE.config, RS.INSTANCE.config.getConfig()); RSConfig serverVersion = new RSConfig(RS.INSTANCE.config, RS.INSTANCE.config.getConfig());
serverVersion.controllerCapacity = buf.readInt(); serverVersion.controllerCapacity = buf.readInt();
serverVersion.wirelessGridCapacity = buf.readInt();
serverVersion.portableGridCapacity = buf.readInt();
serverVersion.wirelessFluidGridCapacity = buf.readInt();
serverVersion.wirelessCraftingMonitorCapacity = buf.readInt();
RS.INSTANCE.config = serverVersion; RS.INSTANCE.config = serverVersion;
} }
@@ -20,6 +24,10 @@ public class MessageConfigSync implements IMessage, IMessageHandler<MessageConfi
@Override @Override
public void toBytes(ByteBuf buf) { public void toBytes(ByteBuf buf) {
buf.writeInt(RS.INSTANCE.config.controllerCapacity); buf.writeInt(RS.INSTANCE.config.controllerCapacity);
buf.writeInt(RS.INSTANCE.config.wirelessGridCapacity);
buf.writeInt(RS.INSTANCE.config.portableGridCapacity);
buf.writeInt(RS.INSTANCE.config.wirelessFluidGridCapacity);
buf.writeInt(RS.INSTANCE.config.wirelessCraftingMonitorCapacity);
} }
@Override @Override

View File

@@ -24,7 +24,6 @@ import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid; import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid;
import com.raoulvdberge.refinedstorage.item.ItemEnergyItem;
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid; import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate; import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
import com.raoulvdberge.refinedstorage.util.StackUtils; import com.raoulvdberge.refinedstorage.util.StackUtils;
@@ -174,7 +173,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
return stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored(); return stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored();
} }
return ItemEnergyItem.CAPACITY; return RS.INSTANCE.config.portableGridCapacity;
} }
@Override @Override

View File

@@ -32,7 +32,6 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerTile; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerTile;
import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid; import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid;
import com.raoulvdberge.refinedstorage.item.ItemEnergyItem;
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid; import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
import com.raoulvdberge.refinedstorage.tile.TileBase; import com.raoulvdberge.refinedstorage.tile.TileBase;
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable; import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
@@ -222,7 +221,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
} }
private EnergyStorage recreateEnergyStorage(int energyStored) { private EnergyStorage recreateEnergyStorage(int energyStored) {
return new EnergyStorage(ItemEnergyItem.CAPACITY, ItemEnergyItem.CAPACITY, 0, energyStored); return new EnergyStorage(RS.INSTANCE.config.portableGridCapacity, RS.INSTANCE.config.portableGridCapacity, 0, energyStored);
} }
public ItemStack getAsItem() { public ItemStack getAsItem() {