API compiles

This commit is contained in:
Sebastian Hartte
2020-06-27 18:09:44 +02:00
parent ba71a82288
commit 80fbb58d4f
572 changed files with 2995 additions and 3037 deletions
@@ -22,16 +22,16 @@ import java.util.List;
import javax.annotation.Nonnull;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
import appeng.util.helpers.ItemHandlerUtil;
@@ -40,14 +40,14 @@ import appeng.util.inv.InvOperation;
public abstract class AEBaseInvTileEntity extends AEBaseTileEntity implements IAEAppEngInventory {
public AEBaseInvTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AEBaseInvTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
public void read(final CompoundTag data) {
super.read(data);
final IItemHandler inv = this.getInternalInventory();
final ItemTransferable inv = this.getInternalInventory();
if (inv != EmptyHandler.INSTANCE) {
final CompoundTag opt = data.getCompound("inv");
for (int x = 0; x < inv.getSlots(); x++) {
@@ -57,12 +57,13 @@ public abstract class AEBaseInvTileEntity extends AEBaseTileEntity implements IA
}
}
public abstract @Nonnull IItemHandler getInternalInventory();
public abstract @Nonnull
ItemTransferable getInternalInventory();
@Override
public CompoundTag write(final CompoundTag data) {
super.write(data);
final IItemHandler inv = this.getInternalInventory();
final ItemTransferable inv = this.getInternalInventory();
if (inv != EmptyHandler.INSTANCE) {
final CompoundTag opt = new CompoundTag();
for (int x = 0; x < inv.getSlots(); x++) {
@@ -80,7 +81,7 @@ public abstract class AEBaseInvTileEntity extends AEBaseTileEntity implements IA
@Override
public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
final IItemHandler inv = this.getInternalInventory();
final ItemTransferable inv = this.getInternalInventory();
for (int l = 0; l < inv.getSlots(); l++) {
final ItemStack is = inv.getStackInSlot(l);
@@ -91,10 +92,11 @@ public abstract class AEBaseInvTileEntity extends AEBaseTileEntity implements IA
}
@Override
public abstract void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removed,
ItemStack added);
public abstract void onChangeInventory(ItemTransferable inv, int slot, InvOperation mc, ItemStack removed,
ItemStack added);
protected @Nonnull IItemHandler getItemHandlerForSide(@Nonnull Direction side) {
protected @Nonnull
ItemTransferable getItemHandlerForSide(@Nonnull Direction side) {
return this.getInternalInventory();
}
+18 -18
View File
@@ -30,21 +30,21 @@ import javax.annotation.Nullable;
import io.netty.buffer.Unpooled;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
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.util.text.ITextComponent;
import net.minecraft.text.Text;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.util.ICommonTile;
@@ -62,10 +62,10 @@ import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommonTile, ICustomNameObject {
public class AEBaseTileEntity extends BlockEntity implements IOrientable, ICommonTile, ICustomNameObject {
private static final ThreadLocal<WeakReference<AEBaseTileEntity>> DROP_NO_ITEMS = new ThreadLocal<>();
private static final Map<Class<? extends TileEntity>, IStackSrc> ITEM_STACKS = new HashMap<>();
private static final Map<Class<? extends BlockEntity>, IStackSrc> ITEM_STACKS = new HashMap<>();
private int renderFragment = 0;
@Nullable
private String customName;
@@ -73,11 +73,11 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
private Direction up = Direction.UP;
private boolean markDirtyQueued = false;
public AEBaseTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AEBaseTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
public static void registerTileItem(final Class<? extends TileEntity> c, final IStackSrc wat) {
public static void registerTileItem(final Class<? extends BlockEntity> c, final IStackSrc wat) {
ITEM_STACKS.put(c, wat);
}
@@ -91,7 +91,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
}
@Nonnull
public TileEntity getTile() {
public BlockEntity getTile() {
return this;
}
@@ -162,7 +162,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
private CompoundTag writeUpdateData() {
final CompoundTag data = new CompoundTag();
final PacketBuffer stream = new PacketBuffer(Unpooled.buffer());
final PacketByteBuf stream = new PacketByteBuf(Unpooled.buffer());
try {
this.writeToStream(stream);
@@ -178,7 +178,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
return data;
}
private boolean readUpdateData(PacketBuffer stream) {
private boolean readUpdateData(PacketByteBuf stream) {
boolean output = false;
try {
@@ -221,14 +221,14 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
*/
@Override
public void handleUpdateTag(CompoundTag tag) {
final PacketBuffer stream = new PacketBuffer(Unpooled.copiedBuffer(tag.getByteArray("X")));
final PacketByteBuf stream = new PacketByteBuf(Unpooled.copiedBuffer(tag.getByteArray("X")));
if (this.readUpdateData(stream)) {
this.markForUpdate();
}
}
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
if (this.canBeRotated()) {
final Direction old_Forward = this.forward;
final Direction old_Up = this.up;
@@ -242,7 +242,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
return false;
}
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
if (this.canBeRotated()) {
final byte orientation = (byte) ((this.up.ordinal() << 3) | this.forward.ordinal());
data.writeByte(orientation);
@@ -334,7 +334,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
}
if (this instanceof ISegmentedInventory) {
final IItemHandler inv = ((ISegmentedInventory) this).getInventoryByName("config");
final ItemTransferable inv = ((ISegmentedInventory) this).getInventoryByName("config");
if (inv instanceof AppEngInternalAEInventory) {
final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory(null, target.getSlots());
@@ -392,7 +392,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
}
if (this instanceof ISegmentedInventory) {
final IItemHandler inv = ((ISegmentedInventory) this).getInventoryByName("config");
final ItemTransferable inv = ((ISegmentedInventory) this).getInventoryByName("config");
if (inv instanceof AppEngInternalAEInventory) {
((AppEngInternalAEInventory) inv).writeToNBT(output, "config");
}
@@ -402,7 +402,7 @@ public class AEBaseTileEntity extends TileEntity implements IOrientable, ICommon
}
@Override
public ITextComponent getCustomInventoryName() {
public Text getCustomInventoryName() {
return new StringTextComponent(
this.hasCustomInventoryName() ? this.customName : this.getClass().getSimpleName());
}
@@ -23,14 +23,14 @@ import java.util.Optional;
import javax.annotation.Nonnull;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.fabricmc.api.EnvType;
import net.minecraftforge.client.model.data.IModelData;
import appeng.api.AEApi;
@@ -41,21 +41,21 @@ import appeng.util.item.AEItemStack;
public class CraftingMonitorTileEntity extends CraftingTileEntity implements IColorableTile {
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
private Integer dspList;
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
private boolean updateList;
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.TRANSPARENT;
public CraftingMonitorTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CraftingMonitorTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
@@ -73,7 +73,7 @@ public class CraftingMonitorTileEntity extends CraftingTileEntity implements ICo
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeByte(this.paintedColor.ordinal());
@@ -20,8 +20,8 @@ package appeng.tile.crafting;
import java.util.Optional;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
@@ -30,7 +30,7 @@ import appeng.block.crafting.AbstractCraftingUnitBlock;
public class CraftingStorageTileEntity extends CraftingTileEntity {
private static final int KILO_SCALAR = 1024;
public CraftingStorageTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CraftingStorageTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -27,10 +27,10 @@ import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntity;
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.BlockView;
@@ -68,7 +68,7 @@ public class CraftingTileEntity extends AENetworkTileEntity implements IAEMultiB
private boolean isCoreBlock = false;
private CraftingCPUCluster cluster;
public CraftingTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CraftingTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setFlags(GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
@@ -258,7 +258,7 @@ public class CraftingTileEntity extends AENetworkTileEntity implements IAEMultiB
if (h == this) {
places.add(new WorldCoord(this));
} else {
final TileEntity te = (TileEntity) h;
final BlockEntity te = (BlockEntity) h;
for (final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS) {
final WorldCoord wc = new WorldCoord(te);
@@ -20,18 +20,19 @@ package appeng.tile.crafting;
import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.fabricmc.api.EnvType;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.render.model.IBakedModel;
import net.minecraft.client.render.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
@@ -39,9 +40,8 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraft.util.Identifier;
import net.fabricmc.api.Environment;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
@@ -52,10 +52,10 @@ import appeng.core.AppEng;
* Renders the item currently being crafted by the molecular assembler, as well
* as the light strip when it's powered.
*/
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
public class MolecularAssemblerRenderer extends TileEntityRenderer<MolecularAssemblerTileEntity> {
public static final ResourceLocation LIGHTS_MODEL = new ResourceLocation(AppEng.MOD_ID,
public static final Identifier LIGHTS_MODEL = new Identifier(AppEng.MOD_ID,
"block/molecular_assembler_lights");
private static final RenderType MC_161917_RENDERTYPE_FIX = createRenderType();
@@ -68,7 +68,7 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<MolecularAsse
@Override
public void render(MolecularAssemblerTileEntity molecularAssembler, float partialTicks, MatrixStack ms,
IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
VertexConsumerProvider bufferIn, int combinedLightIn, int combinedOverlayIn) {
AssemblerAnimationStatus status = molecularAssembler.getAnimationStatus();
if (status != null) {
@@ -89,8 +89,8 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<MolecularAsse
}
}
private void renderPowerLight(MatrixStack ms, IRenderTypeBuffer bufferIn, int combinedLightIn,
int combinedOverlayIn) {
private void renderPowerLight(MatrixStack ms, VertexConsumerProvider bufferIn, int combinedLightIn,
int combinedOverlayIn) {
// Render the translucent light overlay here instead of in the block, because
// thanks to the following MC
// bug, our particles would otherwise not be visible (because the glass pane
@@ -106,7 +106,7 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<MolecularAsse
}
private void renderStatus(MolecularAssemblerTileEntity molecularAssembler, MatrixStack ms,
IRenderTypeBuffer bufferIn, int combinedLightIn, AssemblerAnimationStatus status) {
VertexConsumerProvider bufferIn, int combinedLightIn, AssemblerAnimationStatus status) {
double centerX = molecularAssembler.getPos().getX() + 0.5f;
double centerY = molecularAssembler.getPos().getY() + 0.5f;
double centerZ = molecularAssembler.getPos().getZ() + 0.5f;
@@ -23,20 +23,20 @@ import java.util.List;
import javax.annotation.Nullable;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
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.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraft.server.world.ServerWorld;
import net.fabricmc.api.EnvType;
import net.minecraftforge.fml.hooks.BasicEventHooks;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -89,8 +89,8 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
private final CraftingInventory craftingInv;
private final AppEngInternalInventory gridInv = new AppEngInternalInventory(this, 9 + 1, 1);
private final AppEngInternalInventory patternInv = new AppEngInternalInventory(this, 1, 1);
private final IItemHandler gridInvExt = new WrapperFilteredItemHandler(this.gridInv, new CraftingGridFilter());
private final IItemHandler internalInv = new WrapperChainedItemHandler(this.gridInv, this.patternInv);
private final ItemTransferable gridInvExt = new WrapperFilteredItemHandler(this.gridInv, new CraftingGridFilter());
private final ItemTransferable internalInv = new WrapperChainedItemHandler(this.gridInv, this.patternInv);
private final IConfigManager settings;
private final UpgradeInventory upgrades;
private boolean isPowered = false;
@@ -102,10 +102,10 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
private boolean forcePlan = false;
private boolean reboot = true;
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
private AssemblerAnimationStatus animationStatus;
public MolecularAssemblerTileEntity(TileEntityType<?> tileEntityTypeIn) {
public MolecularAssemblerTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
final ITileDefinition assembler = AEApi.instance().definitions().blocks().molecularAssembler();
@@ -187,7 +187,7 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final boolean oldPower = this.isPowered;
this.isPowered = data.readBoolean();
@@ -195,7 +195,7 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.isPowered);
}
@@ -289,7 +289,7 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
if (name.equals("upgrades")) {
return this.upgrades;
}
@@ -307,18 +307,18 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return this.internalInv;
}
@Override
protected IItemHandler getItemHandlerForSide(Direction side) {
protected ItemTransferable getItemHandlerForSide(Direction side) {
return this.gridInvExt;
}
@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.gridInv || inv == this.patternInv) {
this.recalculatePlan();
}
@@ -488,7 +488,7 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
return output;
}
final TileEntity te = this.getWorld().getTileEntity(this.pos.offset(d));
final BlockEntity te = this.getWorld().getTileEntity(this.pos.offset(d));
if (te == null) {
return output;
@@ -542,12 +542,12 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
return this.isPowered;
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
public void setAnimationStatus(@Nullable AssemblerAnimationStatus status) {
this.animationStatus = status;
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
@Nullable
public AssemblerAnimationStatus getAnimationStatus() {
return this.animationStatus;
@@ -560,12 +560,12 @@ public class MolecularAssemblerTileEntity extends AENetworkInvTileEntity
}
@Override
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
return slot == 9;
}
@Override
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
if (slot >= 9) {
return false;
}
@@ -18,8 +18,8 @@
package appeng.tile.grid;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
@@ -32,7 +32,7 @@ public abstract class AENetworkInvTileEntity extends AEBaseInvTileEntity impleme
private final AENetworkProxy gridProxy = new AENetworkProxy(this, "proxy", this.getItemFromTile(this), true);
public AENetworkInvTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AENetworkInvTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -19,7 +19,7 @@
package appeng.tile.grid;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
@@ -34,7 +34,7 @@ public abstract class AENetworkPowerTileEntity extends AEBasePoweredTileEntity i
private final AENetworkProxy gridProxy = new AENetworkProxy(this, "proxy", this.getItemFromTile(this), true);
public AENetworkPowerTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AENetworkPowerTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -18,8 +18,8 @@
package appeng.tile.grid;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
@@ -34,7 +34,7 @@ public class AENetworkTileEntity extends AEBaseTileEntity implements IActionHost
private final AENetworkProxy gridProxy = this.createProxy();
public AENetworkTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AENetworkTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -21,10 +21,10 @@ package appeng.tile.grindstone;
import java.io.IOException;
import net.minecraft.block.BlockState;
import net.minecraft.network.PacketBuffer;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.Direction;
import appeng.api.implementations.tiles.ICrankable;
@@ -41,7 +41,7 @@ public class CrankTileEntity extends AEBaseTileEntity implements ITickableTileEn
private int hits = 0;
private int rotation = 0;
public CrankTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CrankTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -68,7 +68,7 @@ public class CrankTileEntity extends AEBaseTileEntity implements ITickableTileEn
}
final Direction grinder = this.getUp().getOpposite();
final TileEntity te = this.world.getTileEntity(this.pos.offset(grinder));
final BlockEntity te = this.world.getTileEntity(this.pos.offset(grinder));
if (te instanceof ICrankable) {
return (ICrankable) te;
}
@@ -76,14 +76,14 @@ public class CrankTileEntity extends AEBaseTileEntity implements ITickableTileEn
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
this.rotation = data.readInt();
return c;
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeInt(this.rotation);
}
@@ -21,11 +21,11 @@ package appeng.tile.grindstone;
import java.util.ArrayList;
import java.util.List;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.RangedWrapper;
import appeng.api.implementations.tiles.ICrankable;
@@ -45,10 +45,10 @@ public class GrinderTileEntity extends AEBaseInvTileEntity implements ICrankable
private static final int SLOT_PROCESSING = 6;
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 7);
private final IItemHandler invExt = new WrapperFilteredItemHandler(this.inv, new GrinderFilter());
private final ItemTransferable invExt = new WrapperFilteredItemHandler(this.inv, new GrinderFilter());
private int points;
public GrinderTileEntity(TileEntityType<?> tileEntityTypeIn) {
public GrinderTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -60,18 +60,18 @@ public class GrinderTileEntity extends AEBaseInvTileEntity implements ICrankable
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return this.inv;
}
@Override
protected IItemHandler getItemHandlerForSide(Direction side) {
protected ItemTransferable getItemHandlerForSide(Direction side) {
return this.invExt;
}
@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) {
}
@@ -162,12 +162,12 @@ public class GrinderTileEntity extends AEBaseInvTileEntity implements ICrankable
private class GrinderFilter implements IAEItemFilter {
@Override
public boolean allowExtract(IItemHandler inv, int slotIndex, int amount) {
public boolean allowExtract(ItemTransferable inv, int slotIndex, int amount) {
return slotIndex >= 3 && slotIndex <= 5;
}
@Override
public boolean allowInsert(IItemHandler inv, int slotIndex, ItemStack stack) {
public boolean allowInsert(ItemTransferable inv, int slotIndex, ItemStack stack) {
if (!GrinderRecipes.isValidIngredient(world, stack)) {
return false;
}
@@ -20,12 +20,12 @@ package appeng.tile.misc;
import java.util.List;
import alexiil.mc.lib.attributes.item.ItemTransferable;
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.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.CopyMode;
import appeng.api.config.Settings;
@@ -49,17 +49,17 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 63);
private final ConfigManager manager = new ConfigManager(this);
private IItemHandler cacheUpgrades = null;
private IItemHandler cacheConfig = null;
private ItemTransferable cacheUpgrades = null;
private ItemTransferable cacheConfig = null;
private boolean locked = false;
public CellWorkbenchTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CellWorkbenchTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.manager.registerSetting(Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE);
this.cell.setEnableClientEvents(true);
}
public IItemHandler getCellUpgradeInventory() {
public ItemTransferable getCellUpgradeInventory() {
if (this.cacheUpgrades == null) {
final ICellWorkbenchItem cell = this.getCell();
if (cell == null) {
@@ -71,7 +71,7 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
return null;
}
final IItemHandler inv = cell.getUpgradesInventory(is);
final ItemTransferable inv = cell.getUpgradesInventory(is);
if (inv == null) {
return null;
}
@@ -111,7 +111,7 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
if (name.equals("config")) {
return this.config;
}
@@ -129,15 +129,15 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
if (inv == this.cell && !this.locked) {
this.locked = true;
this.cacheUpgrades = null;
this.cacheConfig = null;
final IItemHandler configInventory = this.getCellConfigInventory();
final ItemTransferable configInventory = this.getCellConfigInventory();
if (configInventory != null) {
boolean cellHasConfig = false;
for (int x = 0; x < configInventory.getSlots(); x++) {
@@ -165,7 +165,7 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
this.locked = false;
} else if (inv == this.config && !this.locked) {
this.locked = true;
final IItemHandler c = this.getCellConfigInventory();
final ItemTransferable c = this.getCellConfigInventory();
if (c != null) {
ItemHandlerUtil.copy(this.config, c, false);
// copy items back. The ConfigInventory may changed the items on insert
@@ -175,7 +175,7 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
}
}
private IItemHandler getCellConfigInventory() {
private ItemTransferable getCellConfigInventory() {
if (this.cacheConfig == null) {
final ICellWorkbenchItem cell = this.getCell();
if (cell == null) {
@@ -187,7 +187,7 @@ public class CellWorkbenchTileEntity extends AEBaseTileEntity
return null;
}
final IItemHandler inv = cell.getConfigInventory(is);
final ItemTransferable inv = cell.getConfigInventory(is);
if (inv == null) {
return null;
}
@@ -23,12 +23,12 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -62,7 +62,7 @@ public class ChargerTileEntity extends AENetworkPowerTileEntity implements ICran
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1, 1, new ChargerInvFilter());
public ChargerTileEntity(TileEntityType<?> tileEntityTypeIn) {
public ChargerTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
this.getProxy().setFlags();
@@ -76,7 +76,7 @@ public class ChargerTileEntity extends AENetworkPowerTileEntity implements ICran
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
try {
final IAEItemStack item = AEItemStack.fromPacket(data);
@@ -89,7 +89,7 @@ public class ChargerTileEntity extends AENetworkPowerTileEntity implements ICran
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
final AEItemStack is = AEItemStack.fromItemStack(this.inv.getStackInSlot(0));
if (is != null) {
@@ -132,13 +132,13 @@ public class ChargerTileEntity extends AENetworkPowerTileEntity implements ICran
}
@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) {
try {
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
} catch (final GridAccessException e) {
@@ -253,14 +253,14 @@ public class ChargerTileEntity extends AENetworkPowerTileEntity implements ICran
private class ChargerInvFilter implements IAEItemFilter {
@Override
public boolean allowInsert(IItemHandler inv, final int i, final ItemStack itemstack) {
public boolean allowInsert(ItemTransferable inv, final int i, final ItemStack itemstack) {
final IItemDefinition cert = AEApi.instance().definitions().materials().certusQuartzCrystal();
return Platform.isChargeable(itemstack) || cert.isSameAs(itemstack);
}
@Override
public boolean allowExtract(IItemHandler inv, final int slotIndex, int amount) {
public boolean allowExtract(ItemTransferable inv, final int slotIndex, int amount) {
ItemStack extractedItem = inv.getStackInSlot(slotIndex);
if (Platform.isChargeable(extractedItem)) {
@@ -21,19 +21,19 @@ package appeng.tile.misc;
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.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.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.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.CondenserOutput;
@@ -69,18 +69,18 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
private final AppEngInternalInventory outputSlot = new AppEngInternalInventory(this, 1);
private final AppEngInternalInventory storageSlot = new AppEngInternalInventory(this, 1);
private final IItemHandler inputSlot = new CondenseItemHandler();
private final ItemTransferable inputSlot = new CondenseItemHandler();
private final IFluidHandler fluidHandler = new FluidHandler();
private final MEHandler meHandler = new MEHandler();
private final IItemHandler externalInv = new WrapperChainedItemHandler(this.inputSlot,
private final ItemTransferable externalInv = new WrapperChainedItemHandler(this.inputSlot,
new WrapperFilteredItemHandler(this.outputSlot, AEItemFilters.EXTRACT_ONLY));
private final IItemHandler combinedInv = new WrapperChainedItemHandler(this.inputSlot, this.outputSlot,
private final ItemTransferable combinedInv = new WrapperChainedItemHandler(this.inputSlot, this.outputSlot,
this.storageSlot);
private double storedPower = 0;
public CondenserTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CondenserTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.cm.registerSetting(Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH);
}
@@ -142,7 +142,7 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
this.outputSlot.insertItem(0, output, false);
}
IItemHandler getOutputSlot() {
ItemTransferable getOutputSlot() {
return this.outputSlot;
}
@@ -167,13 +167,13 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return this.combinedInv;
}
@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.outputSlot) {
this.meHandler.outputChanged(added, removed);
}
@@ -210,7 +210,7 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
return super.getCapability(capability, facing);
}
private class CondenseItemHandler implements IItemHandler {
private class CondenseItemHandler implements ItemTransferable {
@Override
public int getSlots() {
@@ -259,8 +259,8 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
@Nonnull
@Override
public FluidStack getFluid() {
return FluidStack.EMPTY;
public FluidVolume getFluid() {
return FluidVolume.EMPTY;
}
@Override
@@ -274,12 +274,12 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
}
@Override
public boolean isFluidValid(FluidStack stack) {
public boolean isFluidValid(FluidVolume stack) {
return !stack.isEmpty();
}
@Override
public int fill(FluidStack resource, FluidAction action) {
public int fill(FluidVolume resource, FluidAction action) {
if (action == FluidAction.EXECUTE) {
final IStorageChannel<IAEFluidStack> chan = AEApi.instance().storage()
.getStorageChannel(IFluidStorageChannel.class);
@@ -292,14 +292,14 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
@Nonnull
@Override
public FluidStack drain(int maxDrain, FluidAction action) {
return FluidStack.EMPTY;
public FluidVolume drain(int maxDrain, FluidAction action) {
return FluidVolume.EMPTY;
}
@Nonnull
@Override
public FluidStack drain(FluidStack resource, FluidAction action) {
return FluidStack.EMPTY;
public FluidVolume drain(FluidVolume resource, FluidAction action) {
return FluidVolume.EMPTY;
}
@Override
@@ -309,8 +309,8 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
@Nonnull
@Override
public FluidStack getFluidInTank(int tank) {
return FluidStack.EMPTY;
public FluidVolume getFluidInTank(int tank) {
return FluidVolume.EMPTY;
}
@Override
@@ -319,7 +319,7 @@ public class CondenserTileEntity extends AEBaseInvTileEntity implements IConfigM
}
@Override
public boolean isFluidValid(int tank, @Nonnull FluidStack stack) {
public boolean isFluidValid(int tank, @Nonnull FluidVolume stack) {
return tank == 0 && isFluidValid(stack);
}
}
@@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
@@ -29,7 +29,7 @@ import appeng.recipes.handlers.InscriberRecipe;
*/
public final class InscriberRecipes {
public static final ResourceLocation NAMEPLATE_RECIPE_ID = new ResourceLocation(AppEng.MOD_ID, "nameplate");
public static final Identifier NAMEPLATE_RECIPE_ID = new Identifier(AppEng.MOD_ID, "nameplate");
private InscriberRecipes() {
}
@@ -25,14 +25,14 @@ import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
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 net.minecraftforge.items.IItemHandlerModifiable;
import appeng.api.AEApi;
@@ -89,16 +89,16 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
private final AppEngInternalInventory bottomItemHandler = new AppEngInternalInventory(this, 1, 1);
private final AppEngInternalInventory sideItemHandler = new AppEngInternalInventory(this, 2, 1);
private final IItemHandler topItemHandlerExtern;
private final IItemHandler bottomItemHandlerExtern;
private final IItemHandler sideItemHandlerExtern;
private final ItemTransferable topItemHandlerExtern;
private final ItemTransferable bottomItemHandlerExtern;
private final ItemTransferable sideItemHandlerExtern;
private InscriberRecipe cachedTask = null;
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler(this.topItemHandler,
this.bottomItemHandler, this.sideItemHandler);
public InscriberTileEntity(TileEntityType<?> tileEntityTypeIn) {
public InscriberTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
@@ -142,7 +142,7 @@ public class InscriberTileEntity 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 slot = data.readByte();
@@ -167,7 +167,7 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
int slot = this.isSmash() ? 64 : 0;
@@ -206,13 +206,13 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
}
@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) {
try {
if (slot == 0) {
this.setProcessingTime(0);
@@ -341,7 +341,7 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
if (name.equals("inv")) {
return this.getInternalInventory();
}
@@ -354,7 +354,7 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
}
@Override
protected IItemHandler getItemHandlerForSide(@Nonnull Direction facing) {
protected ItemTransferable getItemHandlerForSide(@Nonnull Direction facing) {
if (facing == this.getUp()) {
return this.topItemHandlerExtern;
} else if (facing == this.getUp().getOpposite()) {
@@ -410,7 +410,7 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
*/
private class ItemHandlerFilter implements IAEItemFilter {
@Override
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
if (InscriberTileEntity.this.isSmash()) {
return false;
}
@@ -420,7 +420,7 @@ public class InscriberTileEntity extends AENetworkPowerTileEntity
}
@Override
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
// output slot
if (slot == 1) {
return false;
@@ -30,15 +30,15 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.block.entity.BlockEntity;
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.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -75,7 +75,7 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
// Indicates that this interface has no specific direction set
private boolean omniDirectional = true;
public InterfaceTileEntity(TileEntityType<?> tileEntityTypeIn) {
public InterfaceTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -166,7 +166,7 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
boolean oldOmniDirectional = this.omniDirectional;
this.omniDirectional = data.readBoolean();
@@ -174,7 +174,7 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.omniDirectional);
}
@@ -195,7 +195,7 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
return this.duality.getInventoryByName(name);
}
@@ -210,13 +210,13 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return this.duality.getInternalInventory();
}
@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) {
this.duality.onChangeInventory(inv, slot, mc, removed, added);
}
@@ -234,7 +234,7 @@ public class InterfaceTileEntity extends AENetworkInvTileEntity
}
@Override
public TileEntity getTileEntity() {
public BlockEntity getTileEntity() {
return this;
}
@@ -19,7 +19,7 @@
package appeng.tile.misc;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import appeng.tile.AEBaseTileEntity;
import appeng.util.Platform;
@@ -29,7 +29,7 @@ public class LightDetectorTileEntity extends AEBaseTileEntity implements ITickab
private int lastCheck = 30;
private int lastLight = 0;
public LightDetectorTileEntity(TileEntityType<?> tileEntityTypeIn) {
public LightDetectorTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -32,8 +32,8 @@ import io.netty.buffer.Unpooled;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -57,7 +57,7 @@ public class PaintSplotchesTileEntity extends AEBaseTileEntity {
private int isLit = 0;
private List<Splotch> dots = null;
public PaintSplotchesTileEntity(TileEntityType<?> tileEntityTypeIn) {
public PaintSplotchesTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -69,7 +69,7 @@ public class PaintSplotchesTileEntity extends AEBaseTileEntity {
@Override
public CompoundTag write(final CompoundTag data) {
super.write(data);
final PacketBuffer myDat = new PacketBuffer(Unpooled.buffer());
final PacketByteBuf myDat = new PacketByteBuf(Unpooled.buffer());
this.writeBuffer(myDat);
if (myDat.hasArray()) {
data.putByteArray("dots", myDat.array());
@@ -77,7 +77,7 @@ public class PaintSplotchesTileEntity extends AEBaseTileEntity {
return data;
}
private void writeBuffer(final PacketBuffer out) {
private void writeBuffer(final PacketByteBuf out) {
if (this.dots == null) {
out.writeByte(0);
return;
@@ -94,11 +94,11 @@ public class PaintSplotchesTileEntity extends AEBaseTileEntity {
public void read(final CompoundTag data) {
super.read(data);
if (data.contains("dots")) {
this.readBuffer(new PacketBuffer(Unpooled.copiedBuffer(data.getByteArray("dots"))));
this.readBuffer(new PacketByteBuf(Unpooled.copiedBuffer(data.getByteArray("dots"))));
}
}
private void readBuffer(final PacketBuffer in) {
private void readBuffer(final PacketByteBuf in) {
final byte howMany = in.readByte();
if (howMany == 0) {
@@ -133,13 +133,13 @@ public class PaintSplotchesTileEntity extends AEBaseTileEntity {
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
this.writeBuffer(data);
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
super.readFromStream(data);
this.readBuffer(data);
return true;
@@ -21,8 +21,8 @@ package appeng.tile.misc;
import java.io.IOException;
import java.util.EnumSet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import appeng.api.implementations.IPowerChannelState;
@@ -40,7 +40,7 @@ public class QuartzGrowthAcceleratorTileEntity extends AENetworkTileEntity
private boolean hasPower = false;
public QuartzGrowthAcceleratorTileEntity(TileEntityType<?> tileEntityTypeIn) {
public QuartzGrowthAcceleratorTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
this.getProxy().setFlags();
@@ -58,7 +58,7 @@ public class QuartzGrowthAcceleratorTileEntity extends AENetworkTileEntity
}
@Override
public boolean readFromStream(final PacketBuffer data) throws IOException {
public boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final boolean hadPower = this.isPowered();
this.setPowered(data.readBoolean());
@@ -66,7 +66,7 @@ public class QuartzGrowthAcceleratorTileEntity extends AENetworkTileEntity
}
@Override
public void writeToStream(final PacketBuffer data) throws IOException {
public void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
try {
data.writeBoolean(this.getProxy().getEnergy().isNetworkPowered());
@@ -23,18 +23,18 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.INBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
@@ -92,7 +92,7 @@ public class SecurityStationTileEntity extends AENetworkTileEntity implements IT
private AEColor paintedColor = AEColor.TRANSPARENT;
private boolean isActive = false;
public SecurityStationTileEntity(TileEntityType<?> tileEntityTypeIn) {
public SecurityStationTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.getProxy().setIdlePowerUsage(2.0);
@@ -109,8 +109,8 @@ public class SecurityStationTileEntity extends AENetworkTileEntity implements IT
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
}
@@ -130,7 +130,7 @@ public class SecurityStationTileEntity extends AENetworkTileEntity implements IT
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final boolean wasActive = this.isActive;
this.isActive = data.readBoolean();
@@ -142,7 +142,7 @@ public class SecurityStationTileEntity extends AENetworkTileEntity implements IT
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.getProxy().isActive());
data.writeByte(this.paintedColor.ordinal());
@@ -18,13 +18,13 @@
package appeng.tile.misc;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import appeng.tile.AEBaseTileEntity;
public class SkyCompassTileEntity extends AEBaseTileEntity {
public SkyCompassTileEntity(TileEntityType<?> tileEntityTypeIn) {
public SkyCompassTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -22,14 +22,14 @@ import java.io.IOException;
import javax.annotation.Nonnull;
import alexiil.mc.lib.attributes.item.ItemTransferable;
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.network.PacketByteBuf;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
import appeng.api.networking.IGridNode;
@@ -55,7 +55,7 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
public static final int MAX_BURN_SPEED = 200;
public static final double DILATION_SCALING = 25.0; // x4 ~ 40 AE/t at max
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1);
private final IItemHandler invExt = new WrapperFilteredItemHandler(this.inv, new FuelSlotFilter());
private final ItemTransferable invExt = new WrapperFilteredItemHandler(this.inv, new FuelSlotFilter());
private int burnSpeed = 100;
private double burnTime = 0;
@@ -64,7 +64,7 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
// client side..
public boolean isOn;
public VibrationChamberTileEntity(TileEntityType<?> tileEntityTypeIn) {
public VibrationChamberTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0);
this.getProxy().setFlags();
@@ -76,7 +76,7 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final boolean wasOn = this.isOn;
@@ -86,7 +86,7 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.getBurnTime() > 0);
}
@@ -109,18 +109,18 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
}
@Override
protected IItemHandler getItemHandlerForSide(@Nonnull Direction facing) {
protected ItemTransferable getItemHandlerForSide(@Nonnull Direction facing) {
return this.invExt;
}
@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.getBurnTime() <= 0) {
if (this.canEatFuel()) {
try {
@@ -269,12 +269,12 @@ public class VibrationChamberTileEntity extends AENetworkInvTileEntity implement
private class FuelSlotFilter implements IAEItemFilter {
@Override
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
return ForgeHooks.getBurnTime(inv.getStackInSlot(slot)) == 0;
}
@Override
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
return ForgeHooks.getBurnTime(stack) != 0;
}
}
@@ -18,9 +18,9 @@
package appeng.tile.networking;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.math.Direction;
@@ -34,7 +34,7 @@ public class CableBusTESR extends TileEntityRenderer<CableBusTileEntity> {
}
@Override
public void render(CableBusTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers,
public void render(CableBusTileEntity te, float partialTicks, MatrixStack ms, VertexConsumerProvider buffers,
int combinedLightIn, int combinedOverlayIn) {
if (!te.getCableBus().isRequiresDynamicRender()) {
return;
@@ -25,11 +25,11 @@ import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -63,7 +63,7 @@ public class CableBusTileEntity extends AEBaseTileEntity implements AEMultiTile
private int oldLV = -1; // on re-calculate light when it changes
public CableBusTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CableBusTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@@ -81,7 +81,7 @@ public class CableBusTileEntity extends AEBaseTileEntity implements AEMultiTile
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
protected boolean readFromStream(final PacketByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
boolean ret = this.getCableBus().readFromStream(data);
@@ -97,7 +97,7 @@ public class CableBusTileEntity extends AEBaseTileEntity implements AEMultiTile
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
this.getCableBus().writeToStream(data);
}
@@ -21,11 +21,11 @@ package appeng.tile.networking;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
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.util.math.ChunkPos;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraftforge.items.wrapper.EmptyHandler;
import appeng.api.config.Actionable;
@@ -48,7 +48,7 @@ import appeng.util.inv.InvOperation;
public class ControllerTileEntity extends AENetworkPowerTileEntity {
private boolean isValid = false;
public ControllerTileEntity(TileEntityType<?> tileEntityTypeIn) {
public ControllerTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower(8000);
this.setInternalPublicPowerStorage(true);
@@ -168,13 +168,13 @@ public class ControllerTileEntity extends AENetworkPowerTileEntity {
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return EmptyHandler.INSTANCE;
}
@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) {
}
/**
@@ -18,7 +18,7 @@
package appeng.tile.networking;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -30,7 +30,7 @@ import appeng.tile.grid.AENetworkTileEntity;
public class CreativeEnergyCellTileEntity extends AENetworkTileEntity implements IAEPowerStorage {
public CreativeEnergyCellTileEntity(TileEntityType<?> tileEntityTypeIn) {
public CreativeEnergyCellTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0);
}
@@ -18,11 +18,11 @@
package appeng.tile.networking;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
public class DenseEnergyCellTileEntity extends EnergyCellTileEntity {
public DenseEnergyCellTileEntity(TileEntityType<?> tileEntityTypeIn) {
public DenseEnergyCellTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower(200000 * 8);
}
@@ -18,9 +18,9 @@
package appeng.tile.networking;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraftforge.items.wrapper.EmptyHandler;
import appeng.api.config.Actionable;
@@ -33,7 +33,7 @@ import appeng.util.inv.InvOperation;
public class EnergyAcceptorTileEntity extends AENetworkPowerTileEntity {
public EnergyAcceptorTileEntity(TileEntityType<?> tileEntityTypeIn) {
public EnergyAcceptorTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0.0);
this.setInternalMaxPower(0);
@@ -68,13 +68,13 @@ public class EnergyAcceptorTileEntity extends AENetworkPowerTileEntity {
}
@Override
public IItemHandler getInternalInventory() {
public ItemTransferable getInternalInventory() {
return EmptyHandler.INSTANCE;
}
@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) {
}
}
@@ -18,8 +18,8 @@
package appeng.tile.networking;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -41,7 +41,7 @@ public class EnergyCellTileEntity extends AENetworkTileEntity implements IAEPowe
private byte currentMeta = -1;
public EnergyCellTileEntity(TileEntityType<?> tileEntityTypeIn) {
public EnergyCellTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0);
}
@@ -21,11 +21,11 @@ package appeng.tile.networking;
import java.io.IOException;
import java.util.EnumSet;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.implementations.IPowerChannelState;
@@ -54,7 +54,7 @@ public class WirelessTileEntity extends AENetworkInvTileEntity implements IWirel
private int clientFlags = 0;
public WirelessTileEntity(TileEntityType<?> tileEntityTypeIn) {
public WirelessTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.inv.setFilter(new AEItemDefinitionFilter(AEApi.instance().definitions().materials().wirelessBooster()));
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
@@ -78,7 +78,7 @@ public class WirelessTileEntity extends AENetworkInvTileEntity implements IWirel
}
@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 old = this.getClientFlags();
this.setClientFlags(data.readByte());
@@ -87,7 +87,7 @@ public class WirelessTileEntity extends AENetworkInvTileEntity implements IWirel
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
this.setClientFlags(0);
@@ -117,13 +117,13 @@ public class WirelessTileEntity extends AENetworkInvTileEntity implements IWirel
}
@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) {
// :P
}
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableSet;
import net.minecraft.nbt.CompoundTag;
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;
@@ -59,7 +59,7 @@ public abstract class AEBasePoweredTileEntity extends AEBaseInvTileEntity
// IC2 private IC2PowerSink ic2Sink;
public AEBasePoweredTileEntity(TileEntityType<?> tileEntityTypeIn) {
public AEBasePoweredTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.forgeEnergyAdapter = new ForgeEnergyAdapter(this);
this.forgeEnergyAdapterOptional = LazyOptional.of(() -> forgeEnergyAdapter);
@@ -24,18 +24,18 @@ import java.util.Optional;
import javax.annotation.Nonnull;
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.network.PacketBuffer;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
import appeng.api.AEApi;
@@ -70,7 +70,7 @@ public class QuantumBridgeTileEntity extends AENetworkInvTileEntity implements I
private QuantumCluster cluster;
private boolean updateStatus = false;
public QuantumBridgeTileEntity(TileEntityType<?> tileEntityTypeIn) {
public QuantumBridgeTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
this.getProxy().setFlags(GridFlags.DENSE_CAPACITY);
@@ -89,7 +89,7 @@ public class QuantumBridgeTileEntity extends AENetworkInvTileEntity implements I
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
int out = this.constructed;
@@ -105,7 +105,7 @@ public class QuantumBridgeTileEntity extends AENetworkInvTileEntity implements I
}
@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 oldValue = this.constructed;
this.constructed = data.readByte();
@@ -113,20 +113,20 @@ public class QuantumBridgeTileEntity extends AENetworkInvTileEntity implements I
}
@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 (this.cluster != null) {
this.cluster.updateStatus(true);
}
}
@Override
protected IItemHandler getItemHandlerForSide(Direction side) {
protected ItemTransferable getItemHandlerForSide(Direction side) {
if (this.isCenter()) {
return this.internalInventory;
}
@@ -229,7 +229,7 @@ public class QuantumBridgeTileEntity extends AENetworkInvTileEntity implements I
final EnumSet<Direction> set = EnumSet.noneOf(Direction.class);
for (final Direction d : Direction.values()) {
final TileEntity te = this.world.getTileEntity(this.pos.offset(d));
final BlockEntity te = this.world.getTileEntity(this.pos.offset(d));
if (te instanceof QuantumBridgeTileEntity) {
set.add(d);
}
@@ -20,12 +20,12 @@ package appeng.tile.spatial;
import javax.annotation.Nonnull;
import alexiil.mc.lib.attributes.item.ItemTransferable;
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.world.World;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -54,10 +54,10 @@ import appeng.util.inv.filter.IAEItemFilter;
public class SpatialIOPortTileEntity extends AENetworkInvTileEntity implements IWorldCallable<Void> {
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 2);
private final IItemHandler invExt = new WrapperFilteredItemHandler(this.inv, new SpatialIOFilter());
private final ItemTransferable invExt = new WrapperFilteredItemHandler(this.inv, new SpatialIOFilter());
private YesNo lastRedstoneState = YesNo.UNDECIDED;
public SpatialIOPortTileEntity(TileEntityType<?> tileEntityTypeIn) {
public SpatialIOPortTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
}
@@ -159,29 +159,30 @@ public class SpatialIOPortTileEntity extends AENetworkInvTileEntity implements I
}
@Override
protected @Nonnull IItemHandler getItemHandlerForSide(@Nonnull Direction side) {
protected @Nonnull
ItemTransferable getItemHandlerForSide(@Nonnull Direction side) {
return this.invExt;
}
@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) {
}
private class SpatialIOFilter implements IAEItemFilter {
@Override
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
return slot == 1;
}
@Override
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
return (slot == 0 && SpatialIOPortTileEntity.this.isSpatialCell(stack));
}
@@ -23,8 +23,8 @@ import java.util.EnumSet;
import javax.annotation.Nonnull;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
@@ -66,7 +66,7 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
private SpatialPylonCluster cluster;
private boolean didHaveLight = false;
public SpatialPylonTileEntity(TileEntityType<?> tileEntityTypeIn) {
public SpatialPylonTileEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK);
this.getProxy().setIdlePowerUsage(0.5);
@@ -194,7 +194,7 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
}
@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 old = this.displayBits;
this.displayBits = data.readByte();
@@ -202,7 +202,7 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
protected void writeToStream(final PacketByteBuf data) throws IOException {
super.writeToStream(data);
data.writeByte(this.displayBits);
}
@@ -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) {
}