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
@@ -27,10 +27,10 @@ import net.minecraft.entity.LivingEntity;
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.TileEntity;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.BlockView;
@@ -53,11 +53,11 @@ public class CableAnchorPart implements IPart {
@PartModels
public static final PartModel DEFAULT_MODELS = new PartModel(false,
new ResourceLocation(AppEng.MOD_ID, "part/cable_anchor"));
new Identifier(AppEng.MOD_ID, "part/cable_anchor"));
@PartModels
public static final PartModel FACADE_MODELS = new PartModel(false,
new ResourceLocation(AppEng.MOD_ID, "part/cable_anchor_short"));
new Identifier(AppEng.MOD_ID, "part/cable_anchor_short"));
private ItemStack is = ItemStack.EMPTY;
private IPartHost host = null;
@@ -132,12 +132,12 @@ public class CableAnchorPart implements IPart {
}
@Override
public void writeToStream(final PacketBuffer data) throws IOException {
public void writeToStream(final PacketByteBuf data) throws IOException {
}
@Override
public boolean readFromStream(final PacketBuffer data) throws IOException {
public boolean readFromStream(final PacketByteBuf data) throws IOException {
return false;
}
@@ -167,7 +167,7 @@ public class CableAnchorPart implements IPart {
}
@Override
public void setPartHostInfo(final AEPartLocation side, final IPartHost host, final TileEntity tile) {
public void setPartHostInfo(final AEPartLocation side, final IPartHost host, final BlockEntity tile) {
this.host = host;
this.mySide = side;
}
@@ -21,6 +21,7 @@ package appeng.parts.misc;
import java.util.EnumSet;
import java.util.List;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.PlayerEntity;
@@ -28,14 +29,13 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -78,19 +78,19 @@ import appeng.util.inv.InvOperation;
public class InterfacePart extends BasicStatePart implements IGridTickable, IStorageMonitorable, IInventoryDestination,
IInterfaceHost, IAEAppEngInventory, IPriorityHost {
public static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID, "part/interface_base");
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "part/interface_base");
@PartModels
public static final PartModel MODELS_OFF = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/interface_off"));
new Identifier(AppEng.MOD_ID, "part/interface_off"));
@PartModels
public static final PartModel MODELS_ON = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/interface_on"));
new Identifier(AppEng.MOD_ID, "part/interface_on"));
@PartModels
public static final PartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/interface_has_channel"));
new Identifier(AppEng.MOD_ID, "part/interface_has_channel"));
private final DualityInterface duality = new DualityInterface(this.getProxy(), this);
@@ -159,7 +159,7 @@ public class InterfacePart extends BasicStatePart implements IGridTickable, ISto
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
return this.duality.getInventoryByName(name);
}
@@ -192,8 +192,8 @@ public class InterfacePart extends BasicStatePart implements IGridTickable, ISto
}
@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) {
this.duality.onChangeInventory(inv, slot, mc, removedStack, newStack);
}
@@ -208,7 +208,7 @@ public class InterfacePart extends BasicStatePart implements IGridTickable, ISto
}
@Override
public TileEntity getTileEntity() {
public BlockEntity getTileEntity() {
return super.getHost().getTile();
}
@@ -19,7 +19,7 @@
package appeng.parts.misc;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
@@ -29,7 +29,7 @@ import appeng.parts.PartModel;
public class InvertedToggleBusPart extends ToggleBusPart {
@PartModels
public static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID,
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID,
"part/inverted_toggle_bus_base");
public static final PartModel MODELS_OFF = new PartModel(MODEL_BASE, MODEL_STATUS_OFF);
@@ -25,8 +25,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -52,11 +52,11 @@ import appeng.util.item.AEItemStack;
class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAEItemStack>, ITickingMonitor {
private final Map<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
private IActionSource mySource;
private final IItemHandler itemHandler;
private final ItemTransferable itemHandler;
private final IGridProxyable proxyable;
private final InventoryCache cache;
ItemHandlerAdapter(IItemHandler itemHandler, IGridProxyable proxy) {
ItemHandlerAdapter(ItemTransferable itemHandler, IGridProxyable proxy) {
this.itemHandler = itemHandler;
this.proxyable = proxy;
this.cache = new InventoryCache(this.itemHandler);
@@ -220,9 +220,9 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
private static class InventoryCache {
private IAEItemStack[] cachedAeStacks = new IAEItemStack[0];
private final IItemHandler itemHandler;
private final ItemTransferable itemHandler;
public InventoryCache(IItemHandler itemHandler) {
public InventoryCache(ItemTransferable itemHandler) {
this.itemHandler = itemHandler;
}
@@ -22,20 +22,20 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.BlockView;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -98,19 +98,19 @@ import appeng.util.prioritylist.PrecisePriorityList;
public class StorageBusPart extends UpgradeablePart
implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost {
public static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID, "part/storage_bus_base");
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "part/storage_bus_base");
@PartModels
public static final IPartModel MODELS_OFF = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/storage_bus_off"));
new Identifier(AppEng.MOD_ID, "part/storage_bus_off"));
@PartModels
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/storage_bus_on"));
new Identifier(AppEng.MOD_ID, "part/storage_bus_on"));
@PartModels
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE,
new ResourceLocation(AppEng.MOD_ID, "part/storage_bus_has_channel"));
new Identifier(AppEng.MOD_ID, "part/storage_bus_has_channel"));
private final IActionSource mySrc;
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory(this, 63);
@@ -167,8 +167,8 @@ public class StorageBusPart extends UpgradeablePart
}
@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) {
super.onChangeInventory(inv, slot, mc, removedStack, newStack);
if (inv == this.Config) {
@@ -197,7 +197,7 @@ public class StorageBusPart extends UpgradeablePart
}
@Override
public IItemHandler getInventoryByName(final String name) {
public ItemTransferable getInventoryByName(final String name) {
if (name.equals("config")) {
return this.Config;
}
@@ -257,7 +257,7 @@ public class StorageBusPart extends UpgradeablePart
@Override
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) {
if (pos.offset(this.getSide().getFacing()).equals(neighbor)) {
final TileEntity te = w.getTileEntity(neighbor);
final BlockEntity te = w.getTileEntity(neighbor);
// In case the TE was destroyed, we have to do a full reset immediately.
if (te == null) {
@@ -329,7 +329,7 @@ public class StorageBusPart extends UpgradeablePart
}
}
private IMEInventory<IAEItemStack> getInventoryWrapper(TileEntity target) {
private IMEInventory<IAEItemStack> getInventoryWrapper(BlockEntity target) {
Direction targetSide = this.getSide().getFacing().getOpposite();
@@ -355,7 +355,7 @@ public class StorageBusPart extends UpgradeablePart
}
// Check via cap for IItemHandler
final LazyOptional<IItemHandler> handlerExtOpt = target
final LazyOptional<ItemTransferable> handlerExtOpt = target
.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide);
if (handlerExtOpt.isPresent()) {
return new ItemHandlerAdapter(handlerExtOpt.orElse(null), this);
@@ -366,7 +366,7 @@ public class StorageBusPart extends UpgradeablePart
}
// TODO, LazyOptionals are cacheable this might need changing?
private int createHandlerHash(TileEntity target) {
private int createHandlerHash(BlockEntity target) {
if (target == null) {
return 0;
}
@@ -380,11 +380,11 @@ public class StorageBusPart extends UpgradeablePart
return Objects.hash(target, accessorOpt.orElse(null));
}
final LazyOptional<IItemHandler> itemHandlerOpt = target
final LazyOptional<ItemTransferable> itemHandlerOpt = target
.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide);
if (itemHandlerOpt.isPresent()) {
IItemHandler itemHandler = itemHandlerOpt.orElse(null);
ItemTransferable itemHandler = itemHandlerOpt.orElse(null);
return Objects.hash(target, itemHandler, itemHandler.getSlots());
}
@@ -399,8 +399,8 @@ public class StorageBusPart extends UpgradeablePart
final boolean wasSleeping = this.monitor == null;
this.cached = true;
final TileEntity self = this.getHost().getTile();
final TileEntity target = self.getWorld().getTileEntity(self.getPos().offset(this.getSide().getFacing()));
final BlockEntity self = this.getHost().getTile();
final BlockEntity target = self.getWorld().getTileEntity(self.getPos().offset(this.getSide().getFacing()));
final int newHandlerHash = this.createHandlerHash(target);
if (newHandlerHash != 0 && newHandlerHash == this.handlerHash) {
@@ -482,7 +482,7 @@ public class StorageBusPart extends UpgradeablePart
return this.handler;
}
private void checkInterfaceVsStorageBus(final TileEntity target, final AEPartLocation side) {
private void checkInterfaceVsStorageBus(final BlockEntity target, final AEPartLocation side) {
IInterfaceHost achievement = null;
if (target instanceof IInterfaceHost) {
@@ -23,9 +23,9 @@ import java.util.EnumSet;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
@@ -49,15 +49,15 @@ import appeng.parts.PartModel;
public class ToggleBusPart extends BasicStatePart {
@PartModels
public static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID, "part/toggle_bus_base");
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "part/toggle_bus_base");
@PartModels
public static final ResourceLocation MODEL_STATUS_OFF = new ResourceLocation(AppEng.MOD_ID,
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID,
"part/toggle_bus_status_off");
@PartModels
public static final ResourceLocation MODEL_STATUS_ON = new ResourceLocation(AppEng.MOD_ID,
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID,
"part/toggle_bus_status_on");
@PartModels
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation(AppEng.MOD_ID,
public static final Identifier MODEL_STATUS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
"part/toggle_bus_status_has_channel");
public static final IPartModel MODELS_OFF = new PartModel(MODEL_BASE, MODEL_STATUS_OFF);
@@ -140,7 +140,7 @@ public class ToggleBusPart extends BasicStatePart {
}
@Override
public void setPartHostInfo(final AEPartLocation side, final IPartHost host, final TileEntity tile) {
public void setPartHostInfo(final AEPartLocation side, final IPartHost host, final BlockEntity tile) {
super.setPartHostInfo(side, host, tile);
this.outerProxy.setValidSides(EnumSet.of(side.getFacing()));
}