Wrenches save redstone mode too

This commit is contained in:
Raoul Van den Berge
2016-11-01 14:47:41 +01:00
parent fb778ad3ae
commit 2d106d84bc
17 changed files with 88 additions and 101 deletions

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.tile;
package com.raoulvdberge.refinedstorage.api.util;
import net.minecraft.nbt.NBTTagCompound;

View File

@@ -1,6 +1,6 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.tile.IWrenchable;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

View File

@@ -37,7 +37,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
public class TileConstructor extends TileMultipartNode implements IComparable, IType, IWrenchable {
public class TileConstructor extends TileMultipartNode implements IComparable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
public static final TileDataParameter<Boolean> DROP = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileConstructor>() {
@@ -214,8 +214,6 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
RSUtils.readItems(upgrades, 1, tag);
}
@@ -223,8 +221,6 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
RSUtils.writeItems(upgrades, 1, tag);
return tag;
@@ -232,6 +228,8 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_COMPARE, compare);
tag.setInteger(NBT_TYPE, type);
tag.setBoolean(NBT_DROP, drop);
@@ -244,6 +242,8 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_COMPARE)) {
compare = tag.getInteger(NBT_COMPARE);
}

View File

@@ -25,7 +25,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import java.util.ArrayList;
import java.util.List;
public class TileCrafter extends TileNode implements ICraftingPatternContainer, IWrenchable {
public class TileCrafter extends TileNode implements ICraftingPatternContainer {
public static final TileDataParameter<Boolean> TRIGGERED_AUTOCRAFTING = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileCrafter>() {
@Override
public Boolean getValue(TileCrafter tile) {
@@ -131,8 +131,6 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer,
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
RSUtils.readItems(patterns, 0, tag);
RSUtils.readItems(upgrades, 1, tag);
}
@@ -141,8 +139,6 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer,
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
RSUtils.writeItems(patterns, 0, tag);
RSUtils.writeItems(upgrades, 1, tag);
@@ -151,6 +147,8 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer,
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setBoolean(NBT_TRIGGERED_AUTOCRAFTING, triggeredAutocrafting);
return tag;
@@ -158,6 +156,8 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer,
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_TRIGGERED_AUTOCRAFTING)) {
triggeredAutocrafting = tag.getBoolean(NBT_TRIGGERED_AUTOCRAFTING);
}

View File

@@ -41,7 +41,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class TileDestructor extends TileMultipartNode implements IComparable, IFilterable, IType, IWrenchable {
public class TileDestructor extends TileMultipartNode implements IComparable, IFilterable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
@@ -206,8 +206,6 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
RSUtils.readItems(upgrades, 1, tag);
}
@@ -215,8 +213,6 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
RSUtils.writeItems(upgrades, 1, tag);
return tag;
@@ -224,6 +220,8 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_COMPARE, compare);
tag.setInteger(NBT_MODE, mode);
tag.setInteger(NBT_TYPE, type);
@@ -237,6 +235,8 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_COMPARE)) {
compare = tag.getInteger(NBT_COMPARE);
}

View File

@@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.IItemHandler;
public class TileDetector extends TileNode implements IComparable, IType, IWrenchable {
public class TileDetector extends TileNode implements IComparable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
@@ -212,24 +212,10 @@ public class TileDetector extends TileNode implements IComparable, IType, IWrenc
markDirty();
}
@Override
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
}
@Override
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_COMPARE, compare);
tag.setInteger(NBT_MODE, mode);
tag.setInteger(NBT_AMOUNT, amount);
@@ -243,6 +229,8 @@ public class TileDetector extends TileNode implements IComparable, IType, IWrenc
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_COMPARE)) {
compare = tag.getInteger(NBT_COMPARE);
}

View File

@@ -32,7 +32,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
import java.util.List;
public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IType, IExcessVoidable, IAccessType, IWrenchable {
public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IType, IExcessVoidable, IAccessType {
public static final TileDataParameter<Integer> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
@@ -269,8 +269,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
super.read(tag);
RSUtils.readItems(disks, 0, tag);
readConfiguration(tag);
}
@Override
@@ -289,13 +287,13 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
RSUtils.writeItems(disks, 0, tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(itemFilters, 1, tag);
RSUtils.writeItems(fluidFilters, 2, tag);
@@ -312,6 +310,8 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(itemFilters, 1, tag);
RSUtils.readItems(fluidFilters, 2, tag);

View File

@@ -33,7 +33,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import java.util.ArrayList;
public class TileDiskManipulator extends TileNode implements IComparable, IFilterable, IType, IWrenchable {
public class TileDiskManipulator extends TileNode implements IComparable, IFilterable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
@@ -503,8 +503,6 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
RSUtils.readItems(upgrades, 3, tag);
RSUtils.readItems(inputDisks, 4, tag);
RSUtils.readItems(outputDisks, 5, tag);
readConfiguration(tag);
}
@Override
@@ -517,13 +515,13 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
RSUtils.writeItems(inputDisks, 4, tag);
RSUtils.writeItems(outputDisks, 5, tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(itemFilters, 1, tag);
RSUtils.writeItems(fluidFilters, 2, tag);
@@ -537,6 +535,8 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(itemFilters, 1, tag);
RSUtils.readItems(fluidFilters, 2, tag);

View File

@@ -22,7 +22,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
public class TileExporter extends TileMultipartNode implements IComparable, IType, IWrenchable {
public class TileExporter extends TileMultipartNode implements IComparable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
@@ -121,8 +121,6 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
RSUtils.readItems(upgrades, 1, tag);
}
@@ -130,8 +128,6 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
RSUtils.writeItems(upgrades, 1, tag);
return tag;
@@ -139,6 +135,8 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_COMPARE, compare);
tag.setInteger(NBT_TYPE, type);
@@ -150,6 +148,8 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_COMPARE)) {
compare = tag.getInteger(NBT_COMPARE);
}

