API compiles
This commit is contained in:
@@ -25,23 +25,23 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -112,7 +112,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickableTileEntity {
|
||||
private final AppEngInternalInventory inputInventory = new AppEngInternalInventory(this, 1);
|
||||
private final AppEngInternalInventory cellInventory = new AppEngInternalInventory(this, 1);
|
||||
private final IItemHandler internalInventory = new WrapperChainedItemHandler(this.inputInventory,
|
||||
private final ItemTransferable internalInventory = new WrapperChainedItemHandler(this.inputInventory,
|
||||
this.cellInventory);
|
||||
|
||||
private final IActionSource mySrc = new MachineSource(this);
|
||||
@@ -127,7 +127,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
private Accessor accessor;
|
||||
private IFluidHandler fluidHandler;
|
||||
|
||||
public ChestTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
public ChestTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
this.setInternalMaxPower(PowerMultiplier.CONFIG.multiply(40));
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
@@ -345,7 +345,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeToStream(final PacketBuffer data) throws IOException {
|
||||
protected void writeToStream(final PacketByteBuf data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
|
||||
if (this.world.getGameTime() - this.lastStateChange > 8) {
|
||||
@@ -369,7 +369,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream(final PacketBuffer data) throws IOException {
|
||||
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
|
||||
final boolean c = super.readFromStream(data);
|
||||
|
||||
final int oldState = this.state;
|
||||
@@ -424,13 +424,13 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInternalInventory() {
|
||||
public ItemTransferable getInternalInventory() {
|
||||
return this.internalInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
if (inv == this.cellInventory) {
|
||||
this.cellHandler = null;
|
||||
this.isCached = false; // recalculate the storage cell.
|
||||
@@ -455,7 +455,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IItemHandler getItemHandlerForSide(@Nonnull Direction side) {
|
||||
protected ItemTransferable getItemHandlerForSide(@Nonnull Direction side) {
|
||||
if (side == this.getForward()) {
|
||||
return this.cellInventory;
|
||||
} else {
|
||||
@@ -712,8 +712,8 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack getFluid() {
|
||||
return FluidStack.EMPTY;
|
||||
public FluidVolume getFluid() {
|
||||
return FluidVolume.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -727,7 +727,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
public boolean isFluidValid(FluidVolume stack) {
|
||||
return canAcceptLiquids();
|
||||
}
|
||||
|
||||
@@ -738,8 +738,8 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack getFluidInTank(int tank) {
|
||||
return FluidStack.EMPTY;
|
||||
public FluidVolume getFluidInTank(int tank) {
|
||||
return FluidVolume.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -748,12 +748,12 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFluidValid(int tank, @Nonnull FluidStack stack) {
|
||||
public boolean isFluidValid(int tank, @Nonnull FluidVolume stack) {
|
||||
return tank == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, FluidAction action) {
|
||||
public int fill(FluidVolume resource, FluidAction action) {
|
||||
ChestTileEntity.this.updateHandler();
|
||||
if (canAcceptLiquids()) {
|
||||
final IAEFluidStack results = Platform.poweredInsert(ChestTileEntity.this,
|
||||
@@ -771,25 +771,25 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, FluidAction action) {
|
||||
return FluidStack.EMPTY;
|
||||
public FluidVolume drain(FluidVolume resource, FluidAction action) {
|
||||
return FluidVolume.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, FluidAction action) {
|
||||
return FluidStack.EMPTY;
|
||||
public FluidVolume drain(int maxDrain, FluidAction action) {
|
||||
return FluidVolume.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
private class InputInventoryFilter implements IAEItemFilter {
|
||||
@Override
|
||||
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
if (ChestTileEntity.this.isPowered()) {
|
||||
ChestTileEntity.this.updateHandler();
|
||||
return ChestTileEntity.this.cellHandler != null && ChestTileEntity.this.cellHandler
|
||||
@@ -802,12 +802,12 @@ public class ChestTileEntity extends AENetworkPowerTileEntity
|
||||
private static class CellInventoryFilter implements IAEItemFilter {
|
||||
|
||||
@Override
|
||||
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
return AEApi.instance().registries().cell().getHandler(stack) != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -103,7 +103,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
*/
|
||||
private int state = 0;
|
||||
|
||||
public DriveTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
public DriveTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
this.mySrc = new MachineSource(this);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
@@ -112,7 +112,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeToStream(final PacketBuffer data) throws IOException {
|
||||
protected void writeToStream(final PacketByteBuf data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
int newState = 0;
|
||||
|
||||
@@ -127,13 +127,13 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
writeCellItemIds(data);
|
||||
}
|
||||
|
||||
private void writeCellItemIds(PacketBuffer data) {
|
||||
List<ResourceLocation> cellItemIds = new ArrayList<>(getCellCount());
|
||||
private void writeCellItemIds(PacketByteBuf data) {
|
||||
List<Identifier> cellItemIds = new ArrayList<>(getCellCount());
|
||||
byte[] bm = new byte[getCellCount()];
|
||||
for (int x = 0; x < this.getCellCount(); x++) {
|
||||
Item item = getCellItem(x);
|
||||
if (item != null && item.getRegistryName() != null) {
|
||||
ResourceLocation itemId = item.getRegistryName();
|
||||
Identifier itemId = item.getRegistryName();
|
||||
int idx = cellItemIds.indexOf(itemId);
|
||||
if (idx == -1) {
|
||||
cellItemIds.add(itemId);
|
||||
@@ -146,7 +146,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
|
||||
// Write out the list of unique cell item ids
|
||||
data.writeByte(cellItemIds.size());
|
||||
for (ResourceLocation itemId : cellItemIds) {
|
||||
for (Identifier itemId : cellItemIds) {
|
||||
data.writeResourceLocation(itemId);
|
||||
}
|
||||
// Then the lookup table for each slot
|
||||
@@ -156,7 +156,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream(final PacketBuffer data) throws IOException {
|
||||
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
|
||||
boolean c = super.readFromStream(data);
|
||||
final int oldState = this.state;
|
||||
this.state = data.readInt();
|
||||
@@ -166,7 +166,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
return (this.state & BIT_STATE_MASK) != (oldState & BIT_STATE_MASK) || c;
|
||||
}
|
||||
|
||||
private boolean readCellItemIDs(final PacketBuffer data) {
|
||||
private boolean readCellItemIDs(final PacketByteBuf data) {
|
||||
int uniqueStrCount = data.readByte();
|
||||
String[] uniqueStrs = new String[uniqueStrCount];
|
||||
for (int i = 0; i < uniqueStrCount; i++) {
|
||||
@@ -182,7 +182,7 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
if (idx > 0) {
|
||||
--idx;
|
||||
String itemId = uniqueStrs[idx];
|
||||
item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemId));
|
||||
item = ForgeRegistries.ITEMS.getValue(new Identifier(itemId));
|
||||
}
|
||||
if (cellItems[i] != item) {
|
||||
changed = true;
|
||||
@@ -303,13 +303,13 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInternalInventory() {
|
||||
public ItemTransferable getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
if (this.isCached) {
|
||||
this.isCached = false; // recalculate the storage cell.
|
||||
this.updateState();
|
||||
@@ -421,12 +421,12 @@ public class DriveTileEntity extends AENetworkInvTileEntity implements IChestOrD
|
||||
private class CellValidInventoryFilter implements IAEItemFilter {
|
||||
|
||||
@Override
|
||||
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
return !stack.isEmpty() && AEApi.instance().registries().cell().isCellHandled(stack);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -83,11 +83,11 @@ public class IOPortTileEntity extends AENetworkInvTileEntity
|
||||
|
||||
private final AppEngInternalInventory inputCells = new AppEngInternalInventory(this, NUMBER_OF_CELL_SLOTS);
|
||||
private final AppEngInternalInventory outputCells = new AppEngInternalInventory(this, NUMBER_OF_CELL_SLOTS);
|
||||
private final IItemHandler combinedInventory = new WrapperChainedItemHandler(this.inputCells, this.outputCells);
|
||||
private final ItemTransferable combinedInventory = new WrapperChainedItemHandler(this.inputCells, this.outputCells);
|
||||
|
||||
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler(this.inputCells,
|
||||
private final ItemTransferable inputCellsExt = new WrapperFilteredItemHandler(this.inputCells,
|
||||
AEItemFilters.INSERT_ONLY);
|
||||
private final IItemHandler outputCellsExt = new WrapperFilteredItemHandler(this.outputCells,
|
||||
private final ItemTransferable outputCellsExt = new WrapperFilteredItemHandler(this.outputCells,
|
||||
AEItemFilters.EXTRACT_ONLY);
|
||||
|
||||
private final UpgradeInventory upgrades;
|
||||
@@ -96,7 +96,7 @@ public class IOPortTileEntity extends AENetworkInvTileEntity
|
||||
private ItemStack currentCell;
|
||||
private Map<IStorageChannel<?>, IMEInventory<?>> cachedInventories;
|
||||
|
||||
public IOPortTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
public IOPortTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.manager = new ConfigManager(this);
|
||||
@@ -185,7 +185,7 @@ public class IOPortTileEntity extends AENetworkInvTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInventoryByName(final String name) {
|
||||
public ItemTransferable getInventoryByName(final String name) {
|
||||
if (name.equals("upgrades")) {
|
||||
return this.upgrades;
|
||||
}
|
||||
@@ -211,20 +211,20 @@ public class IOPortTileEntity extends AENetworkInvTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInternalInventory() {
|
||||
public ItemTransferable getInternalInventory() {
|
||||
return this.combinedInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
if (this.inputCells == inv) {
|
||||
this.updateTask();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IItemHandler getItemHandlerForSide(final Direction facing) {
|
||||
protected ItemTransferable getItemHandlerForSide(final Direction facing) {
|
||||
if (facing == this.getUp() || facing == this.getUp().getOpposite()) {
|
||||
return this.inputCellsExt;
|
||||
} else {
|
||||
|
||||
@@ -23,14 +23,14 @@ import java.io.IOException;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.tileentity.IChestLid;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
|
||||
import appeng.block.storage.SkyChestBlock;
|
||||
import appeng.tile.AEBaseInvTileEntity;
|
||||
@@ -48,18 +48,18 @@ public class SkyChestTileEntity extends AEBaseInvTileEntity implements ITickable
|
||||
private float lidAngle;
|
||||
private float prevLidAngle;
|
||||
|
||||
public SkyChestTileEntity(TileEntityType<? extends SkyChestTileEntity> type) {
|
||||
public SkyChestTileEntity(BlockEntityType<? extends SkyChestTileEntity> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeToStream(final PacketBuffer data) throws IOException {
|
||||
protected void writeToStream(final PacketByteBuf data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
data.writeBoolean(this.getPlayerOpen() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream(final PacketBuffer data) throws IOException {
|
||||
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
|
||||
final boolean c = super.readFromStream(data);
|
||||
final int wasOpen = this.getPlayerOpen();
|
||||
this.setPlayerOpen(data.readBoolean() ? 1 : 0);
|
||||
@@ -77,7 +77,7 @@ public class SkyChestTileEntity extends AEBaseInvTileEntity implements ITickable
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInternalInventory() {
|
||||
public ItemTransferable getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ public class SkyChestTileEntity extends AEBaseInvTileEntity implements ITickable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user