Fix stuff and things
This commit is contained in:
@@ -182,7 +182,7 @@ public final class RSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static AccessType readAccessType(NBTTagCompound tag) {
|
public static AccessType readAccessType(NBTTagCompound tag) {
|
||||||
return tag.hasKey(NBT_ACCESS_TYPE) ? getAccessType(tag.getInteger(NBT_ACCESS_TYPE)) : AccessType.READ_WRITE;
|
return tag.hasKey(NBT_ACCESS_TYPE) ? getAccessType(tag.getInteger(NBT_ACCESS_TYPE)) : AccessType.EXTRACT_INSERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccessType getAccessType(int id) {
|
public static AccessType getAccessType(int id) {
|
||||||
@@ -192,7 +192,7 @@ public final class RSUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AccessType.READ_WRITE;
|
return AccessType.EXTRACT_INSERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IItemHandler getItemHandler(TileEntity tile, EnumFacing side) {
|
public static IItemHandler getItemHandler(TileEntity tile, EnumFacing side) {
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ package com.raoulvdberge.refinedstorage.api.storage;
|
|||||||
*/
|
*/
|
||||||
public enum AccessType {
|
public enum AccessType {
|
||||||
/**
|
/**
|
||||||
* Read and write access.
|
* Extract and insert ability.
|
||||||
*/
|
*/
|
||||||
READ_WRITE(0),
|
EXTRACT_INSERT(0),
|
||||||
/**
|
/**
|
||||||
* Only read access.
|
* Only extract ability.
|
||||||
*/
|
*/
|
||||||
READ(1),
|
EXTRACT(1),
|
||||||
/**
|
/**
|
||||||
* Only write access.
|
* Only insert ability.
|
||||||
*/
|
*/
|
||||||
WRITE(2);
|
INSERT(2);
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
|
|||||||
2
src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java
Normal file → Executable file
2
src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java
Normal file → Executable file
@@ -22,6 +22,6 @@ public interface IStorage<T> {
|
|||||||
* @return the access type of this storage
|
* @return the access type of this storage
|
||||||
*/
|
*/
|
||||||
default AccessType getAccessType() {
|
default AccessType getAccessType() {
|
||||||
return AccessType.READ_WRITE;
|
return AccessType.EXTRACT_INSERT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class FluidStorageCache implements IFluidStorageCache {
|
|||||||
list.clear();
|
list.clear();
|
||||||
|
|
||||||
for (IFluidStorage storage : storages) {
|
for (IFluidStorage storage : storages) {
|
||||||
if (storage.getAccessType() == AccessType.WRITE) {
|
if (storage.getAccessType() == AccessType.INSERT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ItemStorageCache implements IItemStorageCache {
|
|||||||
list.clear();
|
list.clear();
|
||||||
|
|
||||||
for (IItemStorage storage : storages) {
|
for (IItemStorage storage : storages) {
|
||||||
if (storage.getAccessType() == AccessType.WRITE) {
|
if (storage.getAccessType() == AccessType.INSERT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -520,13 +520,13 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
}
|
}
|
||||||
|
|
||||||
int orginalSize = size;
|
int orginalSize = size;
|
||||||
AccessType accessType = AccessType.READ_WRITE;
|
AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
ItemStack remainder = stack;
|
ItemStack remainder = stack;
|
||||||
|
|
||||||
for (IItemStorage storage : this.itemStorage.getStorages()) {
|
for (IItemStorage storage : this.itemStorage.getStorages()) {
|
||||||
accessType = storage.getAccessType();
|
accessType = storage.getAccessType();
|
||||||
|
|
||||||
if (accessType != AccessType.READ) {
|
if (accessType != AccessType.EXTRACT) {
|
||||||
remainder = storage.insertItem(remainder, size, simulate);
|
remainder = storage.insertItem(remainder, size, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
inserted = orginalSize - remainder.stackSize;
|
inserted = orginalSize - remainder.stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate && inserted > 0 && accessType != AccessType.WRITE) {
|
if (!simulate && inserted > 0 && accessType != AccessType.INSERT) {
|
||||||
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
||||||
ItemStack checkSteps = ItemHandlerHelper.copyStackWithSize(stack, inserted);
|
ItemStack checkSteps = ItemHandlerHelper.copyStackWithSize(stack, inserted);
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
for (IItemStorage storage : this.itemStorage.getStorages()) {
|
for (IItemStorage storage : this.itemStorage.getStorages()) {
|
||||||
ItemStack took = null;
|
ItemStack took = null;
|
||||||
|
|
||||||
if (storage.getAccessType() != AccessType.READ) {
|
if (storage.getAccessType() != AccessType.INSERT) {
|
||||||
took = storage.extractItem(stack, requested - received, flags);
|
took = storage.extractItem(stack, requested - received, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,13 +620,13 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
}
|
}
|
||||||
|
|
||||||
int orginalSize = size;
|
int orginalSize = size;
|
||||||
AccessType accessType = AccessType.READ_WRITE;
|
AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
FluidStack remainder = stack;
|
FluidStack remainder = stack;
|
||||||
|
|
||||||
for (IFluidStorage storage : this.fluidStorage.getStorages()) {
|
for (IFluidStorage storage : this.fluidStorage.getStorages()) {
|
||||||
accessType = storage.getAccessType();
|
accessType = storage.getAccessType();
|
||||||
|
|
||||||
if (accessType != AccessType.READ) {
|
if (accessType != AccessType.EXTRACT) {
|
||||||
remainder = storage.insertFluid(remainder, size, simulate);
|
remainder = storage.insertFluid(remainder, size, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
inserted = orginalSize - remainder.amount;
|
inserted = orginalSize - remainder.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate && inserted > 0 && accessType != AccessType.WRITE) {
|
if (!simulate && inserted > 0 && accessType != AccessType.INSERT) {
|
||||||
fluidStorage.add(RSUtils.copyStackWithSize(stack, inserted), false);
|
fluidStorage.add(RSUtils.copyStackWithSize(stack, inserted), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
for (IFluidStorage storage : this.fluidStorage.getStorages()) {
|
for (IFluidStorage storage : this.fluidStorage.getStorages()) {
|
||||||
FluidStack took = null;
|
FluidStack took = null;
|
||||||
|
|
||||||
if (storage.getAccessType() != AccessType.READ) {
|
if (storage.getAccessType() != AccessType.INSERT) {
|
||||||
took = storage.extractFluid(stack, requested - received, flags);
|
took = storage.extractFluid(stack, requested - received, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
|
|||||||
private ItemStorage itemStorages[] = new ItemStorage[8];
|
private ItemStorage itemStorages[] = new ItemStorage[8];
|
||||||
private FluidStorage fluidStorages[] = new FluidStorage[8];
|
private FluidStorage fluidStorages[] = new FluidStorage[8];
|
||||||
|
|
||||||
private AccessType accessType = AccessType.READ_WRITE;
|
private AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
private int priority = 0;
|
private int priority = 0;
|
||||||
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
||||||
private int mode = IFilterable.WHITELIST;
|
private int mode = IFilterable.WHITELIST;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
|
|||||||
|
|
||||||
private EnumFluidStorageType type;
|
private EnumFluidStorageType type;
|
||||||
|
|
||||||
private AccessType accessType = AccessType.READ_WRITE;
|
private AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
private int priority = 0;
|
private int priority = 0;
|
||||||
private int compare = IComparer.COMPARE_NBT;
|
private int compare = IComparer.COMPARE_NBT;
|
||||||
private int mode = IFilterable.WHITELIST;
|
private int mode = IFilterable.WHITELIST;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
|
|||||||
|
|
||||||
private EnumItemStorageType type;
|
private EnumItemStorageType type;
|
||||||
|
|
||||||
private AccessType accessType = AccessType.READ_WRITE;
|
private AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
private int priority = 0;
|
private int priority = 0;
|
||||||
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
||||||
private int mode = IFilterable.WHITELIST;
|
private int mode = IFilterable.WHITELIST;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
|
|
||||||
public interface IAccessType {
|
public interface IAccessType {
|
||||||
static <T extends TileEntity & IAccessType> TileDataParameter<AccessType> createParameter() {
|
static <T extends TileEntity & IAccessType> TileDataParameter<AccessType> createParameter() {
|
||||||
return new TileDataParameter<>(RSSerializers.ACCESS_TYPE_SERIALIZER, AccessType.READ_WRITE, new ITileDataProducer<AccessType, T>() {
|
return new TileDataParameter<>(RSSerializers.ACCESS_TYPE_SERIALIZER, AccessType.EXTRACT_INSERT, new ITileDataProducer<AccessType, T>() {
|
||||||
@Override
|
@Override
|
||||||
public AccessType getValue(T tile) {
|
public AccessType getValue(T tile) {
|
||||||
return tile.getAccessType();
|
return tile.getAccessType();
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ import java.util.List;
|
|||||||
public class ItemStorageItemHandler extends ItemStorageExternal {
|
public class ItemStorageItemHandler extends ItemStorageExternal {
|
||||||
private TileExternalStorage externalStorage;
|
private TileExternalStorage externalStorage;
|
||||||
private IItemHandler handler;
|
private IItemHandler handler;
|
||||||
private AccessType lockedAccessType = AccessType.READ_WRITE;
|
private AccessType lockedAccessType = AccessType.EXTRACT_INSERT;
|
||||||
|
|
||||||
public ItemStorageItemHandler(TileExternalStorage externalStorage, IItemHandler handler) {
|
public ItemStorageItemHandler(TileExternalStorage externalStorage, IItemHandler handler) {
|
||||||
this.externalStorage = externalStorage;
|
this.externalStorage = externalStorage;
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
|
|
||||||
if (externalStorage.getFacingTile().getBlockType().getUnlocalizedName().equals("tile.ExtraUtils2:TrashCan")) {
|
if (externalStorage.getFacingTile().getBlockType().getUnlocalizedName().equals("tile.ExtraUtils2:TrashCan")) {
|
||||||
lockedAccessType = AccessType.WRITE;
|
lockedAccessType = AccessType.INSERT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +100,6 @@ public class ItemStorageItemHandler extends ItemStorageExternal {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccessType getAccessType() {
|
public AccessType getAccessType() {
|
||||||
return ((lockedAccessType != AccessType.READ_WRITE) ? lockedAccessType : externalStorage.getAccessType());
|
return ((lockedAccessType != AccessType.EXTRACT_INSERT) ? lockedAccessType : externalStorage.getAccessType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
|
|||||||
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
||||||
private int mode = IFilterable.WHITELIST;
|
private int mode = IFilterable.WHITELIST;
|
||||||
private int type = IType.ITEMS;
|
private int type = IType.ITEMS;
|
||||||
private AccessType accessType = AccessType.READ_WRITE;
|
private AccessType accessType = AccessType.EXTRACT_INSERT;
|
||||||
|
|
||||||
private List<ItemStorageExternal> itemStorages = new ArrayList<>();
|
private List<ItemStorageExternal> itemStorages = new ArrayList<>();
|
||||||
private List<FluidStorageExternal> fluidStorages = new ArrayList<>();
|
private List<FluidStorageExternal> fluidStorages = new ArrayList<>();
|
||||||
|
|||||||
@@ -135,9 +135,9 @@ sidebutton.refinedstorage:constructor.drop=Drop blocks instead of placing
|
|||||||
sidebutton.refinedstorage:destructor.pickup=Pickup items instead of breaking
|
sidebutton.refinedstorage:destructor.pickup=Pickup items instead of breaking
|
||||||
|
|
||||||
sidebutton.refinedstorage:access_type=Access Type
|
sidebutton.refinedstorage:access_type=Access Type
|
||||||
sidebutton.refinedstorage:access_type.0=Read and write
|
sidebutton.refinedstorage:access_type.0=Insert and extract
|
||||||
sidebutton.refinedstorage:access_type.1=Read
|
sidebutton.refinedstorage:access_type.1=Only extract
|
||||||
sidebutton.refinedstorage:access_type.2=Write
|
sidebutton.refinedstorage:access_type.2=Only insert
|
||||||
|
|
||||||
block.refinedstorage:controller.0.name=Controller
|
block.refinedstorage:controller.0.name=Controller
|
||||||
block.refinedstorage:controller.1.name=Creative Controller
|
block.refinedstorage:controller.1.name=Creative Controller
|
||||||
|
|||||||
Reference in New Issue
Block a user