Utils ported
This commit is contained in:
@@ -33,12 +33,12 @@ public class CraftingStorageItem extends AEBaseBlockItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
public ItemStack getRecipeRemainder(final ItemStack itemStack) {
|
||||
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(final ItemStack stack) {
|
||||
public boolean hasRecipeRemainder(final ItemStack stack) {
|
||||
return AEConfig.instance().isFeatureEnabled(AEFeature.ENABLE_DISASSEMBLY_CRAFTING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
final ChargerBlockEntity tile = this.getBlockEntity(w, pos);
|
||||
if (tile != null) {
|
||||
if (AEApi.instance().definitions().materials().certusQuartzCrystalCharged()
|
||||
.isSameAs(tile.getInternalInventory().getStackInSlot(0))) {
|
||||
.isSameAs(tile.getInternalInventory().getInvStack(0))) {
|
||||
final double xOff = 0.0;
|
||||
final double yOff = 0.0;
|
||||
final double zOff = 0.0;
|
||||
@@ -185,7 +185,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
@Environment(EnvType.CLIENT)
|
||||
private static Pair<ItemStack, TransformationMatrix> getRenderedItem(ChargerBlockEntity tile) {
|
||||
TransformationMatrix transform = new TransformationMatrix(new Vector3f(0.5f, 0.375f, 0.5f), null, null, null);
|
||||
return new ImmutablePair<>(tile.getInternalInventory().getStackInSlot(0), transform);
|
||||
return new ImmutablePair<>(tile.getInternalInventory().getInvStack(0), transform);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ public class TinyTNTBlock extends AEBaseBlock {
|
||||
if (!w.isClient) {
|
||||
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F,
|
||||
pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter);
|
||||
w.addEntity(primedTinyTNTEntity);
|
||||
w.playSound(null, primedTinyTNTEntity.getPosX(), primedTinyTNTEntity.getPosY(),
|
||||
primedTinyTNTEntity.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
|
||||
w.spawnEntity(primedTinyTNTEntity);
|
||||
w.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(),
|
||||
primedTinyTNTEntity.getZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class TinyTNTBlock extends AEBaseBlock {
|
||||
pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getExplosivePlacedBy());
|
||||
primedTinyTNTEntity
|
||||
.setFuse(w.rand.nextInt(primedTinyTNTEntity.getFuse() / 4) + primedTinyTNTEntity.getFuse() / 8);
|
||||
w.addEntity(primedTinyTNTEntity);
|
||||
w.spawnEntity(primedTinyTNTEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
@Override
|
||||
public ItemStack getPickBlock(BlockState state, HitResult target, BlockView world, BlockPos pos,
|
||||
PlayerEntity player) {
|
||||
final Vec3d v3 = target.getHitVec().subtract(pos.getX(), pos.getY(), pos.getZ());
|
||||
final Vec3d v3 = target.getPos().subtract(pos.getX(), pos.getY(), pos.getZ());
|
||||
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
|
||||
|
||||
if (sp.part != null) {
|
||||
@@ -194,7 +194,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
if (target.getType() != Type.BLOCK) {
|
||||
return false;
|
||||
}
|
||||
BlockPos blockPos = new BlockPos(target.getHitVec().x, target.getHitVec().y, target.getHitVec().z);
|
||||
BlockPos blockPos = new BlockPos(target.getPos().x, target.getPos().y, target.getPos().z);
|
||||
|
||||
ICableBusContainer cb = this.cb(world, blockPos);
|
||||
|
||||
@@ -214,9 +214,9 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
// Spawn a particle for one of the particle textures
|
||||
Sprite texture = Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
|
||||
if (texture != null) {
|
||||
double x = target.getHitVec().x;
|
||||
double y = target.getHitVec().y;
|
||||
double z = target.getHitVec().z;
|
||||
double x = target.getPos().x;
|
||||
double y = target.getPos().y;
|
||||
double z = target.getPos().z;
|
||||
// FIXME: Check how this looks, probably like shit, maybe provide parts the
|
||||
// ability to supply particle textures???
|
||||
effectRenderer
|
||||
@@ -310,7 +310,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
if (rtr instanceof BlockHitResult) {
|
||||
BlockHitResult brtr = (BlockHitResult) rtr;
|
||||
if (brtr.getPos().equals(pos)) {
|
||||
final Vec3d hitVec = rtr.getHitVec().subtract(new Vec3d(pos));
|
||||
final Vec3d hitVec = rtr.getPos().subtract(new Vec3d(pos));
|
||||
|
||||
if (this.cb(worldIn, pos).clicked(player, Hand.MAIN_HAND, hitVec)) {
|
||||
NetworkHandler.instance().sendToServer(new ClickPacket(pos, brtr.getSide(), (float) hitVec.x,
|
||||
@@ -329,7 +329,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
// Transform from world into block space
|
||||
Vec3d hitVec = hit.getHitVec();
|
||||
Vec3d hitVec = hit.getPos();
|
||||
Vec3d hitInBlock = new Vec3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
|
||||
return this.cb(w, pos).activate(player, hand, hitInBlock) ? ActionResult.SUCCESS : ActionResult.PASS;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.world.World;
|
||||
@@ -82,7 +83,7 @@ public class ChestBlock extends AEBaseTileBlock<ChestBlockEntity> {
|
||||
|
||||
if (hit.getSide() == tg.getUp()) {
|
||||
if (!tg.openGui(p)) {
|
||||
p.sendMessage(PlayerMessages.ChestCannotReadStorageCell.get());
|
||||
p.sendSystemMessage(PlayerMessages.ChestCannotReadStorageCell.get(), Util.NIL_UUID);
|
||||
}
|
||||
} else {
|
||||
ContainerOpener.openContainer(ChestContainer.TYPE, p,
|
||||
|
||||
@@ -64,15 +64,6 @@ public class ClientHelper extends ServerHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
if (Platform.isClient()) {
|
||||
return MinecraftClient.getInstance().world;
|
||||
} else {
|
||||
return super.getWorld();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTileEntitySpecialRenderer(final Class<? extends BlockEntity> tile, final AEBaseBlock blk) {
|
||||
|
||||
@@ -113,7 +104,7 @@ public class ClientHelper extends ServerHelper {
|
||||
|
||||
@Override
|
||||
public boolean shouldAddParticles(final Random r) {
|
||||
switch (MinecraftClient.getInstance().gameSettings.particles) {
|
||||
switch (MinecraftClient.getInstance().options.particles) {
|
||||
default:
|
||||
case ALL:
|
||||
return true;
|
||||
@@ -154,9 +145,9 @@ public class ClientHelper extends ServerHelper {
|
||||
|
||||
final PlayerEntity player = mc.player;
|
||||
|
||||
final int x = (int) player.getPosX();
|
||||
final int y = (int) player.getPosY();
|
||||
final int z = (int) player.getPosZ();
|
||||
final int x = (int) player.getX();
|
||||
final int y = (int) player.getY();
|
||||
final int z = (int) player.getZ();
|
||||
|
||||
final int range = 16 * 16;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
@@ -63,7 +63,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
|
||||
.format(myStack.getStackSize());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
|
||||
currentToolTip.add(TextFormatting.GRAY + format);
|
||||
currentToolTip.add(Formatting.GRAY + format);
|
||||
}
|
||||
|
||||
if (myStack.getCountRequestable() > 0) {
|
||||
@@ -82,7 +82,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
|
||||
currentToolTip.add(TextFormatting.GRAY + format);
|
||||
currentToolTip.add(Formatting.GRAY + format);
|
||||
|
||||
this.renderTooltip(currentToolTip, x, y, this.font);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -53,7 +54,6 @@ import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
@@ -198,11 +198,11 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
|
||||
lines = Lists.newArrayList(lines); // Make a copy
|
||||
|
||||
// Make the first line white
|
||||
lines.set(0, TextFormatting.WHITE + lines.get(0));
|
||||
lines.set(0, Formatting.WHITE + lines.get(0));
|
||||
|
||||
// All lines after the first are colored gray
|
||||
for (int i = 1; i < lines.size(); i++) {
|
||||
lines.set(i, TextFormatting.GRAY + lines.get(i));
|
||||
lines.set(i, Formatting.GRAY + lines.get(i));
|
||||
}
|
||||
|
||||
this.renderTooltip(lines, x, y, this.font);
|
||||
@@ -504,7 +504,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
|
||||
|
||||
if (getPlayer().inventory.getItemStack().isEmpty() && theSlot != null) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
if (getMinecraft().gameSettings.keyBindsHotbar[j].isActiveAndMatches(input)) {
|
||||
if (getMinecraft().options.keyBindsHotbar[j].isActiveAndMatches(input)) {
|
||||
final List<Slot> slots = this.getInventorySlots();
|
||||
for (final Slot s : slots) {
|
||||
if (s.getSlotIndex() == j && s.inventory == ((AEBaseContainer) this.container).getPlayerInv()) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.CopyMode;
|
||||
@@ -118,9 +118,9 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
|
||||
this.copyMode.setState(this.container.getCopyMode() == CopyMode.CLEAR_ON_REMOVE);
|
||||
|
||||
boolean hasFuzzy = false;
|
||||
final ItemTransferable inv = this.container.getCellUpgradeInventory();
|
||||
for (int x = 0; x < inv.getSlots(); x++) {
|
||||
final ItemStack is = inv.getStackInSlot(x);
|
||||
final FixedItemInv inv = this.container.getCellUpgradeInventory();
|
||||
for (int x = 0; x < inv.getSlotCount(); x++) {
|
||||
final ItemStack is = inv.getInvStack(x);
|
||||
if (!is.isEmpty() && is.getItem() instanceof IUpgradeModule) {
|
||||
if (((IUpgradeModule) is.getItem()).getType(is) == Upgrades.FUZZY) {
|
||||
hasFuzzy = true;
|
||||
|
||||
@@ -223,7 +223,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
if (invData.contains(which)) {
|
||||
current.getInventory().setStackInSlot(x, ItemStack.read(invData.getCompound(which)));
|
||||
current.getInventory().setStackInSlot(x, ItemStack.fromTag(invData.getCompound(which)));
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ignored) {
|
||||
@@ -319,7 +319,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
|
||||
for (int i = 0; i < outTag.size(); i++) {
|
||||
|
||||
final ItemStack parsedItemStack = ItemStack.read(outTag.getCompound(i));
|
||||
final ItemStack parsedItemStack = ItemStack.fromTag(outTag.getCompound(i));
|
||||
if (!parsedItemStack.isEmpty()) {
|
||||
final String displayName = Platform.getItemDisplayName(AEApi.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack)).getString()
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.me;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class SlotDisconnected extends AppEngSlot {
|
||||
final ItemStack is = super.getStack();
|
||||
if (!is.isEmpty() && is.getItem() instanceof EncodedPatternItem) {
|
||||
final EncodedPatternItem iep = (EncodedPatternItem) is.getItem();
|
||||
final ItemStack out = iep.getOutput(is);
|
||||
final ItemStack out = iep.getOutput(MinecraftClient.getInstance().world, is);
|
||||
if (!out.isEmpty()) {
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ public class EncodedPatternBakedModel extends DelegateBakedModel {
|
||||
public BakedModel getModelWithOverrides(BakedModel originalModel, ItemStack stack, @Nullable World world,
|
||||
@Nullable LivingEntity entity) {
|
||||
boolean shiftHeld = Screen.hasShiftDown();
|
||||
if (shiftHeld) {
|
||||
if (shiftHeld && world != null) {
|
||||
EncodedPatternItem iep = (EncodedPatternItem) stack.getItem();
|
||||
ItemStack output = iep.getOutput(stack);
|
||||
ItemStack output = iep.getOutput(world, stack);
|
||||
if (!output.isEmpty()) {
|
||||
BakedModel realModel = MinecraftClient.getInstance().getItemRenderer().getItemModelMesher()
|
||||
.getItemModel(output);
|
||||
|
||||
@@ -62,9 +62,9 @@ public class EnergyFx extends SpriteTexturedParticle {
|
||||
|
||||
@Override
|
||||
public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
|
||||
float x = (float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks);
|
||||
float y = (float) (this.prevPosY + (this.posY - this.prevPosY) * partialTicks);
|
||||
float z = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks);
|
||||
float x = (float) (this.prevX + (this.posX - this.prevX) * partialTicks);
|
||||
float y = (float) (this.prevY + (this.posY - this.prevY) * partialTicks);
|
||||
float z = (float) (this.prevZ + (this.posZ - this.prevZ) * partialTicks);
|
||||
|
||||
final int blkX = MathHelper.floor(x);
|
||||
final int blkY = MathHelper.floor(y);
|
||||
|
||||
@@ -91,9 +91,9 @@ public class LightningFX extends SpriteTexturedParticle {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.age++ >= this.maxAge) {
|
||||
this.setExpired();
|
||||
@@ -109,9 +109,9 @@ public class LightningFX extends SpriteTexturedParticle {
|
||||
@Override
|
||||
public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
|
||||
Vec3d vec3d = renderInfo.getProjectedView();
|
||||
float centerX = (float) (MathHelper.lerp(partialTicks, this.prevPosX, this.posX) - vec3d.getX());
|
||||
float centerY = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY());
|
||||
float centerZ = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ());
|
||||
float centerX = (float) (MathHelper.lerp(partialTicks, this.prevX, this.posX) - vec3d.getX());
|
||||
float centerY = (float) (MathHelper.lerp(partialTicks, this.prevY, this.posY) - vec3d.getY());
|
||||
float centerZ = (float) (MathHelper.lerp(partialTicks, this.prevZ, this.posZ) - vec3d.getZ());
|
||||
|
||||
final float j = 1.0f;
|
||||
float red = this.particleRed * j * 0.9f;
|
||||
|
||||
@@ -54,9 +54,9 @@ public class MatterCannonFX extends SpriteTexturedParticle {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.age++ >= this.maxAge) {
|
||||
this.setExpired();
|
||||
|
||||
@@ -44,9 +44,9 @@ public class VibrantFX extends SpriteTexturedParticle {
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
this.maxAge = (int) (20.0D / (Math.random() * 0.8D + 0.1D));
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ public class VibrantFX extends SpriteTexturedParticle {
|
||||
*/
|
||||
@Override
|
||||
public void tick() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.particleScale *= 0.95;
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ public class SkyCompassBakedModel implements IDynamicBakedModel {
|
||||
if (world != null && entity instanceof ClientPlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) entity;
|
||||
|
||||
float offRads = (float) (player.rotationYaw / 180.0f * (float) Math.PI + Math.PI);
|
||||
float offRads = (float) (player.yaw / 180.0f * (float) Math.PI + Math.PI);
|
||||
|
||||
SkyCompassBakedModel.this.fallbackRotation = offRads
|
||||
+ getAnimatedRotation(player.getPosition(), true);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
package appeng.client.render.tesr;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
@@ -126,16 +126,16 @@ public final class InscriberTESR extends BlockEntityRenderer<InscriberBlockEntit
|
||||
|
||||
// render items.
|
||||
|
||||
ItemTransferable tileInv = tile.getInternalInventory();
|
||||
FixedItemInv tileInv = tile.getInternalInventory();
|
||||
|
||||
int items = 0;
|
||||
if (!tileInv.getStackInSlot(0).isEmpty()) {
|
||||
if (!tileInv.getInvStack(0).isEmpty()) {
|
||||
items++;
|
||||
}
|
||||
if (!tileInv.getStackInSlot(1).isEmpty()) {
|
||||
if (!tileInv.getInvStack(1).isEmpty()) {
|
||||
items++;
|
||||
}
|
||||
if (!tileInv.getStackInSlot(2).isEmpty()) {
|
||||
if (!tileInv.getInvStack(2).isEmpty()) {
|
||||
items++;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public final class InscriberTESR extends BlockEntityRenderer<InscriberBlockEntit
|
||||
// consumed, see below)
|
||||
renderPresses = false;
|
||||
|
||||
ItemStack is = tileInv.getStackInSlot(3);
|
||||
ItemStack is = tileInv.getInvStack(3);
|
||||
|
||||
if (is.isEmpty()) {
|
||||
final InscriberRecipe ir = tile.getTask();
|
||||
@@ -160,12 +160,12 @@ public final class InscriberTESR extends BlockEntityRenderer<InscriberBlockEntit
|
||||
this.renderItem(ms, is, 0.0f, buffers, combinedLight, combinedOverlay);
|
||||
} else {
|
||||
renderPresses = true;
|
||||
this.renderItem(ms, tileInv.getStackInSlot(2), 0.0f, buffers, combinedLight, combinedOverlay);
|
||||
this.renderItem(ms, tileInv.getInvStack(2), 0.0f, buffers, combinedLight, combinedOverlay);
|
||||
}
|
||||
|
||||
if (renderPresses) {
|
||||
this.renderItem(ms, tileInv.getStackInSlot(0), press, buffers, combinedLight, combinedOverlay);
|
||||
this.renderItem(ms, tileInv.getStackInSlot(1), -press, buffers, combinedLight, combinedOverlay);
|
||||
this.renderItem(ms, tileInv.getInvStack(0), press, buffers, combinedLight, combinedOverlay);
|
||||
this.renderItem(ms, tileInv.getInvStack(1), -press, buffers, combinedLight, combinedOverlay);
|
||||
}
|
||||
|
||||
ms.pop();
|
||||
|
||||
@@ -24,12 +24,12 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
@@ -73,7 +73,7 @@ import appeng.helpers.InventoryAction;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
@@ -262,7 +262,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(final PlayerInventory PlayerInventory, final int offsetX, final int offsetY) {
|
||||
ItemTransferable ih = new PlayerInvWrapper(PlayerInventory);
|
||||
FixedItemInv ih = new PlayerInvWrapper(PlayerInventory);
|
||||
|
||||
// bind player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@@ -523,8 +523,8 @@ public abstract class AEBaseContainer extends Container {
|
||||
@Override
|
||||
public boolean canInteractWith(final PlayerEntity PlayerEntity) {
|
||||
if (this.isValidContainer()) {
|
||||
if (this.tileEntity instanceof IInventory) {
|
||||
return ((IInventory) this.tileEntity).isUsableByPlayer(PlayerEntity);
|
||||
if (this.tileEntity instanceof Inventory) {
|
||||
return ((Inventory) this.tileEntity).isUsableByPlayer(PlayerEntity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -666,7 +666,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
ais = Platform.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais,
|
||||
this.getActionSource());
|
||||
if (ais == null) {
|
||||
final InventoryAdaptor ia = new AdaptorItemHandler(
|
||||
final InventoryAdaptor ia = new AdaptorFixedInv(
|
||||
new WrapperCursorItemHandler(player.inventory));
|
||||
|
||||
final ItemStack fail = ia.removeItems(1, extracted.getDefinition(), null);
|
||||
@@ -705,7 +705,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
ais = Platform.poweredExtraction(this.getPowerSource(), this.getCellInventory(), ais,
|
||||
this.getActionSource());
|
||||
if (ais != null) {
|
||||
final InventoryAdaptor ia = new AdaptorItemHandler(
|
||||
final InventoryAdaptor ia = new AdaptorFixedInv(
|
||||
new WrapperCursorItemHandler(player.inventory));
|
||||
|
||||
final ItemStack fail = ia.addItems(ais.createItemStack());
|
||||
|
||||
@@ -117,9 +117,9 @@ public final class ContainerLocator {
|
||||
if (is.isEmpty()) {
|
||||
throw new IllegalArgumentException("Cannot open an item-inventory with empty hands");
|
||||
}
|
||||
int invSize = player.inventory.getSizeInventory();
|
||||
int invSize = player.inventory.size();
|
||||
for (int i = 0; i < invSize; i++) {
|
||||
if (player.inventory.getStackInSlot(i) == is) {
|
||||
if (player.inventory.getStack(i) == is) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
@@ -83,7 +83,7 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
public void setFuzzy(final FuzzyMode valueOf) {
|
||||
final ICellWorkbenchItem cwi = this.workBench.getCell();
|
||||
if (cwi != null) {
|
||||
cwi.setFuzzyMode(this.workBench.getInventoryByName("cell").getStackInSlot(0), valueOf);
|
||||
cwi.setFuzzyMode(this.workBench.getInventoryByName("cell").getInvStack(0), valueOf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,14 +102,13 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final ItemTransferable cell = this.getUpgradeable().getInventoryByName("cell");
|
||||
final FixedItemInv cell = this.getUpgradeable().getInventoryByName("cell");
|
||||
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8,
|
||||
this.getPlayerInv()));
|
||||
|
||||
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final WrapperSupplierItemHandler upgradeInventory = new WrapperSupplierItemHandler(
|
||||
this::getCellUpgradeInventory);
|
||||
// null, 3 * 8 );
|
||||
|
||||
int offset = 0;
|
||||
final int y = 29;
|
||||
@@ -141,17 +140,17 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
final ItemStack is = this.workBench.getInventoryByName("cell").getStackInSlot(0);
|
||||
final ItemStack is = this.workBench.getInventoryByName("cell").getInvStack(0);
|
||||
if (this.prevStack != is) {
|
||||
this.prevStack = is;
|
||||
this.lastUpgrades = this.getCellUpgradeInventory().getSlots();
|
||||
this.lastUpgrades = this.getCellUpgradeInventory().getSlotCount();
|
||||
}
|
||||
return this.lastUpgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
final ItemStack is = this.workBench.getInventoryByName("cell").getStackInSlot(0);
|
||||
final ItemStack is = this.workBench.getInventoryByName("cell").getInvStack(0);
|
||||
if (Platform.isServer()) {
|
||||
for (final IContainerListener listener : this.listeners) {
|
||||
if (this.prevStack != is) {
|
||||
@@ -182,8 +181,8 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
return idx < this.availableUpgrades();
|
||||
}
|
||||
|
||||
public ItemTransferable getCellUpgradeInventory() {
|
||||
final ItemTransferable upgradeInventory = this.workBench.getCellUpgradeInventory();
|
||||
public FixedItemInv getCellUpgradeInventory() {
|
||||
final FixedItemInv upgradeInventory = this.workBench.getCellUpgradeInventory();
|
||||
|
||||
return upgradeInventory == null ? EmptyFixedItemInv.INSTANCE : upgradeInventory;
|
||||
}
|
||||
@@ -205,16 +204,16 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
private FuzzyMode getWorkBenchFuzzyMode() {
|
||||
final ICellWorkbenchItem cwi = this.workBench.getCell();
|
||||
if (cwi != null) {
|
||||
return cwi.getFuzzyMode(this.workBench.getInventoryByName("cell").getStackInSlot(0));
|
||||
return cwi.getFuzzyMode(this.workBench.getInventoryByName("cell").getInvStack(0));
|
||||
}
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
public void partition() {
|
||||
|
||||
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
|
||||
|
||||
final ItemStack is = this.getUpgradeable().getInventoryByName("cell").getStackInSlot(0);
|
||||
final ItemStack is = this.getUpgradeable().getInventoryByName("cell").getInvStack(0);
|
||||
final IStorageChannel channel = is.getItem() instanceof IStorageCell
|
||||
? ((IStorageCell) is.getItem()).getChannel()
|
||||
: AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
@@ -227,7 +226,7 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < inv.getSlots(); x++) {
|
||||
for (int x = 0; x < inv.getSlotCount(); x++) {
|
||||
if (i.hasNext()) {
|
||||
// TODO: check if ok
|
||||
final ItemStack g = i.next().asItemStackRepresentation();
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -54,7 +54,7 @@ public class CondenserContainer extends AEBaseContainer implements IProgressProv
|
||||
super(TYPE, id, ip, condenser, null);
|
||||
this.condenser = condenser;
|
||||
|
||||
ItemTransferable inv = condenser.getInternalInventory();
|
||||
FixedItemInv inv = condenser.getInternalInventory();
|
||||
|
||||
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.TRASH, inv, 0, 51, 52, ip));
|
||||
this.addSlot(new OutputSlot(inv, 1, 105, 52, -1));
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class ContainerHelper<C extends AEBaseContainer, I> {
|
||||
|
||||
private I getHostFromPlayerInventory(PlayerEntity player, ContainerLocator locator) {
|
||||
|
||||
ItemStack it = player.inventory.getStackInSlot(locator.getItemIndex());
|
||||
ItemStack it = player.inventory.getStack(locator.getItemIndex());
|
||||
|
||||
if (it.isEmpty()) {
|
||||
AELog.debug("Cannot open container for player %s since they no longer hold the item in slot %d", player,
|
||||
|
||||
@@ -256,7 +256,7 @@ public class CraftConfirmContainer extends AEBaseContainer {
|
||||
// :P
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
this.getPlayerInv().player.sendMessage(new LiteralText("Error: " + e.toString()));
|
||||
this.getPlayerInv().player.sendSystemMessage(new LiteralText("Error: " + e.toString()), Util.NIL_UUID);
|
||||
AELog.debug(e);
|
||||
this.setValidContainer(false);
|
||||
this.result = null;
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
package appeng.container.implementations;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
@@ -64,13 +64,13 @@ public class CraftingTermContainer extends MEMonitorableContainer
|
||||
private final AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
|
||||
private final CraftingMatrixSlot[] craftingSlots = new CraftingMatrixSlot[9];
|
||||
private final CraftingTermSlot outputSlot;
|
||||
private IRecipe<CraftingInventory> currentRecipe;
|
||||
private Recipe<CraftingInventory> currentRecipe;
|
||||
|
||||
public CraftingTermContainer(int id, final PlayerInventory ip, final ITerminalHost monitorable) {
|
||||
super(TYPE, id, ip, monitorable, false);
|
||||
this.ct = (CraftingTerminalPart) monitorable;
|
||||
|
||||
final ItemTransferable crafting = this.ct.getInventoryByName("crafting");
|
||||
final FixedItemInv crafting = this.ct.getInventoryByName("crafting");
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
@@ -92,23 +92,23 @@ public class CraftingTermContainer extends MEMonitorableContainer
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onCraftMatrixChanged(IInventory inventory) {
|
||||
public void onCraftMatrixChanged(Inventory inventory) {
|
||||
final ContainerNull cn = new ContainerNull();
|
||||
final CraftingInventory ic = new CraftingInventory(cn, 3, 3);
|
||||
|
||||
for (int x = 0; x < 9; x++) {
|
||||
ic.setInventorySlotContents(x, this.craftingSlots[x].getStack());
|
||||
ic.setStack(x, this.craftingSlots[x].getStack());
|
||||
}
|
||||
|
||||
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, this.getPlayerInv().player.world)) {
|
||||
World world = this.getPlayerInv().player.world;
|
||||
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
|
||||
this.currentRecipe = world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
|
||||
}
|
||||
|
||||
if (this.currentRecipe == null) {
|
||||
this.outputSlot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
final ItemStack craftingResult = this.currentRecipe.getCraftingResult(ic);
|
||||
final ItemStack craftingResult = this.currentRecipe.craft(ic);
|
||||
|
||||
this.outputSlot.putStack(craftingResult);
|
||||
}
|
||||
@@ -120,13 +120,13 @@ public class CraftingTermContainer extends MEMonitorableContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(final String name) {
|
||||
public FixedItemInv getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return new PlayerInvWrapper(this.getPlayerInventory());
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class CraftingTermContainer extends MEMonitorableContainer
|
||||
return true;
|
||||
}
|
||||
|
||||
public IRecipe<CraftingInventory> getCurrentRecipe() {
|
||||
public Recipe<CraftingInventory> getCurrentRecipe() {
|
||||
return this.currentRecipe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.implementations;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -69,7 +69,7 @@ public class FormationPlaneContainer extends UpgradeableContainer {
|
||||
final int xo = 8;
|
||||
final int yo = 23 + 6;
|
||||
|
||||
final ItemTransferable config = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv config = this.getUpgradeable().getInventoryByName("config");
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
if (y < 2) {
|
||||
@@ -80,7 +80,7 @@ public class FormationPlaneContainer extends UpgradeableContainer {
|
||||
}
|
||||
}
|
||||
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
@@ -49,7 +49,7 @@ public class GrinderContainer extends AEBaseContainer {
|
||||
public GrinderContainer(int id, final PlayerInventory ip, final GrinderBlockEntity grinder) {
|
||||
super(TYPE, id, ip, grinder, null);
|
||||
|
||||
ItemTransferable inv = grinder.getInternalInventory();
|
||||
FixedItemInv inv = grinder.getInternalInventory();
|
||||
|
||||
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.ORE, inv, 0, 12, 17,
|
||||
this.getPlayerInventory()));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.implementations;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -70,7 +70,7 @@ public class IOPortContainer extends UpgradeableContainer {
|
||||
int offX = 19;
|
||||
int offY = 17;
|
||||
|
||||
final ItemTransferable cells = this.getUpgradeable().getInventoryByName("cells");
|
||||
final FixedItemInv cells = this.getUpgradeable().getInventoryByName("cells");
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
@@ -88,7 +88,7 @@ public class IOPortContainer extends UpgradeableContainer {
|
||||
}
|
||||
}
|
||||
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
@@ -74,7 +74,7 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
|
||||
super(TYPE, id, ip, te);
|
||||
this.ti = te;
|
||||
|
||||
ItemTransferable inv = te.getInternalInventory();
|
||||
FixedItemInv inv = te.getInternalInventory();
|
||||
|
||||
RestrictedInputSlot top = new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.INSCRIBER_PLATE, inv, 0,
|
||||
45, 16, this.getPlayerInventory());
|
||||
@@ -127,8 +127,8 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
|
||||
|
||||
@Override
|
||||
public boolean isValidForSlot(final Slot s, final ItemStack is) {
|
||||
final ItemStack top = this.ti.getInternalInventory().getStackInSlot(0);
|
||||
final ItemStack bot = this.ti.getInternalInventory().getStackInSlot(1);
|
||||
final ItemStack top = this.ti.getInternalInventory().getInvStack(0);
|
||||
final ItemStack bot = this.ti.getInternalInventory().getInvStack(1);
|
||||
|
||||
if (s == this.middle) {
|
||||
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.text.Text;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -54,10 +54,9 @@ import appeng.tile.misc.InterfaceBlockEntity;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.inv.WrapperFilteredItemHandler;
|
||||
import appeng.util.inv.WrapperRangeItemHandler;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
@@ -167,8 +166,8 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
} else {
|
||||
for (final Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet()) {
|
||||
final InvTracker inv = en.getValue();
|
||||
for (int x = 0; x < inv.server.getSlots(); x++) {
|
||||
if (this.isDifferent(inv.server.getStackInSlot(x), inv.client.getStackInSlot(x))) {
|
||||
for (int x = 0; x < inv.server.getSlotCount(); x++) {
|
||||
if (this.isDifferent(inv.server.getInvStack(x), inv.client.getInvStack(x))) {
|
||||
this.addItems(this.data, inv, x, 1);
|
||||
}
|
||||
}
|
||||
@@ -191,20 +190,20 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
public void doAction(final ServerPlayerEntity player, final InventoryAction action, final int slot, final long id) {
|
||||
final InvTracker inv = this.byId.get(id);
|
||||
if (inv != null) {
|
||||
final ItemStack is = inv.server.getStackInSlot(slot);
|
||||
final ItemStack is = inv.server.getInvStack(slot);
|
||||
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
|
||||
|
||||
final InventoryAdaptor playerHand = new AdaptorItemHandler(new WrapperCursorItemHandler(player.inventory));
|
||||
final InventoryAdaptor playerHand = new AdaptorFixedInv(new WrapperCursorItemHandler(player.inventory));
|
||||
|
||||
final ItemTransferable theSlot = new WrapperFilteredItemHandler(
|
||||
new WrapperRangeItemHandler(inv.server, slot, slot + 1), new PatternSlotFilter());
|
||||
final InventoryAdaptor interfaceSlot = new AdaptorItemHandler(theSlot);
|
||||
final FixedItemInv theSlot = new WrapperFilteredItemHandler(
|
||||
inv.server.getSubInv(slot, slot + 1), new PatternSlotFilter());
|
||||
final InventoryAdaptor interfaceSlot = new AdaptorFixedInv(theSlot);
|
||||
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
|
||||
if (hasItemInHand) {
|
||||
ItemStack inSlot = theSlot.getStackInSlot(0);
|
||||
ItemStack inSlot = theSlot.getInvStack(0);
|
||||
if (inSlot.isEmpty()) {
|
||||
player.inventory.setItemStack(interfaceSlot.addItems(player.inventory.getItemStack()));
|
||||
} else {
|
||||
@@ -224,7 +223,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerHand.addItems(theSlot.getStackInSlot(0)));
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerHand.addItems(theSlot.getInvStack(0)));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -253,15 +252,15 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
|
||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player);
|
||||
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerInv.addItems(theSlot.getStackInSlot(0)));
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerInv.addItems(theSlot.getInvStack(0)));
|
||||
|
||||
break;
|
||||
case MOVE_REGION:
|
||||
|
||||
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player);
|
||||
for (int x = 0; x < inv.server.getSlots(); x++) {
|
||||
for (int x = 0; x < inv.server.getSlotCount(); x++) {
|
||||
ItemHandlerUtil.setStackInSlot(inv.server, x,
|
||||
playerInvAd.addItems(inv.server.getStackInSlot(x)));
|
||||
playerInvAd.addItems(inv.server.getInvStack(x)));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -311,7 +310,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
for (final Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet()) {
|
||||
final InvTracker inv = en.getValue();
|
||||
this.byId.put(inv.which, inv);
|
||||
this.addItems(data, inv, 0, inv.server.getSlots());
|
||||
this.addItems(data, inv, 0, inv.server.getSlotCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +323,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !ItemStack.areItemStacksEqual(a, b);
|
||||
return !ItemStack.areEqual(a, b);
|
||||
}
|
||||
|
||||
private void addItems(final CompoundTag data, final InvTracker inv, final int offset, final int length) {
|
||||
@@ -339,13 +338,13 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
for (int x = 0; x < length; x++) {
|
||||
final CompoundTag itemNBT = new CompoundTag();
|
||||
|
||||
final ItemStack is = inv.server.getStackInSlot(x + offset);
|
||||
final ItemStack is = inv.server.getInvStack(x + offset);
|
||||
|
||||
// "update" client side.
|
||||
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
||||
|
||||
if (!is.isEmpty()) {
|
||||
is.write(itemNBT);
|
||||
is.toTag(itemNBT);
|
||||
}
|
||||
|
||||
tag.put(Integer.toString(x + offset), itemNBT);
|
||||
@@ -359,12 +358,12 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
private final long sortBy;
|
||||
private final long which = autoBase++;
|
||||
private final Text name;
|
||||
private final ItemTransferable client;
|
||||
private final ItemTransferable server;
|
||||
private final FixedItemInv client;
|
||||
private final FixedItemInv server;
|
||||
|
||||
public InvTracker(final DualityInterface dual, final ItemTransferable patterns, final Text name) {
|
||||
public InvTracker(final DualityInterface dual, final FixedItemInv patterns, final Text name) {
|
||||
this.server = patterns;
|
||||
this.client = new AppEngInternalInventory(null, this.server.getSlots());
|
||||
this.client = new AppEngInternalInventory(null, this.server.getSlotCount());
|
||||
this.name = name;
|
||||
this.sortBy = dual.getSortValue();
|
||||
}
|
||||
@@ -372,12 +371,12 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
|
||||
|
||||
private static class PatternSlotFilter implements IAEItemFilter {
|
||||
@Override
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
public boolean allowExtract(FixedItemInv inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(FixedItemInv inv, int slot, ItemStack stack) {
|
||||
return !stack.isEmpty() && stack.getItem() instanceof EncodedPatternItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.implementations;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
@@ -84,7 +84,7 @@ public class LevelEmitterContainer extends UpgradeableContainer {
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
if (this.availableUpgrades() > 0) {
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
@@ -102,7 +102,7 @@ public class LevelEmitterContainer extends UpgradeableContainer {
|
||||
8 + 18 * 3, this.getPlayerInventory())).setNotDraggable());
|
||||
}
|
||||
|
||||
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final int y = 40;
|
||||
final int x = 80 + 44;
|
||||
this.addSlot(new FakeTypeOnlySlot(inv, 0, x, y));
|
||||
|
||||
@@ -73,13 +73,13 @@ public class MEPortableCellContainer extends MEMonitorableContainer {
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem()
|
||||
: this.getPlayerInv().getStackInSlot(this.slot);
|
||||
: this.getPlayerInv().getStack(this.slot);
|
||||
|
||||
if (this.civ == null || currentItem.isEmpty()) {
|
||||
this.setValidContainer(false);
|
||||
} else if (this.civ != null && !this.civ.getItemStack().isEmpty() && currentItem != this.civ.getItemStack()) {
|
||||
if (ItemStack.areItemsEqual(this.civ.getItemStack(), currentItem)) {
|
||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.civ.getItemStack());
|
||||
this.getPlayerInv().setStack(this.getPlayerInv().currentItem, this.civ.getItemStack());
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.implementations;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -70,9 +70,9 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
|
||||
}
|
||||
|
||||
public boolean isValidItemForSlot(final int slotIndex, final ItemStack i) {
|
||||
final ItemTransferable mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
|
||||
final FixedItemInv mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
|
||||
|
||||
final ItemStack is = mac.getStackInSlot(10);
|
||||
final ItemStack is = mac.getInvStack(10);
|
||||
if (is.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
|
||||
int offX = 29;
|
||||
int offY = 30;
|
||||
|
||||
final ItemTransferable mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
|
||||
final FixedItemInv mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
@@ -120,7 +120,7 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
|
||||
offX = 122;
|
||||
offY = 17;
|
||||
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
|
||||
@@ -80,7 +80,7 @@ public class NetworkToolContainer extends AEBaseContainer {
|
||||
if (currentItem != this.toolInv.getItemStack()) {
|
||||
if (!currentItem.isEmpty()) {
|
||||
if (ItemStack.areItemsEqual(this.toolInv.getItemStack(), currentItem)) {
|
||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,
|
||||
this.getPlayerInv().setStack(this.getPlayerInv().currentItem,
|
||||
this.toolInv.getItemStack());
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
|
||||
@@ -22,9 +22,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.CraftResultInventory;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
@@ -33,8 +35,6 @@ import net.minecraft.inventory.container.CraftingResultSlot;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
@@ -68,7 +68,7 @@ import appeng.parts.reporting.PatternTerminalPart;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.WrapperCursorItemHandler;
|
||||
@@ -92,14 +92,14 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
|
||||
private final PatternTerminalPart patternTerminal;
|
||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||
private final ItemTransferable crafting;
|
||||
private final FixedItemInv crafting;
|
||||
private final FakeCraftingMatrixSlot[] craftingSlots = new FakeCraftingMatrixSlot[9];
|
||||
private final OptionalFakeSlot[] outputSlots = new OptionalFakeSlot[3];
|
||||
private final PatternTermSlot craftSlot;
|
||||
private final RestrictedInputSlot patternSlotIN;
|
||||
private final RestrictedInputSlot patternSlotOUT;
|
||||
|
||||
private IRecipe<CraftingInventory> currentRecipe;
|
||||
private Recipe<CraftingInventory> currentRecipe;
|
||||
@GuiSync(97)
|
||||
public boolean craftingMode = true;
|
||||
@GuiSync(96)
|
||||
@@ -109,8 +109,8 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
super(TYPE, id, ip, monitorable, false);
|
||||
this.patternTerminal = (PatternTerminalPart) monitorable;
|
||||
|
||||
final ItemTransferable patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
||||
final ItemTransferable output = this.getPatternTerminal().getInventoryByName("output");
|
||||
final FixedItemInv patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
||||
final FixedItemInv output = this.getPatternTerminal().getInventoryByName("output");
|
||||
|
||||
this.crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
||||
|
||||
@@ -168,12 +168,12 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
final World world = this.getPlayerInv().player.world;
|
||||
final CraftingInventory ic = new CraftingInventory(this, 3, 3);
|
||||
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
ic.setStack(x, this.crafting.getInvStack(x));
|
||||
}
|
||||
|
||||
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
|
||||
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
|
||||
this.currentRecipe = world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
|
||||
}
|
||||
|
||||
final ItemStack is;
|
||||
@@ -181,7 +181,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
if (this.currentRecipe == null) {
|
||||
is = ItemStack.EMPTY;
|
||||
} else {
|
||||
is = this.currentRecipe.getCraftingResult(ic);
|
||||
is = this.currentRecipe.craft(ic);
|
||||
}
|
||||
|
||||
this.cOut.setStackInSlot(0, is);
|
||||
@@ -194,7 +194,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
|
||||
}
|
||||
@@ -319,7 +319,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
final CompoundTag c = new CompoundTag();
|
||||
|
||||
if (!i.isEmpty()) {
|
||||
i.write(c);
|
||||
i.toTag(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
@@ -339,7 +339,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
public void craftOrGetItem(final PatternSlotPacket packetPatternSlot) {
|
||||
if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
|
||||
final IAEItemStack out = packetPatternSlot.slotItem.copy();
|
||||
InventoryAdaptor inv = new AdaptorItemHandler(
|
||||
InventoryAdaptor inv = new AdaptorFixedInv(
|
||||
new WrapperCursorItemHandler(this.getPlayerInv().player.inventory));
|
||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(this.getPlayerInv().player);
|
||||
|
||||
@@ -368,11 +368,11 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
final CraftingInventory real = new CraftingInventory(new ContainerNull(), 3, 3);
|
||||
|
||||
for (int x = 0; x < 9; x++) {
|
||||
ic.setInventorySlotContents(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY
|
||||
ic.setStack(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY
|
||||
: packetPatternSlot.pattern[x].createItemStack());
|
||||
}
|
||||
|
||||
final IRecipe<CraftingInventory> r = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, p.world)
|
||||
final Recipe<CraftingInventory> r = p.world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, p.world)
|
||||
.orElse(null);
|
||||
|
||||
if (r == null) {
|
||||
@@ -383,29 +383,29 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
final ItemStack is = r.getCraftingResult(ic);
|
||||
final ItemStack is = r.craft(ic);
|
||||
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
if (!ic.getStackInSlot(x).isEmpty()) {
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
if (!ic.getStack(x).isEmpty()) {
|
||||
final ItemStack pulled = Platform.extractItemsByRecipe(this.getPowerSource(),
|
||||
this.getActionSource(), storage, p.world, r, is, ic, ic.getStackInSlot(x), x, all,
|
||||
this.getActionSource(), storage, p.world, r, is, ic, ic.getStack(x), x, all,
|
||||
Actionable.MODULATE, ViewCellItem.createFilter(this.getViewCells()));
|
||||
real.setInventorySlotContents(x, pulled);
|
||||
real.setStack(x, pulled);
|
||||
}
|
||||
}
|
||||
|
||||
final IRecipe<CraftingInventory> rr = p.world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.CRAFTING, real, p.world).orElse(null);
|
||||
final Recipe<CraftingInventory> rr = p.world.getRecipeManager()
|
||||
.getRecipe(RecipeType.CRAFTING, real, p.world).orElse(null);
|
||||
|
||||
if (rr == r && Platform.itemComparisons().isSameItem(rr.getCraftingResult(real), is)) {
|
||||
if (rr == r && Platform.itemComparisons().isSameItem(rr.craft(real), is)) {
|
||||
final CraftResultInventory craftingResult = new CraftResultInventory();
|
||||
craftingResult.setRecipeUsed(rr);
|
||||
|
||||
final CraftingResultSlot sc = new CraftingResultSlot(p, real, craftingResult, 0, 0, 0);
|
||||
sc.onTake(p, is);
|
||||
|
||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||
final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));
|
||||
for (int x = 0; x < real.size(); x++) {
|
||||
final ItemStack failed = playerInv.addItems(real.getStack(x));
|
||||
|
||||
if (!failed.isEmpty()) {
|
||||
p.dropItem(failed, false);
|
||||
@@ -418,8 +418,8 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
} else {
|
||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||
final ItemStack failed = real.getStackInSlot(x);
|
||||
for (int x = 0; x < real.size(); x++) {
|
||||
final ItemStack failed = real.getStack(x);
|
||||
if (!failed.isEmpty()) {
|
||||
this.getCellInventory().injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
|
||||
new MachineSource(this.getPatternTerminal()));
|
||||
@@ -487,7 +487,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(final String name) {
|
||||
public FixedItemInv getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return new PlayerInvWrapper(this.getPlayerInventory());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -57,7 +57,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
|
||||
|
||||
private final QuartzKnifeObj toolInv;
|
||||
|
||||
private final ItemTransferable inSlot = new AppEngInternalInventory(null, 1, 1);
|
||||
private final FixedItemInv inSlot = new AppEngInternalInventory(null, 1, 1);
|
||||
private String myName = "";
|
||||
|
||||
public QuartzKnifeContainer(int id, final PlayerInventory ip, final QuartzKnifeObj te) {
|
||||
@@ -84,7 +84,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
|
||||
if (currentItem != this.toolInv.getItemStack()) {
|
||||
if (!currentItem.isEmpty()) {
|
||||
if (ItemStack.areItemsEqual(this.toolInv.getItemStack(), currentItem)) {
|
||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,
|
||||
this.getPlayerInv().setStack(this.getPlayerInv().currentItem,
|
||||
this.toolInv.getItemStack());
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
@@ -99,20 +99,20 @@ public class QuartzKnifeContainer extends AEBaseContainer {
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(final PlayerEntity par1PlayerEntity) {
|
||||
if (this.inSlot.getStackInSlot(0) != null) {
|
||||
par1PlayerEntity.dropItem(this.inSlot.getStackInSlot(0), false);
|
||||
if (this.inSlot.getInvStack(0) != null) {
|
||||
par1PlayerEntity.dropItem(this.inSlot.getInvStack(0), false);
|
||||
}
|
||||
}
|
||||
|
||||
private class QuartzKniveSlot extends OutputSlot {
|
||||
QuartzKniveSlot(ItemTransferable a, int b, int c, int d, int i) {
|
||||
QuartzKniveSlot(FixedItemInv a, int b, int c, int d, int i) {
|
||||
super(a, b, c, d, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
final ItemTransferable baseInv = this.getItemHandler();
|
||||
final ItemStack input = baseInv.getStackInSlot(0);
|
||||
final FixedItemInv baseInv = this.getItemHandler();
|
||||
final ItemStack input = baseInv.getInvStack(0);
|
||||
if (input == ItemStack.EMPTY) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
|
||||
final ItemStack item = QuartzKnifeContainer.this.toolInv.getItemStack();
|
||||
final ItemStack before = item.copy();
|
||||
item.damageItem(1, QuartzKnifeContainer.this.getPlayerInv().player, p -> {
|
||||
QuartzKnifeContainer.this.getPlayerInv().setInventorySlotContents(
|
||||
QuartzKnifeContainer.this.getPlayerInv().setStack(
|
||||
QuartzKnifeContainer.this.getPlayerInv().currentItem, ItemStack.EMPTY);
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(
|
||||
QuartzKnifeContainer.this.getPlayerInv().player, before, null));
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -139,7 +139,7 @@ public class SecurityStationContainer extends MEMonitorableContainer implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
if (!this.wirelessOut.getHasStack()) {
|
||||
if (this.wirelessIn.getHasStack()) {
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -86,7 +86,7 @@ public class StorageBusContainer extends UpgradeableContainer {
|
||||
final int xo = 8;
|
||||
final int yo = 23 + 6;
|
||||
|
||||
final ItemTransferable config = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv config = this.getUpgradeable().getInventoryByName("config");
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
if (y < 2) {
|
||||
@@ -97,7 +97,7 @@ public class StorageBusContainer extends UpgradeableContainer {
|
||||
}
|
||||
}
|
||||
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
@@ -148,7 +148,7 @@ public class StorageBusContainer extends UpgradeableContainer {
|
||||
}
|
||||
|
||||
public void partition() {
|
||||
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
|
||||
|
||||
final IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
|
||||
|
||||
@@ -159,7 +159,7 @@ public class StorageBusContainer extends UpgradeableContainer {
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < inv.getSlots(); x++) {
|
||||
for (int x = 0; x < inv.getSlotCount(); x++) {
|
||||
if (i.hasNext() && this.isSlotEnabled((x / 9) - 2)) {
|
||||
// TODO: check if ok
|
||||
final ItemStack g = i.next().asItemStackRepresentation();
|
||||
|
||||
@@ -21,13 +21,13 @@ package appeng.container.implementations;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -111,8 +111,8 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
|
||||
zCoord = mk.getPos().getZ();
|
||||
}
|
||||
|
||||
final IInventory pi = this.getPlayerInv();
|
||||
for (int x = 0; x < pi.getSizeInventory(); x++) {
|
||||
final Inventory pi = this.getPlayerInv();
|
||||
for (int x = 0; x < pi.size(); x++) {
|
||||
final ItemStack pii = pi.getStackInSlot(x);
|
||||
if (!pii.isEmpty() && pii.getItem() instanceof NetworkToolItem) {
|
||||
this.lockPlayerInventorySlot(x);
|
||||
@@ -149,7 +149,7 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
|
||||
protected void setupConfig() {
|
||||
this.setupUpgrades();
|
||||
|
||||
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
|
||||
final int y = 40;
|
||||
final int x = 80;
|
||||
this.addSlot(new FakeTypeOnlySlot(inv, 0, x, y));
|
||||
@@ -168,7 +168,7 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
|
||||
}
|
||||
|
||||
protected void setupUpgrades() {
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
if (this.availableUpgrades() > 0) {
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
@@ -229,12 +229,12 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
protected void checkToolbox() {
|
||||
if (this.hasToolbox()) {
|
||||
final ItemStack currentItem = this.getPlayerInv().getStackInSlot(this.tbSlot);
|
||||
final ItemStack currentItem = this.getPlayerInv().getStack(this.tbSlot);
|
||||
|
||||
if (currentItem != this.tbInventory.getItemStack()) {
|
||||
if (!currentItem.isEmpty()) {
|
||||
if (ItemStack.areItemsEqual(this.tbInventory.getItemStack(), currentItem)) {
|
||||
this.getPlayerInv().setInventorySlotContents(this.tbSlot, this.tbInventory.getItemStack());
|
||||
this.getPlayerInv().setStack(this.tbSlot, this.tbInventory.getItemStack());
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class WirelessTermContainer extends MEPortableCellContainer {
|
||||
|
||||
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
|
||||
if (Platform.isServer() && this.isValidContainer()) {
|
||||
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
|
||||
this.getPlayerInv().player.sendSystemMessage(PlayerMessages.OutOfRange.get(), Util.NIL_UUID);
|
||||
}
|
||||
|
||||
this.setValidContainer(false);
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.hooks.BasicEventHooks;
|
||||
@@ -35,7 +35,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
/**
|
||||
* The craft matrix inventory linked to this result slot.
|
||||
*/
|
||||
private final ItemTransferable craftMatrix;
|
||||
private final FixedItemInv craftMatrix;
|
||||
|
||||
/**
|
||||
* The player that is using the GUI where this slot resides.
|
||||
@@ -48,8 +48,8 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
*/
|
||||
private int amountCrafted;
|
||||
|
||||
public AppEngCraftingSlot(final PlayerEntity par1PlayerEntity, final ItemTransferable par2IInventory,
|
||||
final ItemTransferable par3IInventory, final int par4, final int par5, final int par6) {
|
||||
public AppEngCraftingSlot(final PlayerEntity par1PlayerEntity, final FixedItemInv par2IInventory,
|
||||
final FixedItemInv par3IInventory, final int par4, final int par5, final int par6) {
|
||||
super(par3IInventory, par4, par5, par6);
|
||||
this.thePlayer = par1PlayerEntity;
|
||||
this.craftMatrix = par2IInventory;
|
||||
@@ -92,8 +92,8 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
|
||||
final CraftingInventory ic = new CraftingInventory(this.getContainer(), 3, 3);
|
||||
|
||||
for (int x = 0; x < this.craftMatrix.getSlots(); x++) {
|
||||
ic.setInventorySlotContents(x, this.craftMatrix.getStackInSlot(x));
|
||||
for (int x = 0; x < this.craftMatrix.getSlotCount(); x++) {
|
||||
ic.setStack(x, this.craftMatrix.getInvStack(x));
|
||||
}
|
||||
|
||||
final NonNullList<ItemStack> aitemstack = this.getRemainingItems(ic, playerIn.world);
|
||||
@@ -103,7 +103,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
|
||||
|
||||
for (int i = 0; i < aitemstack.size(); ++i) {
|
||||
final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
|
||||
final ItemStack itemstack1 = this.craftMatrix.getInvStack(i);
|
||||
final ItemStack itemstack2 = aitemstack.get(i);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
@@ -111,7 +111,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
}
|
||||
|
||||
if (!itemstack2.isEmpty()) {
|
||||
if (this.craftMatrix.getStackInSlot(i).isEmpty()) {
|
||||
if (this.craftMatrix.getInvStack(i).isEmpty()) {
|
||||
ItemHandlerUtil.setStackInSlot(this.craftMatrix, i, itemstack2);
|
||||
} else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
|
||||
this.thePlayer.dropItem(itemstack2, false);
|
||||
@@ -138,7 +138,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
|
||||
// refactoring.
|
||||
protected NonNullList<ItemStack> getRemainingItems(CraftingInventory ic, World world) {
|
||||
return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world)
|
||||
return world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world)
|
||||
.map(iCraftingRecipe -> iCraftingRecipe.getRemainingItems(ic))
|
||||
.orElse(NonNullList.withSize(9, ItemStack.EMPTY));
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@ package appeng.container.slot;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -33,8 +32,8 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
public class AppEngSlot extends Slot {
|
||||
private static IInventory emptyInventory = new Inventory(0);
|
||||
private final ItemTransferable itemHandler;
|
||||
private static Inventory emptyInventory = new Inventory(0);
|
||||
private final FixedItemInv itemHandler;
|
||||
private final int index;
|
||||
|
||||
private final int defX;
|
||||
@@ -46,7 +45,7 @@ public class AppEngSlot extends Slot {
|
||||
private CalculatedValidity isValid;
|
||||
private boolean isDisplay = false;
|
||||
|
||||
public AppEngSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
|
||||
public AppEngSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
|
||||
super(emptyInventory, idx, x, y);
|
||||
this.itemHandler = inv;
|
||||
this.index = idx;
|
||||
@@ -89,7 +88,7 @@ public class AppEngSlot extends Slot {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (this.itemHandler.getSlots() <= this.getSlotIndex()) {
|
||||
if (this.itemHandler.getSlotCount() <= this.getSlotIndex()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -98,7 +97,7 @@ public class AppEngSlot extends Slot {
|
||||
return this.getDisplayStack();
|
||||
}
|
||||
|
||||
return this.itemHandler.getStackInSlot(this.index);
|
||||
return this.itemHandler.getInvStack(this.index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +114,7 @@ public class AppEngSlot extends Slot {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemTransferable getItemHandler() {
|
||||
public FixedItemInv getItemHandler() {
|
||||
return this.itemHandler;
|
||||
}
|
||||
|
||||
@@ -166,7 +165,7 @@ public class AppEngSlot extends Slot {
|
||||
}
|
||||
|
||||
public ItemStack getDisplayStack() {
|
||||
return this.itemHandler.getStackInSlot(this.index);
|
||||
return this.itemHandler.getInvStack(this.index);
|
||||
}
|
||||
|
||||
public float getOpacityOfIcon() {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -27,9 +27,9 @@ import appeng.util.inv.WrapperInvItemHandler;
|
||||
|
||||
public class CraftingMatrixSlot extends AppEngSlot {
|
||||
private final AEBaseContainer c;
|
||||
private final IInventory wrappedInventory;
|
||||
private final Inventory wrappedInventory;
|
||||
|
||||
public CraftingMatrixSlot(final AEBaseContainer c, final ItemTransferable par1iInventory, final int par2,
|
||||
public CraftingMatrixSlot(final AEBaseContainer c, final FixedItemInv par1iInventory, final int par2,
|
||||
final int par3, final int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.c = c;
|
||||
|
||||
@@ -22,13 +22,13 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -50,15 +50,15 @@ import appeng.items.storage.ViewCellItem;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
|
||||
private final ItemTransferable craftInv;
|
||||
private final ItemTransferable pattern;
|
||||
private final FixedItemInv craftInv;
|
||||
private final FixedItemInv pattern;
|
||||
|
||||
private final IActionSource mySrc;
|
||||
private final IEnergySource energySrc;
|
||||
@@ -66,8 +66,8 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
private final IContainerCraftingPacket container;
|
||||
|
||||
public CraftingTermSlot(final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc,
|
||||
final IStorageMonitorable storage, final ItemTransferable cMatrix, final ItemTransferable secondMatrix,
|
||||
final ItemTransferable output, final int x, final int y, final IContainerCraftingPacket ccp) {
|
||||
final IStorageMonitorable storage, final FixedItemInv cMatrix, final FixedItemInv secondMatrix,
|
||||
final FixedItemInv output, final int x, final int y, final IContainerCraftingPacket ccp) {
|
||||
super(player, cMatrix, output, 0, x, y);
|
||||
this.energySrc = energySrc;
|
||||
this.storage = storage;
|
||||
@@ -77,7 +77,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
this.container = ccp;
|
||||
}
|
||||
|
||||
public ItemTransferable getCraftingMatrix() {
|
||||
public FixedItemInv getCraftingMatrix() {
|
||||
return this.craftInv;
|
||||
}
|
||||
|
||||
@@ -111,12 +111,12 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
maxTimesToCraft = (int) Math.floor((double) this.getStack().getMaxStackSize() / (double) howManyPerCraft);
|
||||
} else if (action == InventoryAction.CRAFT_STACK) // craft into hand, full stack
|
||||
{
|
||||
ia = new AdaptorItemHandler(new WrapperCursorItemHandler(who.inventory));
|
||||
ia = new AdaptorFixedInv(new WrapperCursorItemHandler(who.inventory));
|
||||
maxTimesToCraft = (int) Math.floor((double) this.getStack().getMaxStackSize() / (double) howManyPerCraft);
|
||||
} else
|
||||
// pick up what was crafted...
|
||||
{
|
||||
ia = new AdaptorItemHandler(new WrapperCursorItemHandler(who.inventory));
|
||||
ia = new AdaptorFixedInv(new WrapperCursorItemHandler(who.inventory));
|
||||
maxTimesToCraft = 1;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
final List<ItemStack> drops = new ArrayList<>();
|
||||
drops.add(extra);
|
||||
Platform.spawnDrops(who.world,
|
||||
new BlockPos((int) who.getPosX(), (int) who.getPosY(), (int) who.getPosZ()), drops);
|
||||
new BlockPos((int) who.getX(), (int) who.getY(), (int) who.getPosZ()), drops);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -148,17 +148,17 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
|
||||
// refactoring.
|
||||
protected IRecipe<CraftingInventory> findRecipe(CraftingInventory ic, World world) {
|
||||
protected Recipe<CraftingInventory> findRecipe(CraftingInventory ic, World world) {
|
||||
if (this.container instanceof CraftingTermContainer) {
|
||||
final CraftingTermContainer containerTerminal = (CraftingTermContainer) this.container;
|
||||
final IRecipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
|
||||
final Recipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if (recipe != null && recipe.matches(ic, world)) {
|
||||
return containerTerminal.getCurrentRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
|
||||
return world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
|
||||
}
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
|
||||
@@ -167,7 +167,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
protected NonNullList<ItemStack> getRemainingItems(CraftingInventory ic, World world) {
|
||||
if (this.container instanceof CraftingTermContainer) {
|
||||
final CraftingTermContainer containerTerminal = (CraftingTermContainer) this.container;
|
||||
final IRecipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
|
||||
final Recipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if (recipe != null && recipe.matches(ic, world)) {
|
||||
return containerTerminal.getCurrentRecipe().getRemainingItems(ic);
|
||||
@@ -187,7 +187,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
ItemStack is = this.getStack();
|
||||
|
||||
if (!is.isEmpty() && ItemStack.areItemsEqual(request, is)) {
|
||||
final ItemStack[] set = new ItemStack[this.getPattern().getSlots()];
|
||||
final ItemStack[] set = new ItemStack[this.getPattern().getSlotCount()];
|
||||
// Safeguard for empty slots in the inventory for now
|
||||
Arrays.fill(set, ItemStack.EMPTY);
|
||||
|
||||
@@ -195,17 +195,17 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
if (Platform.isServer()) {
|
||||
final CraftingInventory ic = new CraftingInventory(new ContainerNull(), 3, 3);
|
||||
for (int x = 0; x < 9; x++) {
|
||||
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
|
||||
ic.setStack(x, this.getPattern().getInvStack(x));
|
||||
}
|
||||
|
||||
final IRecipe<CraftingInventory> r = this.findRecipe(ic, p.world);
|
||||
final Recipe<CraftingInventory> r = this.findRecipe(ic, p.world);
|
||||
|
||||
if (r == null) {
|
||||
final Item target = request.getItem();
|
||||
if (target.isDamageable() && target.isRepairable(request)) {
|
||||
boolean isBad = false;
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
final ItemStack pis = ic.getStackInSlot(x);
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
final ItemStack pis = ic.getStack(x);
|
||||
if (pis.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -223,15 +223,15 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
is = r.getCraftingResult(ic);
|
||||
is = r.craft(ic);
|
||||
|
||||
if (inv != null) {
|
||||
for (int x = 0; x < this.getPattern().getSlots(); x++) {
|
||||
if (!this.getPattern().getStackInSlot(x).isEmpty()) {
|
||||
for (int x = 0; x < this.getPattern().getSlotCount(); x++) {
|
||||
if (!this.getPattern().getInvStack(x).isEmpty()) {
|
||||
set[x] = Platform.extractItemsByRecipe(this.energySrc, this.mySrc, inv, p.world, r, is, ic,
|
||||
this.getPattern().getStackInSlot(x), x, all, Actionable.MODULATE,
|
||||
this.getPattern().getInvStack(x), x, all, Actionable.MODULATE,
|
||||
ViewCellItem.createFilter(this.container.getViewCells()));
|
||||
ic.setInventorySlotContents(x, set[x]);
|
||||
ic.setStack(x, set[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,8 +267,8 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
// add one of each item to the items on the board...
|
||||
if (Platform.isServer()) {
|
||||
// set new items onto the crafting table...
|
||||
for (int x = 0; x < this.craftInv.getSlots(); x++) {
|
||||
if (this.craftInv.getStackInSlot(x).isEmpty()) {
|
||||
for (int x = 0; x < this.craftInv.getSlotCount(); x++) {
|
||||
if (this.craftInv.getInvStack(x).isEmpty()) {
|
||||
ItemHandlerUtil.setStackInSlot(this.craftInv, x, set[x]);
|
||||
} else if (!set[x].isEmpty()) {
|
||||
// eek! put it back!
|
||||
@@ -282,11 +282,11 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
}
|
||||
|
||||
if (drops.size() > 0) {
|
||||
Platform.spawnDrops(p.world, new BlockPos((int) p.getPosX(), (int) p.getPosY(), (int) p.getPosZ()), drops);
|
||||
Platform.spawnDrops(p.world, new BlockPos((int) p.getX(), (int) p.getY(), (int) p.getPosZ()), drops);
|
||||
}
|
||||
}
|
||||
|
||||
ItemTransferable getPattern() {
|
||||
FixedItemInv getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ package appeng.container.slot;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class DisabledSlot extends AppEngSlot {
|
||||
|
||||
public DisabledSlot(final ItemTransferable par1iInventory, final int slotIndex, final int x, final int y) {
|
||||
public DisabledSlot(final FixedItemInv par1iInventory, final int slotIndex, final int x, final int y) {
|
||||
super(par1iInventory, slotIndex, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class FakeBlacklistSlot extends FakeTypeOnlySlot {
|
||||
|
||||
public FakeBlacklistSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
|
||||
public FakeBlacklistSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class FakeCraftingMatrixSlot extends FakeSlot {
|
||||
|
||||
public FakeCraftingMatrixSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
|
||||
public FakeCraftingMatrixSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FakeSlot extends AppEngSlot {
|
||||
|
||||
public FakeSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
|
||||
public FakeSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FakeTypeOnlySlot extends FakeSlot {
|
||||
|
||||
public FakeTypeOnlySlot(final ItemTransferable inv, final int idx, final int x, final int y) {
|
||||
public FakeTypeOnlySlot(final FixedItemInv inv, final int idx, final int x, final int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ package appeng.container.slot;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class InaccessibleSlot extends AppEngSlot {
|
||||
|
||||
private ItemStack dspStack = ItemStack.EMPTY;
|
||||
|
||||
public InaccessibleSlot(final ItemTransferable i, final int slotIdx, final int x, final int y) {
|
||||
public InaccessibleSlot(final FixedItemInv i, final int slotIdx, final int x, final int y) {
|
||||
super(i, slotIdx, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.container.implementations.MolecularAssemblerContainer;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class MolecularAssemblerPatternSlot extends AppEngSlot {
|
||||
|
||||
private final MolecularAssemblerContainer mac;
|
||||
|
||||
public MolecularAssemblerPatternSlot(final MolecularAssemblerContainer mac, final ItemTransferable i, final int slotIdx,
|
||||
public MolecularAssemblerPatternSlot(final MolecularAssemblerContainer mac, final FixedItemInv i, final int slotIdx,
|
||||
final int x, final int y) {
|
||||
super(i, slotIdx, x, y);
|
||||
this.mac = mac;
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class NormalSlot extends AppEngSlot {
|
||||
|
||||
public NormalSlot(final ItemTransferable inv, final int slot, final int xPos, final int yPos) {
|
||||
public NormalSlot(final FixedItemInv inv, final int slot, final int xPos, final int yPos) {
|
||||
super(inv, slot, xPos, yPos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.container.slot;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class OptionalFakeSlot extends FakeSlot implements IOptionalSlot {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class OptionalFakeSlot extends FakeSlot implements IOptionalSlot {
|
||||
private final IOptionalSlotHost host;
|
||||
private boolean renderDisabled = true;
|
||||
|
||||
public OptionalFakeSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx, final int x,
|
||||
public OptionalFakeSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx, final int x,
|
||||
final int y, final int offX, final int offY, final int groupNum) {
|
||||
super(inv, idx, x + offX * 18, y + offY * 18);
|
||||
this.srcX = x;
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class OptionalNormalSlot extends AppEngSlot implements IOptionalSlot {
|
||||
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public OptionalNormalSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int slot,
|
||||
public OptionalNormalSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int slot,
|
||||
final int xPos, final int yPos, final int groupNum) {
|
||||
super(inv, slot, xPos, yPos);
|
||||
this.groupNum = groupNum;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
||||
public class OptionalRestrictedInputSlot extends RestrictedInputSlot {
|
||||
@@ -26,7 +26,7 @@ public class OptionalRestrictedInputSlot extends RestrictedInputSlot {
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public OptionalRestrictedInputSlot(final PlacableItemType valid, final ItemTransferable i, final IOptionalSlotHost host,
|
||||
public OptionalRestrictedInputSlot(final PlacableItemType valid, final FixedItemInv i, final IOptionalSlotHost host,
|
||||
final int slotIndex, final int x, final int y, final int grpNum, final PlayerInventory invPlayer) {
|
||||
super(valid, i, slotIndex, x, y, invPlayer);
|
||||
this.groupNum = grpNum;
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class OptionalTypeOnlyFakeSlot extends OptionalFakeSlot {
|
||||
|
||||
public OptionalTypeOnlyFakeSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx,
|
||||
public OptionalTypeOnlyFakeSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx,
|
||||
final int x, final int y, final int offX, final int offY, final int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class OutputSlot extends AppEngSlot {
|
||||
|
||||
public OutputSlot(final ItemTransferable a, final int b, final int c, final int d, final int i) {
|
||||
public OutputSlot(final FixedItemInv a, final int b, final int c, final int d, final int i) {
|
||||
super(a, b, c, d);
|
||||
this.setIIcon(i);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class PatternOutputsSlot extends OptionalFakeSlot {
|
||||
|
||||
public PatternOutputsSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx, final int x,
|
||||
public PatternOutputsSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx, final int x,
|
||||
final int y, final int offX, final int offY, final int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -37,8 +37,8 @@ public class PatternTermSlot extends CraftingTermSlot {
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public PatternTermSlot(final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc,
|
||||
final IStorageMonitorable storage, final ItemTransferable cMatrix, final ItemTransferable secondMatrix,
|
||||
final ItemTransferable output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber,
|
||||
final IStorageMonitorable storage, final FixedItemInv cMatrix, final FixedItemInv secondMatrix,
|
||||
final FixedItemInv output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber,
|
||||
final IContainerCraftingPacket c) {
|
||||
super(player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c);
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
public class PlayerHotBarSlot extends AppEngSlot {
|
||||
|
||||
public PlayerHotBarSlot(final ItemTransferable par1iInventory, final int par2, final int par3, final int par4) {
|
||||
public PlayerHotBarSlot(final FixedItemInv par1iInventory, final int par2, final int par3, final int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.setPlayerSide(true);
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
package appeng.container.slot;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
// there is nothing special about this slot, its simply used to represent the players inventory, vs a container slot.
|
||||
|
||||
public class PlayerInvSlot extends AppEngSlot {
|
||||
|
||||
public PlayerInvSlot(final ItemTransferable par1iInventory, final int idx, final int x, final int y) {
|
||||
public PlayerInvSlot(final FixedItemInv par1iInventory, final int idx, final int x, final int y) {
|
||||
super(par1iInventory, idx, x, y);
|
||||
|
||||
this.setPlayerSide(true);
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.container.slot;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -70,7 +70,7 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
private boolean allowEdit = true;
|
||||
private int stackLimit = -1;
|
||||
|
||||
public RestrictedInputSlot(final PlacableItemType valid, final ItemTransferable i, final int slotIndex, final int x,
|
||||
public RestrictedInputSlot(final PlacableItemType valid, final FixedItemInv i, final int slotIndex, final int x,
|
||||
final int y, final PlayerInventory p) {
|
||||
super(i, slotIndex, x, y);
|
||||
this.which = valid;
|
||||
@@ -233,7 +233,7 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
final ItemStack is = super.getStack();
|
||||
if (!is.isEmpty() && is.getItem() instanceof EncodedPatternItem) {
|
||||
final EncodedPatternItem iep = (EncodedPatternItem) is.getItem();
|
||||
final ItemStack out = iep.getOutput(is);
|
||||
final ItemStack out = iep.getOutput(p.player.world, is);
|
||||
if (!out.isEmpty()) {
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package appeng.core;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class AERecipeType<T extends IRecipe<?>> implements IRecipeType<T> {
|
||||
public class AERecipeType<T extends Recipe<?>> implements RecipeType<T> {
|
||||
private final String id;
|
||||
|
||||
public AERecipeType(Identifier registryName) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.Identifier;
|
||||
@@ -120,7 +120,7 @@ public final class AppEng {
|
||||
modEventBus.addGenericListener(ParticleType.class, registration::registerParticleTypes);
|
||||
modEventBus.addGenericListener(BlockEntityType.class, registration::registerTileEntities);
|
||||
modEventBus.addGenericListener(ContainerType.class, registration::registerContainerTypes);
|
||||
modEventBus.addGenericListener(IRecipeSerializer.class, registration::registerRecipeSerializers);
|
||||
modEventBus.addGenericListener(RecipeSerializer.class, registration::registerRecipeSerializers);
|
||||
modEventBus.addGenericListener(Feature.class, registration::registerWorldGen);
|
||||
modEventBus.addGenericListener(Biome.class, registration::registerBiomes);
|
||||
modEventBus.addGenericListener(ModDimension.class, registration::registerModDimension);
|
||||
|
||||
@@ -37,8 +37,6 @@ import appeng.core.sync.BasePacket;
|
||||
|
||||
public abstract class CommonHelper {
|
||||
|
||||
public abstract World getWorld();
|
||||
|
||||
public abstract void bindTileEntitySpecialRenderer(Class<? extends BlockEntity> tile, AEBaseBlock blk);
|
||||
|
||||
public abstract List<? extends PlayerEntity> getPlayers();
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -309,8 +309,8 @@ final class Registration {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void registerRecipeSerializers(RegistryEvent.Register<IRecipeSerializer<?>> event) {
|
||||
IForgeRegistry<IRecipeSerializer<?>> r = event.getRegistry();
|
||||
public void registerRecipeSerializers(RegistryEvent.Register<RecipeSerializer<?>> event) {
|
||||
IForgeRegistry<RecipeSerializer<?>> r = event.getRegistry();
|
||||
|
||||
GrinderRecipe.TYPE = new AERecipeType<>(GrinderRecipeSerializer.INSTANCE.getRegistryName());
|
||||
InscriberRecipe.TYPE = new AERecipeType<>(InscriberRecipeSerializer.INSTANCE.getRegistryName());
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -77,28 +78,28 @@ public final class WirelessRegistry implements IWirelessTermRegistry {
|
||||
}
|
||||
|
||||
if (!this.isWirelessTerminal(item)) {
|
||||
player.sendMessage(PlayerMessages.DeviceNotWirelessTerminal.get());
|
||||
player.sendSystemMessage(PlayerMessages.DeviceNotWirelessTerminal.get(), Util.NIL_UUID);
|
||||
return;
|
||||
}
|
||||
|
||||
final IWirelessTermHandler handler = this.getWirelessTerminalHandler(item);
|
||||
final String unparsedKey = handler.getEncryptionKey(item);
|
||||
if (unparsedKey.isEmpty()) {
|
||||
player.sendMessage(PlayerMessages.DeviceNotLinked.get());
|
||||
player.sendSystemMessage(PlayerMessages.DeviceNotLinked.get(), Util.NIL_UUID);
|
||||
return;
|
||||
}
|
||||
|
||||
final long parsedKey = Long.parseLong(unparsedKey);
|
||||
final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy(parsedKey);
|
||||
if (securityStation == null) {
|
||||
player.sendMessage(PlayerMessages.StationCanNotBeLocated.get());
|
||||
player.sendSystemMessage(PlayerMessages.StationCanNotBeLocated.get(), Util.NIL_UUID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (handler.hasPower(player, 0.5, item)) {
|
||||
ContainerOpener.openContainer(WirelessTermContainer.TYPE, player, ContainerLocator.forHand(player, hand));
|
||||
} else {
|
||||
player.sendMessage(PlayerMessages.DeviceNotPowered.get());
|
||||
player.sendSystemMessage(PlayerMessages.DeviceNotPowered.get(), Util.NIL_UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,6 @@ public class ItemTransitionEffectPacket extends BasePacket {
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
|
||||
final World world = AppEng.proxy.getWorld();
|
||||
|
||||
EnergyParticleData data = new EnergyParticleData(true, this.d);
|
||||
for (int zz = 0; zz < 8; zz++) {
|
||||
if (AppEng.proxy.shouldAddParticles(Platform.getRandom())) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -47,7 +47,7 @@ import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ViewCellItem;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
@@ -65,7 +65,7 @@ public class JEIRecipePacket extends BasePacket {
|
||||
if (list.size() > 0) {
|
||||
this.recipe[x] = new ItemStack[list.size()];
|
||||
for (int y = 0; y < list.size(); y++) {
|
||||
this.recipe[x][y] = ItemStack.read(list.getCompound(y));
|
||||
this.recipe[x][y] = ItemStack.fromTag(list.getCompound(y));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,16 +108,16 @@ public class JEIRecipePacket extends BasePacket {
|
||||
final IEnergyGrid energy = grid.getCache(IEnergyGrid.class);
|
||||
final ISecurityGrid security = grid.getCache(ISecurityGrid.class);
|
||||
final ICraftingGrid crafting = grid.getCache(ICraftingGrid.class);
|
||||
final ItemTransferable craftMatrix = cct.getInventoryByName("crafting");
|
||||
final ItemTransferable playerInventory = cct.getInventoryByName("player");
|
||||
final FixedItemInv craftMatrix = cct.getInventoryByName("crafting");
|
||||
final FixedItemInv playerInventory = cct.getInventoryByName("player");
|
||||
|
||||
if (inv != null && this.recipe != null && security != null) {
|
||||
final IMEMonitor<IAEItemStack> storage = inv
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final IPartitionList<IAEItemStack> filter = ViewCellItem.createFilter(cct.getViewCells());
|
||||
|
||||
for (int x = 0; x < craftMatrix.getSlots(); x++) {
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot(x);
|
||||
for (int x = 0; x < craftMatrix.getSlotCount(); x++) {
|
||||
ItemStack currentItem = craftMatrix.getInvStack(x);
|
||||
|
||||
// prepare slots
|
||||
if (!currentItem.isEmpty()) {
|
||||
@@ -168,7 +168,7 @@ public class JEIRecipePacket extends BasePacket {
|
||||
|
||||
// try inventory
|
||||
if (currentItem.isEmpty()) {
|
||||
AdaptorItemHandler ad = new AdaptorItemHandler(playerInventory);
|
||||
AdaptorFixedInv ad = new AdaptorFixedInv(playerInventory);
|
||||
|
||||
if (cct.useRealItems()) {
|
||||
currentItem = ad.removeItems(1, this.recipe[x][y], null);
|
||||
|
||||
@@ -62,7 +62,6 @@ public class MockExplosionPacket extends BasePacket {
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
|
||||
final World world = AppEng.proxy.getWorld();
|
||||
world.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||
player.world.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -63,7 +63,7 @@ public class PatternSlotPacket extends BasePacket {
|
||||
}
|
||||
|
||||
// api
|
||||
public PatternSlotPacket(final ItemTransferable pat, final IAEItemStack slotItem, final boolean shift) {
|
||||
public PatternSlotPacket(final FixedItemInv pat, final IAEItemStack slotItem, final boolean shift) {
|
||||
|
||||
this.slotItem = slotItem;
|
||||
this.shift = shift;
|
||||
@@ -77,7 +77,7 @@ public class PatternSlotPacket extends BasePacket {
|
||||
this.writeItem(slotItem, data);
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.pattern[x] = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(pat.getStackInSlot(x));
|
||||
.createStack(pat.getInvStack(x));
|
||||
this.writeItem(this.pattern[x], data);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import appeng.util.FakePlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -68,15 +70,15 @@ public class CraftingTreeProcess {
|
||||
|
||||
final CraftingInventory ic = new CraftingInventory(new ContainerNull(), 3, 3);
|
||||
final IAEItemStack[] is = details.getInputs();
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
ic.setInventorySlotContents(x, is[x] == null ? ItemStack.EMPTY : is[x].createItemStack());
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
ic.setStack(x, is[x] == null ? ItemStack.EMPTY : is[x].createItemStack());
|
||||
}
|
||||
|
||||
BasicEventHooks.firePlayerCraftingEvent(Platform.getPlayer((ServerWorld) world),
|
||||
BasicEventHooks.firePlayerCraftingEvent((PlayerEntity) FakePlayer.getOrCreate((ServerWorld) world),
|
||||
details.getOutput(ic, world), ic);
|
||||
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
final ItemStack g = ic.getStackInSlot(x);
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
final ItemStack g = ic.getStack(x);
|
||||
if (!g.isEmpty() && g.getCount() > 1) {
|
||||
this.fullSimulation = true;
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public class CraftingTreeProcess {
|
||||
this.limitQty = true;
|
||||
}
|
||||
|
||||
if (g.getItem().hasContainerItem(g)) {
|
||||
if (g.getItem().hasRecipeRemainder(g)) {
|
||||
this.limitQty = this.containerItems = true;
|
||||
}
|
||||
}
|
||||
@@ -170,15 +172,15 @@ public class CraftingTreeProcess {
|
||||
final IAEItemStack item = entry.getKey().getStack(entry.getValue());
|
||||
final IAEItemStack stack = entry.getKey().request(inv, item.getStackSize(), src);
|
||||
|
||||
ic.setInventorySlotContents(entry.getKey().getSlot(), stack.createItemStack());
|
||||
ic.setStack(entry.getKey().getSlot(), stack.createItemStack());
|
||||
}
|
||||
|
||||
BasicEventHooks.firePlayerCraftingEvent(Platform.getPlayer((ServerWorld) this.world),
|
||||
BasicEventHooks.firePlayerCraftingEvent((PlayerEntity) FakePlayer.getOrCreate((ServerWorld) this.world),
|
||||
this.details.getOutput(ic, this.world), ic);
|
||||
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
ItemStack is = ic.getStackInSlot(x);
|
||||
is = Platform.getContainerItem(is);
|
||||
for (int x = 0; x < ic.size(); x++) {
|
||||
ItemStack is = ic.getStack(x);
|
||||
is = Platform.getRecipeRemainder(is);
|
||||
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(is);
|
||||
@@ -194,7 +196,7 @@ public class CraftingTreeProcess {
|
||||
final IAEItemStack stack = entry.getKey().request(inv, item.getStackSize() * i, src);
|
||||
|
||||
if (this.containerItems) {
|
||||
final ItemStack is = Platform.getContainerItem(stack.createItemStack());
|
||||
final ItemStack is = Platform.getRecipeRemainder(stack.createItemStack());
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(is);
|
||||
if (o != null) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements ITick
|
||||
|
||||
if (this.countdown % 20 == 0) {
|
||||
for (final PlayerEntity e : AppEng.proxy.getPlayers()) {
|
||||
e.sendMessage(new LiteralText("Spawning in... " + (this.countdown / 20)));
|
||||
e.sendSystemMessage(new LiteralText("Spawning in... " + (this.countdown / 20)), Util.NIL_UUID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements ITick
|
||||
this.size = 64;
|
||||
}
|
||||
|
||||
player.sendMessage(new LiteralText("Size: " + this.size));
|
||||
player.sendSystemMessage(new LiteralText("Size: " + this.size), Util.NIL_UUID);
|
||||
} else {
|
||||
this.countdown = 20 * 10;
|
||||
this.is = hand;
|
||||
|
||||
@@ -49,19 +49,19 @@ public class DebugPartPlacerItem extends AEBaseItem {
|
||||
}
|
||||
|
||||
if (!player.abilities.isCreativeMode) {
|
||||
player.sendMessage(new LiteralText("Only usable in creative mode"));
|
||||
player.sendSystemMessage(new LiteralText("Only usable in creative mode"), Util.NIL_UUID);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
BlockEntity te = world.getBlockEntity(pos);
|
||||
if (!(te instanceof IPartHost)) {
|
||||
player.sendMessage(new LiteralText("Right-click something that will accept parts"));
|
||||
player.sendSystemMessage(new LiteralText("Right-click something that will accept parts"), Util.NIL_UUID);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
IPartHost center = (IPartHost) te;
|
||||
IPart cable = center.getPart(AEPartLocation.INTERNAL);
|
||||
if (cable == null) {
|
||||
player.sendMessage(new LiteralText("Clicked part host must have an INSIDE part"));
|
||||
player.sendSystemMessage(new LiteralText("Clicked part host must have an INSIDE part"), Util.NIL_UUID);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Queue;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -42,7 +42,7 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
|
||||
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
|
||||
|
||||
private final ItemTransferable handler = new QueuedItemHandler();
|
||||
private final FixedItemInv handler = new QueuedItemHandler();
|
||||
|
||||
public ItemGenBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
@@ -81,7 +81,7 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
class QueuedItemHandler implements ItemTransferable {
|
||||
class QueuedItemHandler implements FixedItemInv {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
|
||||
CraterType craterType = CraterType.values()[tag.getByte(MODE_TAG)];
|
||||
|
||||
player.sendMessage(new LiteralText(craterType.name()));
|
||||
player.sendSystemMessage(new LiteralText(craterType.name()), Util.NIL_UUID);
|
||||
|
||||
return TypedActionResult.resultSuccess(itemStack);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.util.math.Box;
|
||||
@@ -39,14 +39,14 @@ public abstract class AEBaseItemEntity extends ItemEntity {
|
||||
final double y, final double z, final ItemStack stack) {
|
||||
this(entityType, world);
|
||||
this.setPosition(x, y, z);
|
||||
this.rotationYaw = this.rand.nextFloat() * 360.0F;
|
||||
this.yaw = this.rand.nextFloat() * 360.0F;
|
||||
this.setMotion(this.rand.nextDouble() * 0.2D - 0.1D, 0.2D, this.rand.nextDouble() * 0.2D - 0.1D);
|
||||
this.setItem(stack);
|
||||
this.lifespan = stack.getEntityLifespan(world);
|
||||
}
|
||||
|
||||
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity(final Box region) {
|
||||
return this.world.getEntitiesWithinAABBExcludingEntity(this, region);
|
||||
return this.world.getEntities(this, region);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.Box;
|
||||
@@ -64,7 +64,7 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
}
|
||||
|
||||
if (world.isClient && this.delay > 30 && AEConfig.instance().isEnableEffects()) {
|
||||
AppEng.proxy.spawnEffect(EffectType.Lightning, this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
AppEng.proxy.spawnEffect(EffectType.Lightning, this.world, this.getX(), this.getY(), this.getZ(),
|
||||
null);
|
||||
this.delay = 0;
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if (materials.certusQuartzCrystalCharged().isSameAs(item)) {
|
||||
final Box region = new Box(this.getPosX() - 1, this.getPosY() - 1, this.getPosZ() - 1,
|
||||
this.getPosX() + 1, this.getPosY() + 1, this.getPosZ() + 1);
|
||||
final Box region = new Box(this.getX() - 1, this.getY() - 1, this.getZ() - 1,
|
||||
this.getX() + 1, this.getY() + 1, this.getZ() + 1);
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
ItemEntity redstone = null;
|
||||
@@ -135,10 +135,10 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
}
|
||||
|
||||
materials.fluixCrystal().maybeStack(2).ifPresent(is -> {
|
||||
final ItemEntity entity = new ItemEntity(this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
final ItemEntity entity = new ItemEntity(this.world, this.getX(), this.getY(), this.getZ(),
|
||||
is);
|
||||
|
||||
this.world.addEntity(entity);
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
@@ -117,8 +117,8 @@ public final class GrowingCrystalEntity extends AEBaseItemEntity {
|
||||
|
||||
if (this.progress_1000 >= len) {
|
||||
this.progress_1000 = 0;
|
||||
AppEng.proxy.spawnEffect(EffectType.Vibrant, this.world, this.getPosX(), this.getPosY() + 0.2,
|
||||
this.getPosZ(), null);
|
||||
AppEng.proxy.spawnEffect(EffectType.Vibrant, this.world, this.getX(), this.getY() + 0.2,
|
||||
this.getZ(), null);
|
||||
}
|
||||
} else {
|
||||
if (this.progress_1000 > 1000) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -74,8 +74,8 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if (materials.singularity().isSameAs(item)) {
|
||||
final Box region = new Box(this.getPosX() - 4, this.getPosY() - 4, this.getPosZ() - 4,
|
||||
this.getPosX() + 4, this.getPosY() + 4, this.getPosZ() + 4);
|
||||
final Box region = new Box(this.getX() - 4, this.getY() - 4, this.getZ() - 4,
|
||||
this.getX() + 4, this.getY() + 4, this.getZ() + 4);
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
for (final Entity e : l) {
|
||||
@@ -86,7 +86,7 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
|
||||
if (matches) {
|
||||
while (item.getCount() > 0 && other.getCount() > 0) {
|
||||
other.grow(-1);
|
||||
other.increment(-1);
|
||||
;
|
||||
if (other.getCount() == 0) {
|
||||
e.remove();
|
||||
@@ -96,11 +96,11 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
final CompoundTag cmp = singularityStack.getOrCreateTag();
|
||||
cmp.putLong("freq", (new Date()).getTime() * 100 + (randTickSeed) % 100);
|
||||
randTickSeed++;
|
||||
item.grow(-1);
|
||||
item.increment(-1);
|
||||
|
||||
final SingularityEntity entity = new SingularityEntity(this.world, this.getPosX(),
|
||||
this.getPosY(), this.getPosZ(), singularityStack);
|
||||
this.world.addEntity(entity);
|
||||
final SingularityEntity entity = new SingularityEntity(this.world, this.getX(),
|
||||
this.getY(), this.getZ(), singularityStack);
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.item.TNTEntity;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
@@ -69,9 +69,9 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
public void tick() {
|
||||
this.handleWaterMovement();
|
||||
|
||||
this.prevPosX = this.getPosX();
|
||||
this.prevPosY = this.getPosY();
|
||||
this.prevPosZ = this.getPosZ();
|
||||
this.prevX = this.getX();
|
||||
this.prevY = this.getY();
|
||||
this.prevZ = this.getZ();
|
||||
this.setMotion(this.getMotion().subtract(0, 0.03999999910593033D, 0));
|
||||
this.move(MoverType.SELF, this.getMotion());
|
||||
this.setMotion(this.getMotion().mul(0.9800000190734863D, 0.9800000190734863D, 0.9800000190734863D));
|
||||
@@ -83,15 +83,15 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
if (this.isInWater() && Platform.isServer()) // put out the fuse.
|
||||
{
|
||||
AEApi.instance().definitions().blocks().tinyTNT().maybeStack(1).ifPresent(tntStack -> {
|
||||
final ItemEntity item = new ItemEntity(this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
final ItemEntity item = new ItemEntity(this.world, this.getX(), this.getY(), this.getZ(),
|
||||
tntStack);
|
||||
|
||||
item.setMotion(this.getMotion());
|
||||
item.prevPosX = this.prevPosX;
|
||||
item.prevPosY = this.prevPosY;
|
||||
item.prevPosZ = this.prevPosZ;
|
||||
item.prevX = this.prevX;
|
||||
item.prevY = this.prevY;
|
||||
item.prevZ = this.prevZ;
|
||||
|
||||
this.world.addEntity(item);
|
||||
this.world.spawnEntity(item);
|
||||
this.remove();
|
||||
});
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
this.explode();
|
||||
}
|
||||
} else {
|
||||
this.world.addParticle(ParticleTypes.SMOKE, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0D, 0.0D,
|
||||
this.world.addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D,
|
||||
0.0D);
|
||||
}
|
||||
this.setFuse(this.getFuse() - 1);
|
||||
@@ -112,7 +112,7 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
// override :P
|
||||
@Override
|
||||
protected void explode() {
|
||||
this.world.playSound(null, this.getPosX(), this.getPosY(), this.getPosZ(), SoundEvents.ENTITY_GENERIC_EXPLODE,
|
||||
this.world.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE,
|
||||
SoundCategory.BLOCKS, 4.0F,
|
||||
(1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 32.9F);
|
||||
|
||||
@@ -120,11 +120,11 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
return;
|
||||
}
|
||||
|
||||
final Explosion ex = new Explosion(this.world, this, this.getPosX(), this.getPosY(), this.getPosZ(), 0.2f,
|
||||
final Explosion ex = new Explosion(this.world, this, this.getX(), this.getY(), this.getZ(), 0.2f,
|
||||
false, Mode.BREAK);
|
||||
final Box area = new Box(this.getPosX() - 1.5, this.getPosY() - 1.5f, this.getPosZ() - 1.5,
|
||||
this.getPosX() + 1.5, this.getPosY() + 1.5, this.getPosZ() + 1.5);
|
||||
final List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, area);
|
||||
final Box area = new Box(this.getX() - 1.5, this.getY() - 1.5f, this.getZ() - 1.5,
|
||||
this.getX() + 1.5, this.getY() + 1.5, this.getZ() + 1.5);
|
||||
final List<Entity> list = this.world.getEntities(this, area);
|
||||
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.world, ex, list, 0.2f * 2d);
|
||||
|
||||
@@ -133,11 +133,11 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
}
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.TINY_TNT_BLOCK_DAMAGE)) {
|
||||
this.setPosition(this.getPosX(), this.getPosY() - 0.25, this.getPosZ());
|
||||
this.setPosition(this.getX(), this.getY() - 0.25, this.getPosZ());
|
||||
|
||||
for (int x = (int) (this.getPosX() - 2); x <= this.getPosX() + 2; x++) {
|
||||
for (int y = (int) (this.getPosY() - 2); y <= this.getPosY() + 2; y++) {
|
||||
for (int z = (int) (this.getPosZ() - 2); z <= this.getPosZ() + 2; z++) {
|
||||
for (int x = (int) (this.getX() - 2); x <= this.getX() + 2; x++) {
|
||||
for (int y = (int) (this.getY() - 2); y <= this.getY() + 2; y++) {
|
||||
for (int z = (int) (this.getZ() - 2); z <= this.getZ() + 2; z++) {
|
||||
final BlockPos point = new BlockPos(x, y, z);
|
||||
final BlockState state = this.world.getBlockState(point);
|
||||
final Block block = state.getBlock();
|
||||
@@ -166,8 +166,8 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
}
|
||||
}
|
||||
|
||||
AppEng.proxy.sendToAllNearExcept(null, this.getPosX(), this.getPosY(), this.getPosZ(), 64, this.world,
|
||||
new MockExplosionPacket(this.getPosX(), this.getPosY(), this.getPosZ()));
|
||||
AppEng.proxy.sendToAllNearExcept(null, this.getX(), this.getY(), this.getZ(), 64, this.world,
|
||||
new MockExplosionPacket(this.getX(), this.getY(), this.getPosZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -91,7 +91,7 @@ public class FacadeContainer implements IFacadeContainer {
|
||||
for (int x = 0; x < this.facades; x++) {
|
||||
if (this.storage.getFacade(x) != null) {
|
||||
final CompoundTag data = new CompoundTag();
|
||||
this.storage.getFacade(x).getItemStack().write(data);
|
||||
this.storage.getFacade(x).getItemStack().toTag(data);
|
||||
c.put("facade:" + x, data);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class FacadeContainer implements IFacadeContainer {
|
||||
|
||||
final CompoundTag t = c.getCompound("facade:" + x);
|
||||
if (t != null) {
|
||||
final ItemStack is = ItemStack.read(t);
|
||||
final ItemStack is = ItemStack.fromTag(t);
|
||||
if (!is.isEmpty()) {
|
||||
final net.minecraft.item.Item i = is.getItem();
|
||||
if (i instanceof IFacadeItem) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
package appeng.fluids.container;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -50,7 +50,7 @@ public class FluidFormationPlaneContainer extends FluidConfigurableContainer {
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -86,7 +86,7 @@ public class FluidStorageBusContainer extends FluidConfigurableContainer {
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
|
||||
this.getPlayerInventory())).setNotDraggable());
|
||||
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.fluids.helper;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -491,7 +491,7 @@ public class DualityFluidInterface
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(String name) {
|
||||
public FixedItemInv getInventoryByName(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.fluids.items;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
@@ -88,7 +88,7 @@ public final class BasicFluidStorageCell extends AbstractStorageCell<IAEFluidSta
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
public FixedItemInv getConfigInventory(final ItemStack is) {
|
||||
return new FluidCellConfig(is);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -200,7 +200,7 @@ public class FluidInterfacePart extends BasicStatePart
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(String name) {
|
||||
public FixedItemInv getInventoryByName(String name) {
|
||||
return this.duality.getInventoryByName(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -153,7 +153,7 @@ public class FluidInterfaceBlockEntity extends AENetworkBlockEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(String name) {
|
||||
public FixedItemInv getInventoryByName(String name) {
|
||||
return this.duality.getInventoryByName(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.RecipeProvider;
|
||||
import net.minecraft.data.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.SingleItemRecipeBuilder;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.common.crafting.ConditionalRecipe;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -106,7 +106,7 @@ import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.InvOperation;
|
||||
@@ -169,7 +169,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removed, final ItemStack added) {
|
||||
if (this.isWorking == slot) {
|
||||
return;
|
||||
@@ -213,7 +213,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if (this.waitingToSend != null) {
|
||||
for (final ItemStack is : this.waitingToSend) {
|
||||
final CompoundTag item = new CompoundTag();
|
||||
is.write(item);
|
||||
is.toTag(item);
|
||||
waitingToSend.add(item);
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
for (int x = 0; x < waitingList.size(); x++) {
|
||||
final CompoundTag c = waitingList.getCompound(x);
|
||||
if (c != null) {
|
||||
final ItemStack is = ItemStack.read(c);
|
||||
final ItemStack is = ItemStack.fromTag(c);
|
||||
this.addToSendList(is);
|
||||
}
|
||||
}
|
||||
@@ -445,11 +445,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
// return after.stackSize != stack.stackSize;
|
||||
}
|
||||
|
||||
public ItemTransferable getConfig() {
|
||||
public FixedItemInv getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
public ItemTransferable getPatterns() {
|
||||
public FixedItemInv getPatterns() {
|
||||
return this.patterns;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return new DimensionalCoord(this.iHost.getBlockEntity());
|
||||
}
|
||||
|
||||
public ItemTransferable getInternalInventory() {
|
||||
public FixedItemInv getInternalInventory() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
private InventoryAdaptor getAdaptor(final int slot) {
|
||||
return new AdaptorItemHandler(new RangedWrapper(this.storage, slot, slot + 1));
|
||||
return new AdaptorFixedInv(new RangedWrapper(this.storage, slot, slot + 1));
|
||||
}
|
||||
|
||||
private boolean handleCrafting(final int x, final InventoryAdaptor d, final IAEItemStack itemStack) {
|
||||
@@ -685,7 +685,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventoryByName(final String name) {
|
||||
public FixedItemInv getInventoryByName(final String name) {
|
||||
if (name.equals("storage")) {
|
||||
return this.storage;
|
||||
}
|
||||
@@ -705,7 +705,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemTransferable getStorage() {
|
||||
public FixedItemInv getStorage() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@@ -786,8 +786,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
if (this.acceptsItems(ad, table)) {
|
||||
for (int x = 0; x < table.getSizeInventory(); x++) {
|
||||
final ItemStack is = table.getStackInSlot(x);
|
||||
for (int x = 0; x < table.size(); x++) {
|
||||
final ItemStack is = table.getStack(x);
|
||||
if (!is.isEmpty()) {
|
||||
final ItemStack added = ad.addItems(is);
|
||||
this.addToSendList(added);
|
||||
@@ -844,8 +844,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
private boolean acceptsItems(final InventoryAdaptor ad, final CraftingInventory table) {
|
||||
for (int x = 0; x < table.getSizeInventory(); x++) {
|
||||
final ItemStack is = table.getStackInSlot(x);
|
||||
for (int x = 0; x < table.size(); x++) {
|
||||
final ItemStack is = table.getStack(x);
|
||||
if (is.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private class InterfaceInventory extends MEMonitorIInventory {
|
||||
|
||||
public InterfaceInventory(final DualityInterface tileInterface) {
|
||||
super(new AdaptorItemHandler(tileInterface.storage));
|
||||
super(new AdaptorFixedInv(tileInterface.storage));
|
||||
this.setActionSource(new MachineSource(DualityInterface.this.iHost));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.helpers;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -36,7 +36,7 @@ public interface IContainerCraftingPacket {
|
||||
*
|
||||
* @return the inventory of the part/tile by name.
|
||||
*/
|
||||
ItemTransferable getInventoryByName(String string);
|
||||
FixedItemInv getInventoryByName(String string);
|
||||
|
||||
/**
|
||||
* @return who are we?
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class InvalidPatternHelper {
|
||||
private ItemStack stack;
|
||||
|
||||
public PatternIngredient(CompoundTag tag) {
|
||||
this.stack = ItemStack.read(tag);
|
||||
this.stack = ItemStack.fromTag(tag);
|
||||
|
||||
if (this.stack.isEmpty()) {
|
||||
this.id = tag.getString("id");
|
||||
@@ -128,7 +128,7 @@ public class InvalidPatternHelper {
|
||||
Text result = new LiteralText(this.getCount() + " ").append(this.getName());
|
||||
|
||||
if (!this.isValid()) {
|
||||
result.applyTextStyle(TextFormatting.RED);
|
||||
result.formatted(Formatting.RED);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.world.World;
|
||||
@@ -80,27 +80,27 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
for (int x = 0; x < inTag.size(); x++) {
|
||||
CompoundTag ingredient = inTag.getCompound(x);
|
||||
final ItemStack gs = ItemStack.read(ingredient);
|
||||
final ItemStack gs = ItemStack.fromTag(ingredient);
|
||||
|
||||
if (!ingredient.isEmpty() && gs.isEmpty()) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
}
|
||||
|
||||
this.crafting.setInventorySlotContents(x, gs);
|
||||
this.crafting.setStack(x, gs);
|
||||
|
||||
if (!gs.isEmpty() && (!this.isCrafting || !gs.hasTag())) {
|
||||
this.markItemAs(x, gs, TestStatus.ACCEPT);
|
||||
}
|
||||
|
||||
in.add(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(gs));
|
||||
this.testFrame.setInventorySlotContents(x, gs);
|
||||
this.testFrame.setStack(x, gs);
|
||||
}
|
||||
|
||||
if (this.isCrafting) {
|
||||
this.standardRecipe = w.getRecipeManager().getRecipe(IRecipeType.CRAFTING, this.crafting, w).orElse(null);
|
||||
this.standardRecipe = w.getRecipeManager().getRecipe(RecipeType.CRAFTING, this.crafting, w).orElse(null);
|
||||
|
||||
if (this.standardRecipe != null) {
|
||||
this.correctOutput = this.standardRecipe.getCraftingResult(this.crafting);
|
||||
this.correctOutput = this.standardRecipe.craft(this.crafting);
|
||||
out.add(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(this.correctOutput));
|
||||
} else {
|
||||
@@ -112,7 +112,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
for (int x = 0; x < outTag.size(); x++) {
|
||||
CompoundTag resultItemTag = outTag.getCompound(x);
|
||||
final ItemStack gs = ItemStack.read(resultItemTag);
|
||||
final ItemStack gs = ItemStack.fromTag(resultItemTag);
|
||||
|
||||
if (!resultItemTag.isEmpty() && gs.isEmpty()) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
@@ -211,11 +211,11 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
break;
|
||||
}
|
||||
|
||||
for (int x = 0; x < this.crafting.getSizeInventory(); x++) {
|
||||
this.testFrame.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||
for (int x = 0; x < this.crafting.size(); x++) {
|
||||
this.testFrame.setStack(x, this.crafting.getStack(x));
|
||||
}
|
||||
|
||||
this.testFrame.setInventorySlotContents(slotIndex, i);
|
||||
this.testFrame.setStack(slotIndex, i);
|
||||
|
||||
// If we cannot substitute, the items must match exactly
|
||||
if (!canSubstitute && slotIndex < inputs.length) {
|
||||
@@ -226,10 +226,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
if (this.standardRecipe.matches(this.testFrame, w)) {
|
||||
final ItemStack testOutput = this.standardRecipe.getCraftingResult(this.testFrame);
|
||||
final ItemStack testOutput = this.standardRecipe.craft(this.testFrame);
|
||||
|
||||
if (Platform.itemComparisons().isSameItem(this.correctOutput, testOutput)) {
|
||||
this.testFrame.setInventorySlotContents(slotIndex, this.crafting.getStackInSlot(slotIndex));
|
||||
this.testFrame.setStack(slotIndex, this.crafting.getStack(slotIndex));
|
||||
this.markItemAs(slotIndex, i, TestStatus.ACCEPT);
|
||||
return true;
|
||||
}
|
||||
@@ -275,8 +275,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
throw new IllegalStateException("Only crafting recipes supported.");
|
||||
}
|
||||
|
||||
for (int x = 0; x < craftingInv.getSizeInventory(); x++) {
|
||||
if (!this.isValidItemForSlot(x, craftingInv.getStackInSlot(x), w)) {
|
||||
for (int x = 0; x < craftingInv.size(); x++) {
|
||||
if (!this.isValidItemForSlot(x, craftingInv.getStack(x), w)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
private TestStatus getStatus(final int slotIndex, final ItemStack i) {
|
||||
if (this.crafting.getStackInSlot(slotIndex).isEmpty()) {
|
||||
if (this.crafting.getStack(slotIndex).isEmpty()) {
|
||||
return i.isEmpty() ? TestStatus.ACCEPT : TestStatus.DECLINE;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,9 +267,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
final DimensionalCoord dc = wap.getLocation();
|
||||
|
||||
if (dc.getWorld() == this.myPlayer.world) {
|
||||
final double offX = dc.x - this.myPlayer.getPosX();
|
||||
final double offY = dc.y - this.myPlayer.getPosY();
|
||||
final double offZ = dc.z - this.myPlayer.getPosZ();
|
||||
final double offX = dc.x - this.myPlayer.getX();
|
||||
final double offY = dc.y - this.myPlayer.getY();
|
||||
final double offZ = dc.z - this.myPlayer.getZ();
|
||||
|
||||
final double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if (r < rangeLimit && this.sqRange > r) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.hooks;
|
||||
|
||||
import appeng.util.FakePlayer;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
@@ -51,10 +52,10 @@ public final class MatterCannonDispenseItemBehavior extends DefaultDispenseItemB
|
||||
|
||||
final World w = dispenser.getWorld();
|
||||
if (w instanceof ServerWorld) {
|
||||
final PlayerEntity p = Platform.getPlayer((ServerWorld) w);
|
||||
final PlayerEntity p = FakePlayer.getOrCreate((ServerWorld) w);
|
||||
Platform.configurePlayer(p, dir, dispenser.getBlockTileEntity());
|
||||
|
||||
p.setPosition(p.getPosX() + dir.xOffset, p.getPosY() + dir.yOffset, p.getPosZ() + dir.zOffset);
|
||||
p.setPosition(p.getX() + dir.xOffset, p.getY() + dir.yOffset, p.getZ() + dir.zOffset);
|
||||
|
||||
dispensedItem = tm.onItemRightClick(w, p, null).getResult();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class TinyTNTDispenseItemBehavior extends DefaultDispenseItemBehavi
|
||||
final int k = dispenser.getBlockPos().getZ() + Direction.getOffsetZ();
|
||||
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(world, i + 0.5F, j + 0.5F, k + 0.5F,
|
||||
null);
|
||||
world.addEntity(primedTinyTNTEntity);
|
||||
world.spawnEntity(primedTinyTNTEntity);
|
||||
dispensedItem.setCount(dispensedItem.getCount() - 1);
|
||||
return dispensedItem;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
@@ -98,7 +98,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
|
||||
for (final ItemStack is : list) {
|
||||
final CompoundTag tag = new CompoundTag();
|
||||
is.write(tag);
|
||||
is.toTag(tag);
|
||||
tags.add(tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import mcjty.theoneprobe.api.ElementAlignment;
|
||||
import mcjty.theoneprobe.api.IProbeHitData;
|
||||
@@ -39,8 +39,8 @@ public class ChargerInfoProvider implements ITileProbInfoProvider {
|
||||
World world, BlockState blockState, IProbeHitData data) {
|
||||
if (tile instanceof ChargerBlockEntity) {
|
||||
final ChargerBlockEntity charger = (ChargerBlockEntity) tile;
|
||||
final ItemTransferable chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getStackInSlot(0);
|
||||
final FixedItemInv chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getInvStack(0);
|
||||
|
||||
if (!chargingItem.isEmpty()) {
|
||||
final String currentInventory = chargingItem.getName().getString();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
@@ -52,7 +52,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(ItemTransferable inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
public void onChangeInventory(FixedItemInv inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
ItemStack newStack) {
|
||||
}
|
||||
|
||||
@@ -68,23 +68,23 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
|
||||
|
||||
private static class NetworkToolInventoryFilter implements IAEItemFilter {
|
||||
@Override
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
public boolean allowExtract(FixedItemInv inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(FixedItemInv inv, int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof IUpgradeModule
|
||||
&& ((IUpgradeModule) stack.getItem()).getType(stack) != null;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemTransferable getInternalInventory() {
|
||||
public FixedItemInv getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTransferable getInventory() {
|
||||
public FixedItemInv getInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user