Compare commits

..

2 commits

Author SHA1 Message Date
Flanks255
26dfa7cb75 More cleaning and yeeting. 2022-06-24 14:38:07 -05:00
Flanks255
2538de7a4f More lens fixes. 2022-06-24 14:23:43 -05:00
48 changed files with 242 additions and 308 deletions

View file

@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.lens.LensConversion;
import de.ellpeck.actuallyadditions.api.recipe.*; import de.ellpeck.actuallyadditions.api.recipe.*;
import de.ellpeck.actuallyadditions.mod.crafting.*; import de.ellpeck.actuallyadditions.mod.crafting.*;
import de.ellpeck.actuallyadditions.mod.items.lens.*;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -99,14 +100,13 @@ public final class ActuallyAdditionsAPI {
//These are getting initialized in Actually Additions' PreInit phase //These are getting initialized in Actually Additions' PreInit phase
//DO NOT CHANGE/OVERRIDE THESE!! //DO NOT CHANGE/OVERRIDE THESE!!
public static LensConversion lensDefaultConversion; public static final LensConversion lensDefaultConversion = new LensConversion();
public static Lens lensDetonation; public static final Lens lensDetonation = new LensDetonation();
public static Lens lensDeath; public static final Lens lensDeath = new LensDeath();
public static Lens lensEvenMoarDeath; public static final Lens lensEvenMoarDeath = new LensKiller();
public static Lens lensColor; public static final Lens lensColor = new LensColor();
public static Lens lensDisruption; public static final Lens lensDisenchanting = new LensDisenchanting();
public static Lens lensDisenchanting; public static final Lens lensMining = new LensMining();
public static Lens lensMining;
/** /**
* Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of stone. * Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of stone.

View file

@ -123,7 +123,7 @@ public class ActuallyAdditions {
ActuallyAdditionsAPI.methodHandler = new MethodHandler(); ActuallyAdditionsAPI.methodHandler = new MethodHandler();
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler(); ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
Lenses.init(); //Lenses.init();
// CompatUtil.registerCraftingTweaks(); // CompatUtil.registerCraftingTweaks();
event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER)); event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER));

View file

@ -37,6 +37,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -63,29 +64,29 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
if (!world.isClientSide) { if (!world.isClientSide) {
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos); TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos);
if (reconstructor != null) { if (reconstructor != null) {
if (StackUtil.isValid(heldItem)) { if (!heldItem.isEmpty()) {
Item item = heldItem.getItem(); Item item = heldItem.getItem();
if (item instanceof ILensItem && !StackUtil.isValid(reconstructor.inv.getStackInSlot(0))) { if (item instanceof ILensItem && reconstructor.inv.getStackInSlot(0).isEmpty()) {
ItemStack toPut = heldItem.copy(); ItemStack toPut = heldItem.copy();
toPut.setCount(1); toPut.setCount(1);
reconstructor.inv.setStackInSlot(0, toPut); reconstructor.inv.setStackInSlot(0, toPut);
player.inventory.removeItem(player.inventory.selected, 1); if (!player.isCreative()) {
heldItem.shrink(1);
} }
//Shush, don't tell anyone! return ActionResultType.CONSUME;
else if (CommonConfig.Other.ELEVEN.get() == 11 && item == Items.MUSIC_DISC_11) {
reconstructor.counter++;
reconstructor.setChanged();
} }
} else { } else {
ItemStack slot = reconstructor.inv.getStackInSlot(0); ItemStack slot = reconstructor.inv.getStackInSlot(0);
if (StackUtil.isValid(slot)) { if (!slot.isEmpty() && hand == Hand.MAIN_HAND) {
player.setItemInHand(hand, slot.copy()); player.setItemInHand(hand, slot.copy());
reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty()); reconstructor.inv.setStackInSlot(0, ItemStack.EMPTY);
return ActionResultType.CONSUME;
} }
} }
} }
return ActionResultType.FAIL;
} }
return ActionResultType.PASS; return ActionResultType.CONSUME;
} }
@Nullable @Nullable
@ -99,11 +100,6 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
return true; return true;
} }
// public BlockState getBaseConstructorState() {
// return this.stateContainer.getBaseState().with(FACING, Direction.NORTH);
// }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) {
@ -114,29 +110,18 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos());
if (tile instanceof TileEntityAtomicReconstructor) { if (tile instanceof TileEntityAtomicReconstructor) {
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0); ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
ITextComponent strg; ITextComponent lens_name;
if (!StackUtil.isValid(slot)) { if (slot.isEmpty()) {
strg = Lang.trans("info", "nolens"); lens_name = new TranslationTextComponent("info.actuallyadditions.nolens");
} else { } else {
strg = slot.getItem().getName(slot); lens_name = slot.getItem().getName(slot);
AssetUtil.renderStackToGui(slot, resolution.getGuiScaledWidth() / 2 + 15, resolution.getGuiScaledHeight() / 2 - 19, 1F); AssetUtil.renderStackToGui(slot, resolution.getGuiScaledWidth() / 2 + 15, resolution.getGuiScaledHeight() / 2 - 19, 1F);
} }
minecraft.font.drawShadow(matrices, strg.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2 + 35, resolution.getGuiScaledHeight() / 2f - 15, 0xFFFFFF); minecraft.font.drawShadow(matrices, lens_name.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2.0f + 35, resolution.getGuiScaledHeight() / 2.0f - 15, 0xFFFFFF);
} }
} }
// @Override
// public BlockState withRotation(BlockState state, Rotation rot) {
// return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
// }
//
// @Override
// public BlockState withMirror(BlockState state, Mirror mirror) {
// return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
// }
// public static class TheItemBlock extends ItemBlockBase { // public static class TheItemBlock extends ItemBlockBase {
// //
// private long lastSysTime; // private long lastSysTime;

View file

@ -54,14 +54,14 @@ public class BlockBatteryBox extends BlockContainerBase {
if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) { if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) {
box.inv.setStackInSlot(0, stack.copy()); box.inv.setStackInSlot(0, stack.copy());
player.setItemInHand(hand, StackUtil.getEmpty()); player.setItemInHand(hand, ItemStack.EMPTY);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
} else { } else {
ItemStack inSlot = box.inv.getStackInSlot(0); ItemStack inSlot = box.inv.getStackInSlot(0);
if (StackUtil.isValid(inSlot)) { if (StackUtil.isValid(inSlot)) {
player.setItemInHand(hand, inSlot.copy()); player.setItemInHand(hand, inSlot.copy());
box.inv.setStackInSlot(0, StackUtil.getEmpty()); box.inv.setStackInSlot(0, ItemStack.EMPTY);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
} }

View file

@ -129,7 +129,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
ItemStack inRelay = relay.inv.getStackInSlot(0).copy(); ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
if (StackUtil.isValid(inRelay)) { if (StackUtil.isValid(inRelay)) {
if (!world.isClientSide) { if (!world.isClientSide) {
relay.inv.setStackInSlot(0, StackUtil.getEmpty()); relay.inv.setStackInSlot(0, ItemStack.EMPTY);
if (!player.inventory.add(inRelay)) { if (!player.inventory.add(inRelay)) {
player.spawnAtLocation(inRelay, 0); player.spawnAtLocation(inRelay, 0);

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -25,6 +26,9 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.Vector3f;
import javax.annotation.Nonnull;
public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicReconstructor> { public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicReconstructor> {
@ -33,11 +37,9 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
} }
@Override @Override
public void render(TileEntityAtomicReconstructor tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { public void render(TileEntityAtomicReconstructor tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) {
ItemStack stack = tile.inv.getStackInSlot(0); ItemStack stack = tile.inv.getStackInSlot(0);
//default color 0x1b6dff //default color 0x1b6dff
if (tile.getProgress() > 0) {
Direction direction = tile.getOrientation(); Direction direction = tile.getOrientation();
float rot = 360.0f - direction.getOpposite().toYRot(); //Sigh... float rot = 360.0f - direction.getOpposite().toYRot(); //Sigh...
float pitch = 0; float pitch = 0;
@ -46,49 +48,25 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
} else if (direction == Direction.DOWN) { } else if (direction == Direction.DOWN) {
pitch = -90; pitch = -90;
} }
if (tile.getProgress() > 0) {
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, 5, 0, 0x1b6dff, 0.8f * tile.getProgress(), 0.2f); AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, 5, 0, 0x1b6dff, 0.8f * tile.getProgress(), 0.2f);
tile.decTTL(); tile.decTTL();
} }
if (!StackUtil.isValid(stack) || !(stack.getItem() instanceof ILensItem)) { if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) {
return; return;
} }
matrices.pushPose(); matrices.pushPose();
matrices.translate(0.5F, 0.5F, 0.5F); matrices.translate(0.5F, 0.5F, 0.5F);
matrices.mulPose(new Quaternion(180F, 0.0F, 0.0F, 1.0F));
BlockState state = tile.getLevel().getBlockState(tile.getBlockPos()); matrices.mulPose(Vector3f.YP.rotationDegrees(rot));
int meta = 0; //state.getBlock().getMetaFromState(state); // TODO: [port][fix] this needs to be checking direction not meta matrices.mulPose(Vector3f.XP.rotationDegrees(pitch));
if (meta == 0) {
matrices.translate(0F, -0.5F, 0F); matrices.translate(0.0F, 0.0F, -0.5F);
matrices.mulPose(new Quaternion(90F, 1F, 0F, 0F));
}
if (meta == 1) {
matrices.translate(0F, -1.5F - 0.5F / 16F, 0F);
matrices.mulPose(new Quaternion(90F, 1F, 0F, 0F));
}
if (meta == 2) {
matrices.translate(0F, -1F, 0F);
matrices.translate(0F, 0F, -0.5F);
}
if (meta == 3) {
matrices.translate(0F, -1F, 0F);
matrices.translate(0F, 0F, 0.5F + 0.5F / 16F);
}
if (meta == 4) {
matrices.translate(0F, -1F, 0F);
matrices.translate(0.5F + 0.5F / 16F, 0F, 0F);
matrices.mulPose(new Quaternion(90F, 0F, 1F, 0F));
}
if (meta == 5) {
matrices.translate(0F, -1F, 0F);
matrices.translate(-0.5F, 0F, 0F);
matrices.mulPose(new Quaternion(90F, 0F, 1F, 0F));
}
matrices.scale(0.5F, 0.5F, 0.5F); matrices.scale(0.5F, 0.5F, 0.5F);
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer); int lightColor = WorldRenderer.getLightColor(tile.getLevel(), tile.getPosition().relative(direction));
AssetUtil.renderItemInWorld(stack, lightColor, combinedOverlay, matrices, buffer);
matrices.popPose(); matrices.popPose();
} }

View file

@ -21,6 +21,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Util; import net.minecraft.util.Util;
@ -55,7 +56,7 @@ public class RenderBatteryBox extends TileEntityRenderer<TileEntityBatteryBox> {
FontRenderer font = Minecraft.getInstance().font; FontRenderer font = Minecraft.getInstance().font;
String energyTotal = Lang.cleanEnergyValues(cap, false); String energyTotal = Lang.cleanEnergyValues(cap, false);
String energyName = Lang.transI18n("misc", "power_name_long"); String energyName = I18n.get("misc.actuallyadditions.power_name_long");
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
font.draw(matrices, energyTotal, -font.width(energyTotal) / 2F, 10F, 0xFFFFFF); font.draw(matrices, energyTotal, -font.width(energyTotal) / 2F, 10F, 0xFFFFFF);

View file

@ -24,15 +24,17 @@ import net.minecraft.util.Util;
import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.Vector3f; import net.minecraft.util.math.vector.Vector3f;
import javax.annotation.Nonnull;
public class RenderDisplayStand extends TileEntityRenderer<TileEntityDisplayStand> { public class RenderDisplayStand extends TileEntityRenderer<TileEntityDisplayStand> {
public RenderDisplayStand(TileEntityRendererDispatcher rendererDispatcherIn) { public RenderDisplayStand(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn); super(rendererDispatcherIn);
} }
@Override @Override
public void render(TileEntityDisplayStand tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) { public void render(TileEntityDisplayStand tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) {
ItemStack stack = tile.inv.getStackInSlot(0); ItemStack stack = tile.inv.getStackInSlot(0);
if (!StackUtil.isValid(stack)) { if (stack.isEmpty()) {
return; return;
} }

View file

@ -183,38 +183,38 @@ public class ContainerBag extends Container implements IButtonReactor {
if (this.isVoid || !this.filter.check(newStack) || !this.moveItemStackTo(newStack, 4, 32, false)) { if (this.isVoid || !this.filter.check(newStack) || !this.moveItemStackTo(newStack, 4, 32, false)) {
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
if (SlotFilter.checkFilter(this, slotId, player)) { if (SlotFilter.checkFilter(this, slotId, player)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {

View file

@ -68,36 +68,36 @@ public class ContainerBioReactor extends Container {
//Shift from Inventory //Shift from Inventory
if (TileEntityBioReactor.isValidItem(newStack)) { if (TileEntityBioReactor.isValidItem(newStack)) {
if (!this.moveItemStackTo(newStack, 0, 8, false)) { if (!this.moveItemStackTo(newStack, 0, 8, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -71,30 +71,30 @@ public class ContainerBreaker extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
@ -68,36 +67,36 @@ public class ContainerCanolaPress extends Container {
Optional<PressingRecipe> recipeOptional = TileEntityCanolaPress.getRecipeForInput(newStack); Optional<PressingRecipe> recipeOptional = TileEntityCanolaPress.getRecipeForInput(newStack);
if (recipeOptional.isPresent()) { if (recipeOptional.isPresent()) {
if (!this.moveItemStackTo(newStack, 0, 1, false)) { if (!this.moveItemStackTo(newStack, 0, 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -65,36 +65,36 @@ public class ContainerCoalGenerator extends Container {
//Shift from Inventory //Shift from Inventory
if (ForgeHooks.getBurnTime(newStack) > 0) { if (ForgeHooks.getBurnTime(newStack) > 0) {
if (!this.moveItemStackTo(newStack, 0, 1, false)) { if (!this.moveItemStackTo(newStack, 0, 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -74,7 +74,7 @@ public class ContainerCoffeeMachine extends Container {
//Slots in Inventory to shift from //Slots in Inventory to shift from
if (slot == TileEntityCoffeeMachine.SLOT_OUTPUT) { if (slot == TileEntityCoffeeMachine.SLOT_OUTPUT) {
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onQuickCraft(newStack, currentStack); theSlot.onQuickCraft(newStack, currentStack);
} }
@ -83,44 +83,44 @@ public class ContainerCoffeeMachine extends Container {
//Shift from Inventory //Shift from Inventory
if (newStack.getItem() == ActuallyItems.COFFEE_CUP.get()) { if (newStack.getItem() == ActuallyItems.COFFEE_CUP.get()) {
if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (ItemCoffee.getIngredientFromStack(newStack) != null) { } else if (ItemCoffee.getIngredientFromStack(newStack) != null) {
if (!this.moveItemStackTo(newStack, 3, 11, false)) { if (!this.moveItemStackTo(newStack, 3, 11, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (ActuallyTags.Items.COFFEE_BEANS.contains(newStack.getItem())) { } else if (ActuallyTags.Items.COFFEE_BEANS.contains(newStack.getItem())) {
if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -70,30 +70,30 @@ public class ContainerDirectionalBreaker extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -85,36 +85,36 @@ public class ContainerDrill extends Container {
//Shift from Inventory //Shift from Inventory
if (newStack.getItem() instanceof ItemDrillUpgrade) { if (newStack.getItem() instanceof ItemDrillUpgrade) {
if (!this.moveItemStackTo(newStack, 0, 5, false)) { if (!this.moveItemStackTo(newStack, 0, 5, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -73,30 +73,30 @@ public class ContainerDropper extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -103,7 +103,7 @@ public class ContainerEnergizer extends Container {
//Slots in Inventory to shift from //Slots in Inventory to shift from
if (slot == 1) { if (slot == 1) {
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onQuickCraft(newStack, currentStack); theSlot.onQuickCraft(newStack, currentStack);
} }
@ -112,36 +112,36 @@ public class ContainerEnergizer extends Container {
//Shift from Inventory //Shift from Inventory
if (newStack.getCapability(CapabilityEnergy.ENERGY, null).isPresent()) { if (newStack.getCapability(CapabilityEnergy.ENERGY, null).isPresent()) {
if (!this.moveItemStackTo(newStack, 0, 1, false)) { if (!this.moveItemStackTo(newStack, 0, 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -91,7 +91,7 @@ public class ContainerEnervator extends Container {
//Slots in Inventory to shift from //Slots in Inventory to shift from
if (slot == 1) { if (slot == 1) {
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onQuickCraft(newStack, currentStack); theSlot.onQuickCraft(newStack, currentStack);
} }
@ -100,36 +100,36 @@ public class ContainerEnervator extends Container {
//Shift from Inventory //Shift from Inventory
if (newStack.getCapability(CapabilityEnergy.ENERGY).isPresent()) { if (newStack.getCapability(CapabilityEnergy.ENERGY).isPresent()) {
if (!this.moveItemStackTo(newStack, 0, 1, false)) { if (!this.moveItemStackTo(newStack, 0, 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
// //
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -75,30 +75,30 @@ public class ContainerFarmer extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -65,30 +65,30 @@ public class ContainerFeeder extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -60,29 +60,29 @@ public class ContainerFermentingBarrel extends Container {
if (slot >= inventoryStart) { if (slot >= inventoryStart) {
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -82,35 +82,35 @@ public class ContainerFilter extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
if (SlotFilter.checkFilter(this, slotId, player)) { if (SlotFilter.checkFilter(this, slotId, player)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {

View file

@ -59,7 +59,7 @@ public class ContainerFluidCollector extends Container {
//Slots in Inventory to shift from //Slots in Inventory to shift from
if (slot == 1) { if (slot == 1) {
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onQuickCraft(newStack, currentStack); theSlot.onQuickCraft(newStack, currentStack);
} }
@ -67,29 +67,29 @@ public class ContainerFluidCollector extends Container {
else if (slot >= inventoryStart) { else if (slot >= inventoryStart) {
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -72,7 +71,7 @@ public class ContainerFurnaceDouble extends Container {
//Slots in Inventory to shift from //Slots in Inventory to shift from
if (slot == TileEntityPoweredFurnace.SLOT_OUTPUT_1 || slot == TileEntityPoweredFurnace.SLOT_OUTPUT_2) { if (slot == TileEntityPoweredFurnace.SLOT_OUTPUT_1 || slot == TileEntityPoweredFurnace.SLOT_OUTPUT_2) {
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onQuickCraft(newStack, currentStack); theSlot.onQuickCraft(newStack, currentStack);
} }
@ -81,7 +80,7 @@ public class ContainerFurnaceDouble extends Container {
// TODO: VALIDATE // TODO: VALIDATE
IRecipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null); IRecipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
if (irecipe == null) { if (irecipe == null) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
ItemStack recipeOutput = irecipe.getResultItem(); ItemStack recipeOutput = irecipe.getResultItem();
@ -90,7 +89,7 @@ public class ContainerFurnaceDouble extends Container {
if (StackUtil.isValid(recipeOutput)) { if (StackUtil.isValid(recipeOutput)) {
if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_1, TileEntityPoweredFurnace.SLOT_INPUT_1 + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_1, TileEntityPoweredFurnace.SLOT_INPUT_1 + 1, false)) {
if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_2, TileEntityPoweredFurnace.SLOT_INPUT_2 + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_2, TileEntityPoweredFurnace.SLOT_INPUT_2 + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} }
@ -98,29 +97,29 @@ public class ContainerFurnaceDouble extends Container {
else if (slot >= inventoryStart && slot <= inventoryEnd) { else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -72,35 +72,35 @@ public class ContainerLaserRelayItemWhitelist extends Container {
if (slot >= inventoryStart) { if (slot >= inventoryStart) {
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
if (SlotFilter.checkFilter(this, slotId, player)) { if (SlotFilter.checkFilter(this, slotId, player)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} else { } else {
return super.clicked(slotId, dragType, clickTypeIn, player); return super.clicked(slotId, dragType, clickTypeIn, player);
} }

View file

@ -70,30 +70,30 @@ public class ContainerMiner extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -60,29 +60,29 @@ public class ContainerOilGenerator extends Container {
if (slot >= inventoryStart) { if (slot >= inventoryStart) {
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -70,30 +70,30 @@ public class ContainerPhantomPlacer extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -77,36 +77,36 @@ public class ContainerRangedCollector extends Container {
// //
if (slot >= inventoryStart && slot <= inventoryEnd) { if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
if (SlotFilter.checkFilter(this, slotId, player)) { if (SlotFilter.checkFilter(this, slotId, player)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} else { } else {
return super.clicked(slotId, dragType, clickTypeIn, player); return super.clicked(slotId, dragType, clickTypeIn, player);
} }

View file

@ -66,33 +66,33 @@ public class ContainerXPSolidifier extends Container {
if (slot >= inventoryStart) { if (slot >= inventoryStart) {
if (newStack.getItem() instanceof ItemSolidifiedExperience) { if (newStack.getItem() instanceof ItemSolidifiedExperience) {
if (!this.moveItemStackTo(newStack, 1, 2, false)) { if (!this.moveItemStackTo(newStack, 1, 2, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryStart && slot <= inventoryEnd) { } else if (slot >= inventoryStart && slot <= inventoryEnd) {
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (!StackUtil.isValid(newStack)) {
theSlot.set(StackUtil.getEmpty()); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
} }
if (newStack.getCount() == currentStack.getCount()) { if (newStack.getCount() == currentStack.getCount()) {
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
theSlot.onTake(player, newStack); theSlot.onTake(player, newStack);
return currentStack; return currentStack;
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -53,7 +53,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned {
player.inventory.setCarried(stackInSlot); player.inventory.setCarried(stackInSlot);
} }
this.set(StackUtil.getEmpty()); this.set(ItemStack.EMPTY);
} else if (StackUtil.isValid(heldStack)) { } else if (StackUtil.isValid(heldStack)) {
if (!isFilter(stackInSlot)) { if (!isFilter(stackInSlot)) {
ItemStack s = heldStack.copy(); ItemStack s = heldStack.copy();

View file

@ -142,7 +142,7 @@ public class DrillItem extends ItemEnergy {
} }
} }
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.util.Lang;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -32,6 +31,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -56,7 +56,7 @@ public class ItemFillingWand extends ItemEnergy {
if (StackUtil.isValid(slot) && slot.sameItem(stack)) { if (StackUtil.isValid(slot) && slot.sameItem(stack)) {
slot.shrink(1); slot.shrink(1);
if (!StackUtil.isValid(slot)) { if (!StackUtil.isValid(slot)) {
player.inventory.setItem(i, StackUtil.getEmpty()); player.inventory.setItem(i, ItemStack.EMPTY);
} }
return true; return true;
@ -227,9 +227,9 @@ public class ItemFillingWand extends ItemEnergy {
IFormattableTextComponent display = loadData(stack) IFormattableTextComponent display = loadData(stack)
.map(state -> state.getBlock().getName()) .map(state -> state.getBlock().getName())
.orElse(Lang.trans("tooltip", "item_filling_wand.selectedBlock.none")); .orElse(new TranslationTextComponent("tooltip.actuallyadditions.item_filling_wand.selected_block.none"));
tooltip.add(Lang.trans("tooltip", "item_filling_wand.selectedBlock", display.getString())); tooltip.add(new TranslationTextComponent("tooltip.actuallyadditions.item_filling_wand.selected_block", display.getString()));
} }
@Override @Override

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -26,8 +25,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem; import net.minecraft.item.SwordItem;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -57,7 +54,7 @@ public class ItemWingsOfTheBats extends ItemBase {
return player.inventory.getItem(i); return player.inventory.getItem(i);
} }
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -16,12 +16,12 @@ import de.ellpeck.actuallyadditions.api.lens.LensConversion;
public final class Lenses { public final class Lenses {
public static void init() { public static void init() {
ActuallyAdditionsAPI.lensDefaultConversion = new LensConversion(); // ActuallyAdditionsAPI.lensDefaultConversion = new LensConversion();
ActuallyAdditionsAPI.lensDetonation = new LensDetonation(); // ActuallyAdditionsAPI.lensDetonation = new LensDetonation();
ActuallyAdditionsAPI.lensDeath = new LensDeath(); // ActuallyAdditionsAPI.lensDeath = new LensDeath();
ActuallyAdditionsAPI.lensEvenMoarDeath = new LensKiller(); // ActuallyAdditionsAPI.lensEvenMoarDeath = new LensKiller();
ActuallyAdditionsAPI.lensColor = new LensColor(); // ActuallyAdditionsAPI.lensColor = new LensColor();
ActuallyAdditionsAPI.lensDisenchanting = new LensDisenchanting(); // ActuallyAdditionsAPI.lensDisenchanting = new LensDisenchanting();
ActuallyAdditionsAPI.lensMining = new LensMining(); // ActuallyAdditionsAPI.lensMining = new LensMining();
} }
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.items.metalists; package de.ellpeck.actuallyadditions.mod.items.metalists;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.Rarity; import net.minecraft.item.Rarity;
@ -47,7 +46,7 @@ public enum TheFoods {
public final boolean getsDrunken; public final boolean getsDrunken;
public final int useDuration; public final int useDuration;
public final Rarity rarity; public final Rarity rarity;
public ItemStack returnItem = StackUtil.getEmpty(); public ItemStack returnItem = ItemStack.EMPTY;
TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, Rarity rarity) { TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, Rarity rarity) {
this.name = name; this.name = name;

View file

@ -83,7 +83,7 @@ public class SpecialRenderInit {
return new ItemStack(block); return new ItemStack(block);
} }
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)

View file

@ -132,9 +132,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
if (item instanceof ILensItem) { if (item instanceof ILensItem) {
return ((ILensItem) item).getLens(); return ((ILensItem) item).getLens();
} }
return this.counter >= 500 return ActuallyAdditionsAPI.lensDefaultConversion;
? ActuallyAdditionsAPI.lensDisruption
: ActuallyAdditionsAPI.lensDefaultConversion;
} }
@Override @Override

View file

@ -22,11 +22,9 @@ import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider { public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider {
@ -92,7 +90,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed
return slot; return slot;
} }
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -24,8 +24,6 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public abstract class TileEntityInventoryBase extends TileEntityBase { public abstract class TileEntityInventoryBase extends TileEntityBase {
public final ItemStackHandlerAA inv; public final ItemStackHandlerAA inv;
@ -59,7 +57,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase {
CompoundNBT tagCompound = tagList.getCompound(i); CompoundNBT tagCompound = tagList.getCompound(i);
slots.setStackInSlot(i, tagCompound.contains("id") slots.setStackInSlot(i, tagCompound.contains("id")
? ItemStack.of(tagCompound) ? ItemStack.of(tagCompound)
: StackUtil.getEmpty()); : ItemStack.EMPTY);
} }
} }
} }

View file

@ -59,7 +59,7 @@ public class TileEntityItemInterface extends TileEntityBase {
if (handler != null && handler.isLoaded()) { if (handler != null && handler.isLoaded()) {
return handler.handler.getStackInSlot(handler.switchedIndex); return handler.handler.getStackInSlot(handler.switchedIndex);
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override
@ -90,7 +90,7 @@ public class TileEntityItemInterface extends TileEntityBase {
return extracted; return extracted;
} }
} }
return StackUtil.getEmpty(); return ItemStack.EMPTY;
} }
@Override @Override

View file

@ -10,9 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem; import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -24,7 +22,6 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -33,9 +30,7 @@ import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.datafix.fixes.FurnaceRecipes;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -73,7 +68,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
ItemStack second = inv.getStackInSlot(slot2); ItemStack second = inv.getStackInSlot(slot2);
if (StackUtil.isValid(first) || StackUtil.isValid(second)) { if (StackUtil.isValid(first) || StackUtil.isValid(second)) {
ItemStack toSplit = StackUtil.getEmpty(); ItemStack toSplit = ItemStack.EMPTY;
if (!StackUtil.isValid(first) && StackUtil.isValid(second) && second.getCount() > 1) { if (!StackUtil.isValid(first) && StackUtil.isValid(second) && second.getCount() > 1) {
toSplit = second; toSplit = second;
} else if (!StackUtil.isValid(second) && StackUtil.isValid(first) && first.getCount() > 1) { } else if (!StackUtil.isValid(second) && StackUtil.isValid(first) && first.getCount() > 1) {

View file

@ -76,7 +76,7 @@ public final class AssetUtil {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderItemInWorld(ItemStack stack, int combinedLight, int combinedOverlay, MatrixStack matrices, IRenderTypeBuffer buffer) { public static void renderItemInWorld(ItemStack stack, int combinedLight, int combinedOverlay, MatrixStack matrices, IRenderTypeBuffer buffer) {
if (StackUtil.isValid(stack)) { if (!stack.isEmpty()) {
Minecraft.getInstance().getItemRenderer().renderStatic( Minecraft.getInstance().getItemRenderer().renderStatic(
stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer
); );

View file

@ -7,15 +7,8 @@ import net.minecraftforge.fml.ForgeI18n;
import java.text.NumberFormat; import java.text.NumberFormat;
@Deprecated
public class Lang { public class Lang {
public static TranslationTextComponent trans(String prefix, String suffix, Object... args) {
return new TranslationTextComponent(String.format("%s.%s.%s", prefix, ActuallyAdditions.MODID, suffix));
}
public static String transI18n(String prefix, String suffix, Object... args) {
return ForgeI18n.parseFormat(String.format("%s.%s.%s", prefix, ActuallyAdditions.MODID, suffix), args);
}
/** /**
* Cleans up any values into either a short variant {1M / 1M} or a long variant * Cleans up any values into either a short variant {1M / 1M} or a long variant
* like {1,000,000 / 1,000,000} * like {1,000,000 / 1,000,000}

View file

@ -36,14 +36,6 @@ public final class StackUtil {
// return !stack.isEmpty(); // return !stack.isEmpty();
} }
/**
* @return The empty itemstack instance.
*/
@Deprecated
public static ItemStack getEmpty() {
return ItemStack.EMPTY;
}
/** /**
* Checks if a collection of stacks are empty, as {@link Collection#isEmpty()} does not care about empty stacks. * Checks if a collection of stacks are empty, as {@link Collection#isEmpty()} does not care about empty stacks.
* *
@ -237,7 +229,7 @@ public final class StackUtil {
* This is used for testing the ability to add all itemstacks, and should not be used for anything else. * This is used for testing the ability to add all itemstacks, and should not be used for anything else.
*/ */
public static ItemStackHandlerAA testDummy(ItemStackHandlerAA inv, int slot, int endSlot) { public static ItemStackHandlerAA testDummy(ItemStackHandlerAA inv, int slot, int endSlot) {
NonNullList<ItemStack> stacks = NonNullList.withSize(endSlot - slot, getEmpty()); NonNullList<ItemStack> stacks = NonNullList.withSize(endSlot - slot, ItemStack.EMPTY);
for (int i = slot; i < endSlot; i++) { for (int i = slot; i < endSlot; i++) {
stacks.set(i - slot, inv.getStackInSlot(i).copy()); stacks.set(i - slot, inv.getStackInSlot(i).copy());
} }

View file

@ -73,7 +73,7 @@ public final class WorldUtil {
} }
public static ItemStack extractItem(SlotlessableItemHandlerWrapper extractWrapper, int maxExtract, boolean simulate, int slotStart, int slotEnd, FilterSettings filter) { public static ItemStack extractItem(SlotlessableItemHandlerWrapper extractWrapper, int maxExtract, boolean simulate, int slotStart, int slotEnd, FilterSettings filter) {
ItemStack extracted = StackUtil.getEmpty(); ItemStack extracted = ItemStack.EMPTY;
if (ActuallyAdditions.commonCapsLoaded) { if (ActuallyAdditions.commonCapsLoaded) {
/* Object handler = extractWrapper.getSlotlessHandler(); /* Object handler = extractWrapper.getSlotlessHandler();

View file

@ -506,8 +506,8 @@
"tooltip.actuallyadditions.previouslyDoubleFurnace": "Previously \"Double Furnace\"", "tooltip.actuallyadditions.previouslyDoubleFurnace": "Previously \"Double Furnace\"",
"tooltip.actuallyadditions.previouslyBag": "Previously \"Bag\"", "tooltip.actuallyadditions.previouslyBag": "Previously \"Bag\"",
"tooltip.actuallyadditions.previouslyVoidBag": "Previously \"Void Bag\"", "tooltip.actuallyadditions.previouslyVoidBag": "Previously \"Void Bag\"",
"tooltip.actuallyadditions.item_filling_wand.selectedBlock": "Selected Block:", "tooltip.actuallyadditions.item_filling_wand.selected_block": "Selected Block:",
"tooltip.actuallyadditions.item_filling_wand.selectedBlock.none": "None", "tooltip.actuallyadditions.item_filling_wand.selected_block.none": "None",
"tooltip.actuallyadditions.coffeeCup.noEffect": "No Effects", "tooltip.actuallyadditions.coffeeCup.noEffect": "No Effects",
"_comment": "Gui Information", "_comment": "Gui Information",
"info.actuallyadditions.gui.animals": "Animals", "info.actuallyadditions.gui.animals": "Animals",