View File

@@ -20,7 +20,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
public class TileFluidInterface extends TileNode implements IComparable, IWrenchable {
public class TileFluidInterface extends TileNode implements IComparable {
public static final int TANK_CAPACITY = 16000;
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
@@ -169,8 +169,6 @@ public class TileFluidInterface extends TileNode implements IComparable, IWrench
tag.setTag(NBT_TANK_IN, tankIn.writeToNBT(new NBTTagCompound()));
tag.setTag(NBT_TANK_OUT, tankOut.writeToNBT(new NBTTagCompound()));
writeConfiguration(tag);
return tag;
}
@@ -188,12 +186,12 @@ public class TileFluidInterface extends TileNode implements IComparable, IWrench
if (tag.hasKey(NBT_TANK_OUT)) {
tankOut.readFromNBT(tag.getCompoundTag(NBT_TANK_OUT));
}
readConfiguration(tag);
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(out, 2, tag);
tag.setInteger(NBT_COMPARE, compare);
@@ -203,6 +201,8 @@ public class TileFluidInterface extends TileNode implements IComparable, IWrench
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(out, 2, tag);
if (tag.hasKey(NBT_COMPARE)) {

View File

@@ -21,7 +21,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.List;
public class TileFluidStorage extends TileNode implements IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType, IWrenchable {
public class TileFluidStorage extends TileNode implements IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType {
public static final TileDataParameter<Integer> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Boolean> VOID_EXCESS = IExcessVoidable.createParameter();
@@ -142,8 +142,6 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
if (tag.hasKey(NBT_STORAGE)) {
storageTag = tag.getCompoundTag(NBT_STORAGE);
}
@@ -159,13 +157,13 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
tag.setTag(NBT_STORAGE, storageTag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(filters, 0, tag);
tag.setInteger(NBT_PRIORITY, priority);
@@ -180,6 +178,8 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(filters, 0, tag);
if (tag.hasKey(NBT_PRIORITY)) {

View File

@@ -22,7 +22,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
public class TileImporter extends TileMultipartNode implements IComparable, IFilterable, IType, IWrenchable {
public class TileImporter extends TileMultipartNode implements IComparable, IFilterable, IType {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
@@ -134,8 +134,6 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
super.read(tag);
RSUtils.readItems(upgrades, 1, tag);
readConfiguration(tag);
}
@Override
@@ -144,14 +142,14 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
RSUtils.writeItems(upgrades, 1, tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_COMPARE, compare);
tag.setInteger(NBT_MODE, mode);
tag.setInteger(NBT_TYPE, type);
@@ -164,6 +162,8 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_COMPARE)) {
compare = tag.getInteger(NBT_COMPARE);
}

View File

@@ -16,7 +16,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
public class TileInterface extends TileNode implements IComparable, IWrenchable {
public class TileInterface extends TileNode implements IComparable {
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
private static final String NBT_COMPARE = "Compare";
@@ -124,8 +124,6 @@ public class TileInterface extends TileNode implements IComparable, IWrenchable
RSUtils.readItems(importItems, 0, tag);
RSUtils.readItems(exportItems, 2, tag);
RSUtils.readItems(upgrades, 3, tag);
readConfiguration(tag);
}
@Override
@@ -136,13 +134,13 @@ public class TileInterface extends TileNode implements IComparable, IWrenchable
RSUtils.writeItems(exportItems, 2, tag);
RSUtils.writeItems(upgrades, 3, tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(exportSpecimenItems, 1, tag);
tag.setInteger(NBT_COMPARE, compare);
@@ -152,6 +150,8 @@ public class TileInterface extends TileNode implements IComparable, IWrenchable
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(exportSpecimenItems, 1, tag);
if (tag.hasKey(NBT_COMPARE)) {

View File

@@ -2,6 +2,7 @@ package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
@@ -11,7 +12,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public abstract class TileNode extends TileBase implements INetworkNode, IRedstoneConfigurable {
public abstract class TileNode extends TileBase implements INetworkNode, IRedstoneConfigurable, IWrenchable {
public static final TileDataParameter<Integer> REDSTONE_MODE = RedstoneMode.createParameter();
private static final String NBT_CONNECTED = "Connected";
@@ -147,7 +148,7 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
public void read(NBTTagCompound tag) {
super.read(tag);
redstoneMode = RedstoneMode.read(tag);
readConfiguration(tag);
if (tag.hasKey(NBT_NETWORK)) {
networkPos = BlockPos.fromLong(tag.getLong(NBT_NETWORK));
@@ -158,7 +159,7 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
redstoneMode.write(tag);
writeConfiguration(tag);
if (network != null) {
tag.setLong(NBT_NETWORK, network.getPosition().toLong());
@@ -167,6 +168,18 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
redstoneMode.write(tag);
return tag;
}
@Override
public void readConfiguration(NBTTagCompound tag) {
redstoneMode = RedstoneMode.read(tag);
}
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
super.writeUpdate(tag);

View File

@@ -22,7 +22,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
import java.util.List;
public class TileStorage extends TileNode implements IItemStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType, IWrenchable {
public class TileStorage extends TileNode implements IItemStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType {
public static final TileDataParameter<Integer> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
@@ -146,8 +146,6 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
if (tag.hasKey(NBT_STORAGE)) {
storageTag = tag.getCompoundTag(NBT_STORAGE);
}
readConfiguration(tag);
}
@Override
@@ -160,13 +158,13 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
tag.setTag(NBT_STORAGE, storageTag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(filters, 0, tag);
tag.setInteger(NBT_PRIORITY, priority);
@@ -181,6 +179,8 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(filters, 0, tag);
if (tag.hasKey(NBT_PRIORITY)) {

View File

@@ -14,7 +14,6 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBasic;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
import com.raoulvdberge.refinedstorage.tile.IStorageGui;
import com.raoulvdberge.refinedstorage.tile.IWrenchable;
import com.raoulvdberge.refinedstorage.tile.TileMultipartNode;
import com.raoulvdberge.refinedstorage.tile.config.*;
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
@@ -31,7 +30,7 @@ import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import java.util.ArrayList;
import java.util.List;
public class TileExternalStorage extends TileMultipartNode implements IItemStorageProvider, IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IType, IAccessType, IWrenchable {
public class TileExternalStorage extends TileMultipartNode implements IItemStorageProvider, IFluidStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable, IType, IAccessType {
public static final TileDataParameter<Integer> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
@@ -154,24 +153,10 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
super.update();
}
@Override
public void read(NBTTagCompound tag) {
super.read(tag);
readConfiguration(tag);
}
@Override
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
RSUtils.writeItems(itemFilters, 0, tag);
RSUtils.writeItems(fluidFilters, 1, tag);
@@ -187,6 +172,8 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
RSUtils.readItems(itemFilters, 0, tag);
RSUtils.readItems(fluidFilters, 1, tag);

View File

@@ -16,7 +16,6 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBasic;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerGridFilterInGrid;
import com.raoulvdberge.refinedstorage.inventory.ItemValidatorBasic;
import com.raoulvdberge.refinedstorage.item.ItemPattern;
import com.raoulvdberge.refinedstorage.tile.IWrenchable;
import com.raoulvdberge.refinedstorage.tile.TileNode;
import com.raoulvdberge.refinedstorage.tile.data.ITileDataConsumer;
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
@@ -39,7 +38,7 @@ import net.minecraftforge.items.wrapper.InvWrapper;
import java.util.ArrayList;
import java.util.List;
public class TileGrid extends TileNode implements IGrid, IWrenchable {
public class TileGrid extends TileNode implements IGrid {
public static final TileDataParameter<Integer> VIEW_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, new ITileDataProducer<Integer, TileGrid>() {
@Override
public Integer getValue(TileGrid tile) {
@@ -491,8 +490,6 @@ public class TileGrid extends TileNode implements IGrid, IWrenchable {
RSUtils.readItemsLegacy(matrix, 0, tag);
RSUtils.readItems(patterns, 1, tag);
RSUtils.readItems(filter, 2, tag);
readConfiguration(tag);
}
@Override
@@ -503,13 +500,13 @@ public class TileGrid extends TileNode implements IGrid, IWrenchable {
RSUtils.writeItems(patterns, 1, tag);
RSUtils.writeItems(filter, 2, tag);
writeConfiguration(tag);
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
super.writeConfiguration(tag);
tag.setInteger(NBT_VIEW_TYPE, viewType);
tag.setInteger(NBT_SORTING_DIRECTION, sortingDirection);
tag.setInteger(NBT_SORTING_TYPE, sortingType);
@@ -522,6 +519,8 @@ public class TileGrid extends TileNode implements IGrid, IWrenchable {
@Override
public void readConfiguration(NBTTagCompound tag) {
super.readConfiguration(tag);
if (tag.hasKey(NBT_VIEW_TYPE)) {
viewType = tag.getInteger(NBT_VIEW_TYPE);
}