Refactored how cell state is exposed (#4422)

Replaced fuzzy ints with a well defined enum
Moved API related cell interfaces to a new subpackage
Introduced a new client helper method to register a cell texture for a storage channel
Added a method to obtain the storage channel for a drive or chest slot
Added a new cell state for cells with stored items but neither types nor completely full
This commit is contained in:
yueh
2020-06-22 22:18:41 +02:00
committed by GitHub
parent adf1bd0191
commit cb62d3a706
45 changed files with 224 additions and 118 deletions
@@ -20,6 +20,8 @@ package appeng.block.storage;
import net.minecraft.util.IStringSerializable;
import appeng.api.storage.cells.CellState;
/**
* Describes the different states a single slot of a BlockDrive can be in in
* terms of rendering.
@@ -52,16 +54,17 @@ public enum DriveSlotState implements IStringSerializable {
return this.name;
}
public static DriveSlotState fromCellStatus(int cellStatus) {
public static DriveSlotState fromCellStatus(CellState cellStatus) {
switch (cellStatus) {
default:
case 0:
case ABSENT:
return DriveSlotState.EMPTY;
case 1:
case EMPTY:
case NOT_EMPTY:
return DriveSlotState.ONLINE;
case 2:
case TYPES_FULL:
return DriveSlotState.TYPES_FULL;
case 3:
case FULL:
return DriveSlotState.FULL;
}
}
@@ -23,6 +23,7 @@ import com.google.common.base.Preconditions;
import net.minecraft.item.Item;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.cells.CellState;
/**
* Contains the full information about what the state of the slots in a
@@ -69,7 +70,7 @@ public class DriveSlotsState {
cells[i] = chestOrDrive.getCellItem(i);
if (!chestOrDrive.isPowered()) {
if (chestOrDrive.getCellStatus(i) != 0) {
if (chestOrDrive.getCellStatus(i) != CellState.EMPTY) {
states[i] = DriveSlotState.OFFLINE;
} else {
states[i] = DriveSlotState.EMPTY;
@@ -36,9 +36,9 @@ import appeng.api.config.CopyMode;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -44,7 +44,7 @@ import appeng.api.implementations.items.ISpatialStorageCell;
import appeng.api.implementations.items.IStorageComponent;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.items.misc.EncodedPatternItem;
import appeng.recipes.handlers.GrinderRecipes;
import appeng.tile.misc.InscriberRecipes;
-1
View File
@@ -84,5 +84,4 @@ public final class Api implements IAppEngApi {
public IClientHelper client() {
return this.client;
}
}
@@ -1,3 +1,20 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2020, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.api;
@@ -7,8 +24,8 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.api.config.IncludeExclude;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.IClientHelper;
import appeng.core.localization.GuiText;
@@ -48,4 +65,4 @@ public class ApiClientHelper implements IClientHelper {
}
}
}
@@ -20,11 +20,11 @@ package appeng.core.features.registries.cell;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.data.IAEStack;
import appeng.me.storage.BasicCellInventory;
import appeng.me.storage.BasicCellInventoryHandler;
@@ -7,10 +7,10 @@ import net.minecraft.tileentity.TileEntity;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.ICellGuiHandler;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellGuiHandler;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.container.ContainerLocator;
@@ -26,12 +26,12 @@ import com.google.common.base.Verify;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellGuiHandler;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.ICellRegistry;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellGuiHandler;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.data.IAEStack;
public class CellRegistry implements ICellRegistry {
@@ -21,10 +21,11 @@ package appeng.core.features.registries.cell;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.items.storage.CreativeStorageCellItem;
import appeng.me.storage.CreativeCellInventory;
@@ -47,12 +48,13 @@ public final class CreativeCellHandler implements ICellHandler {
}
@Override
public int getStatusForCell(final ItemStack is, final ICellInventoryHandler handler) {
return 2;
public CellState getStatusForCell(final ItemStack is, final ICellInventoryHandler handler) {
return CellState.TYPES_FULL;
}
@Override
public double cellIdleDrain(final ItemStack is, final ICellInventoryHandler handler) {
return 0;
}
}
@@ -24,10 +24,10 @@ import net.minecraft.tileentity.TileEntity;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.ICellGuiHandler;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellGuiHandler;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.container.ContainerLocator;
@@ -30,9 +30,9 @@ import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
@@ -25,7 +25,7 @@ import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -55,9 +55,9 @@ import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -57,8 +57,8 @@ import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.features.AEFeature;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -41,8 +41,8 @@ import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.ContainerLocator;
+1 -1
View File
@@ -69,9 +69,9 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPostCacheConstruction;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellProvider;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellProvider;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
+2 -2
View File
@@ -41,11 +41,11 @@ import appeng.api.networking.security.ISecurityGrid;
import appeng.api.networking.storage.IStackWatcher;
import appeng.api.networking.storage.IStackWatcherHost;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellProvider;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellContainer;
import appeng.api.storage.cells.ICellProvider;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -24,8 +24,9 @@ import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -289,13 +290,17 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
}
@Override
public int getStatusForCell() {
public CellState getStatusForCell() {
if (this.getStoredItemTypes() == 0) {
return CellState.EMPTY;
}
if (this.canHoldNewItem()) {
return 1;
return CellState.NOT_EMPTY;
}
if (this.getRemainingItemCount() > 0) {
return 2;
return CellState.TYPES_FULL;
}
return 3;
return CellState.FULL;
}
}
@@ -9,9 +9,9 @@ import appeng.api.config.Actionable;
import appeng.api.exceptions.AppEngException;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.core.AEConfig;
@@ -26,10 +26,10 @@ import appeng.api.config.FuzzyMode;
import appeng.api.config.IncludeExclude;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.util.prioritylist.FuzzyPriorityList;
@@ -24,9 +24,9 @@ import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -23,13 +23,14 @@ import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.data.IAEStack;
public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
private int oldStatus = 0;
private CellState oldStatus = CellState.EMPTY;
private final ItemStack is;
private final ICellHandler handler;
private final IChestOrDrive cord;
@@ -42,7 +43,7 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
this.cord = cod;
}
public int getStatus() {
public CellState getStatus() {
return this.handler.getStatusForCell(this.is, (ICellInventoryHandler) this.getInternal());
}
@@ -53,7 +54,7 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
final T a = super.injectItems(input, type, src);
if (type == Actionable.MODULATE && (a == null || a.getStackSize() != size)) {
final int newStatus = this.getStatus();
final CellState newStatus = this.getStatus();
if (newStatus != this.oldStatus) {
this.cord.blinkCell(this.getSlot());
@@ -69,7 +70,7 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
final T a = super.extractItems(request, type, src);
if (type == Actionable.MODULATE && a != null) {
final int newStatus = this.getStatus();
final CellState newStatus = this.getStatus();
if (newStatus != this.oldStatus) {
this.cord.blinkCell(this.getSlot());
@@ -14,9 +14,9 @@ import appeng.api.networking.security.IActionSource;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.cells.ICellContainer;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AECableType;
@@ -34,10 +34,10 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellContainer;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
@@ -168,4 +168,4 @@ public abstract class SharedStorageBusPart extends UpgradeablePart
public float getCableConnectionLength(AECableType cable) {
return 4;
}
}
}
@@ -58,14 +58,14 @@ import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.api.storage.cells.ICellContainer;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -4,8 +4,8 @@ package appeng.tile.inventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandlerModifiable;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.filter.IAEItemFilter;
@@ -31,7 +31,7 @@ import appeng.api.config.CopyMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.api.util.IConfigManager;
import appeng.tile.AEBaseTileEntity;
import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -69,10 +69,6 @@ import appeng.api.networking.security.IActionSource;
import appeng.api.networking.security.ISecurityGrid;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellGuiHandler;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
@@ -80,6 +76,11 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellGuiHandler;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
@@ -162,7 +163,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
final int oldState = this.state;
for (int x = 0; x < this.getCellCount(); x++) {
this.state |= (this.getCellStatus(x) << (3 * x));
this.state |= (this.getCellStatus(x).ordinal() << (3 * x));
}
if (this.isPowered()) {
@@ -242,9 +243,9 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
}
@Override
public int getCellStatus(final int slot) {
public CellState getCellStatus(final int slot) {
if (isRemote()) {
return (this.state >> (slot * 3)) & 3;
return CellState.values()[(this.state >> (slot * 3)) & 3];
}
this.updateHandler();
@@ -256,7 +257,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
return ch.getStatusForCell(cell, this.cellHandler.getInternalHandler());
}
return 0;
return CellState.ABSENT;
}
@Nullable
@@ -354,7 +355,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
}
for (int x = 0; x < this.getCellCount(); x++) {
this.state |= (this.getCellStatus(x) << (3 * x));
this.state |= (this.getCellStatus(x).ordinal() << (3 * x));
}
if (this.isPowered()) {
@@ -49,11 +49,12 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AECableType;
@@ -119,7 +120,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
newState |= BIT_POWER_MASK;
}
for (int x = 0; x < this.getCellCount(); x++) {
newState |= (this.getCellStatus(x) << (3 * x));
newState |= (this.getCellStatus(x).ordinal() << (3 * x));
}
data.writeInt(newState);
@@ -213,14 +214,14 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
}
@Override
public int getCellStatus(final int slot) {
public CellState getCellStatus(final int slot) {
if (Platform.isClient()) {
return (this.state >> (slot * 3)) & 3;
return CellState.values()[(this.state >> (slot * 3)) & 3];
}
final DriveWatcher handler = this.invBySlot[slot];
if (handler == null) {
return 0;
return CellState.ABSENT;
}
return handler.getStatus();
@@ -277,7 +278,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
}
for (int x = 0; x < this.getCellCount(); x++) {
newState |= (this.getCellStatus(x) << (3 * x));
newState |= (this.getCellStatus(x).ordinal() << (3 * x));
}
if (newState != this.state) {
@@ -446,4 +447,5 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
public ContainerType<?> getContainerType() {
return DriveContainer.TYPE;
}
}