mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
More cleaning and yeeting.
This commit is contained in:
parent
2538de7a4f
commit
26dfa7cb75
41 changed files with 189 additions and 233 deletions
|
@ -37,6 +37,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -99,11 +100,6 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// public BlockState getBaseConstructorState() {
|
||||
// return this.stateContainer.getBaseState().with(FACING, Direction.NORTH);
|
||||
// }
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
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());
|
||||
if (tile instanceof TileEntityAtomicReconstructor) {
|
||||
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
||||
ITextComponent strg;
|
||||
if (!StackUtil.isValid(slot)) {
|
||||
strg = Lang.trans("info", "nolens");
|
||||
ITextComponent lens_name;
|
||||
if (slot.isEmpty()) {
|
||||
lens_name = new TranslationTextComponent("info.actuallyadditions.nolens");
|
||||
} else {
|
||||
strg = slot.getItem().getName(slot);
|
||||
lens_name = slot.getItem().getName(slot);
|
||||
|
||||
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 {
|
||||
//
|
||||
// private long lastSysTime;
|
||||
|
|
|
@ -54,14 +54,14 @@ public class BlockBatteryBox extends BlockContainerBase {
|
|||
if (StackUtil.isValid(stack)) {
|
||||
if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) {
|
||||
box.inv.setStackInSlot(0, stack.copy());
|
||||
player.setItemInHand(hand, StackUtil.getEmpty());
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
} else {
|
||||
ItemStack inSlot = box.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(inSlot)) {
|
||||
player.setItemInHand(hand, inSlot.copy());
|
||||
box.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
box.inv.setStackInSlot(0, ItemStack.EMPTY);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
|||
ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
|
||||
if (StackUtil.isValid(inRelay)) {
|
||||
if (!world.isClientSide) {
|
||||
relay.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
relay.inv.setStackInSlot(0, ItemStack.EMPTY);
|
||||
|
||||
if (!player.inventory.add(inRelay)) {
|
||||
player.spawnAtLocation(inRelay, 0);
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Util;
|
||||
|
@ -55,7 +56,7 @@ public class RenderBatteryBox extends TileEntityRenderer<TileEntityBatteryBox> {
|
|||
FontRenderer font = Minecraft.getInstance().font;
|
||||
|
||||
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++) {
|
||||
font.draw(matrices, energyTotal, -font.width(energyTotal) / 2F, 10F, 0xFFFFFF);
|
||||
|
|
|
@ -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 (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
if (SlotFilter.checkFilter(this, slotId, player)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
} else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
|
|
|
@ -68,36 +68,36 @@ public class ContainerBioReactor extends Container {
|
|||
//Shift from Inventory
|
||||
if (TileEntityBioReactor.isValidItem(newStack)) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 8, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,30 +71,30 @@ public class ContainerBreaker extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
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.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||
|
@ -68,36 +67,36 @@ public class ContainerCanolaPress extends Container {
|
|||
Optional<PressingRecipe> recipeOptional = TileEntityCanolaPress.getRecipeForInput(newStack);
|
||||
if (recipeOptional.isPresent()) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,36 +65,36 @@ public class ContainerCoalGenerator extends Container {
|
|||
//Shift from Inventory
|
||||
if (ForgeHooks.getBurnTime(newStack) > 0) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ContainerCoffeeMachine extends Container {
|
|||
//Slots in Inventory to shift from
|
||||
if (slot == TileEntityCoffeeMachine.SLOT_OUTPUT) {
|
||||
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onQuickCraft(newStack, currentStack);
|
||||
}
|
||||
|
@ -83,44 +83,44 @@ public class ContainerCoffeeMachine extends Container {
|
|||
//Shift from Inventory
|
||||
if (newStack.getItem() == ActuallyItems.COFFEE_CUP.get()) {
|
||||
if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (ItemCoffee.getIngredientFromStack(newStack) != null) {
|
||||
if (!this.moveItemStackTo(newStack, 3, 11, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (ActuallyTags.Items.COFFEE_BEANS.contains(newStack.getItem())) {
|
||||
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) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,30 +70,30 @@ public class ContainerDirectionalBreaker extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,36 +85,36 @@ public class ContainerDrill extends Container {
|
|||
//Shift from Inventory
|
||||
if (newStack.getItem() instanceof ItemDrillUpgrade) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 5, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -73,30 +73,30 @@ public class ContainerDropper extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ContainerEnergizer extends Container {
|
|||
//Slots in Inventory to shift from
|
||||
if (slot == 1) {
|
||||
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onQuickCraft(newStack, currentStack);
|
||||
}
|
||||
|
@ -112,36 +112,36 @@ public class ContainerEnergizer extends Container {
|
|||
//Shift from Inventory
|
||||
if (newStack.getCapability(CapabilityEnergy.ENERGY, null).isPresent()) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ContainerEnervator extends Container {
|
|||
//Slots in Inventory to shift from
|
||||
if (slot == 1) {
|
||||
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onQuickCraft(newStack, currentStack);
|
||||
}
|
||||
|
@ -100,36 +100,36 @@ public class ContainerEnervator extends Container {
|
|||
//Shift from Inventory
|
||||
if (newStack.getCapability(CapabilityEnergy.ENERGY).isPresent()) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,30 +75,30 @@ public class ContainerFarmer extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,30 +65,30 @@ public class ContainerFeeder extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,29 +60,29 @@ public class ContainerFermentingBarrel extends Container {
|
|||
if (slot >= inventoryStart) {
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,35 +82,35 @@ public class ContainerFilter extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
if (SlotFilter.checkFilter(this, slotId, player)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
} else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ContainerFluidCollector extends Container {
|
|||
//Slots in Inventory to shift from
|
||||
if (slot == 1) {
|
||||
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onQuickCraft(newStack, currentStack);
|
||||
}
|
||||
|
@ -67,29 +67,29 @@ public class ContainerFluidCollector extends Container {
|
|||
else if (slot >= inventoryStart) {
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -72,7 +71,7 @@ public class ContainerFurnaceDouble extends Container {
|
|||
//Slots in Inventory to shift from
|
||||
if (slot == TileEntityPoweredFurnace.SLOT_OUTPUT_1 || slot == TileEntityPoweredFurnace.SLOT_OUTPUT_2) {
|
||||
if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onQuickCraft(newStack, currentStack);
|
||||
}
|
||||
|
@ -81,7 +80,7 @@ public class ContainerFurnaceDouble extends Container {
|
|||
// TODO: VALIDATE
|
||||
IRecipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
|
||||
if (irecipe == null) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack recipeOutput = irecipe.getResultItem();
|
||||
|
@ -90,7 +89,7 @@ public class ContainerFurnaceDouble extends Container {
|
|||
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_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) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -72,35 +72,35 @@ public class ContainerLaserRelayItemWhitelist extends Container {
|
|||
if (slot >= inventoryStart) {
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
if (SlotFilter.checkFilter(this, slotId, player)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
return super.clicked(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
|
|
@ -70,30 +70,30 @@ public class ContainerMiner extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,29 +60,29 @@ public class ContainerOilGenerator extends Container {
|
|||
if (slot >= inventoryStart) {
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,30 +70,30 @@ public class ContainerPhantomPlacer extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,36 +77,36 @@ public class ContainerRangedCollector extends Container {
|
|||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
if (SlotFilter.checkFilter(this, slotId, player)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
return super.clicked(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
|
|
@ -66,33 +66,33 @@ public class ContainerXPSolidifier extends Container {
|
|||
if (slot >= inventoryStart) {
|
||||
if (newStack.getItem() instanceof ItemSolidifiedExperience) {
|
||||
if (!this.moveItemStackTo(newStack, 1, 2, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
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)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
theSlot.set(ItemStack.EMPTY);
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned {
|
|||
player.inventory.setCarried(stackInSlot);
|
||||
}
|
||||
|
||||
this.set(StackUtil.getEmpty());
|
||||
this.set(ItemStack.EMPTY);
|
||||
} else if (StackUtil.isValid(heldStack)) {
|
||||
if (!isFilter(stackInSlot)) {
|
||||
ItemStack s = heldStack.copy();
|
||||
|
|
|
@ -142,7 +142,7 @@ public class DrillItem extends ItemEnergy {
|
|||
}
|
||||
}
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
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.WorldUtil;
|
||||
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.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -56,7 +56,7 @@ public class ItemFillingWand extends ItemEnergy {
|
|||
if (StackUtil.isValid(slot) && slot.sameItem(stack)) {
|
||||
slot.shrink(1);
|
||||
if (!StackUtil.isValid(slot)) {
|
||||
player.inventory.setItem(i, StackUtil.getEmpty());
|
||||
player.inventory.setItem(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -227,9 +227,9 @@ public class ItemFillingWand extends ItemEnergy {
|
|||
|
||||
IFormattableTextComponent display = loadData(stack)
|
||||
.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
|
||||
|
|
|
@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
|||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -26,8 +25,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.util.Direction;
|
||||
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.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -57,7 +54,7 @@ public class ItemWingsOfTheBats extends ItemBase {
|
|||
return player.inventory.getItem(i);
|
||||
}
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Rarity;
|
||||
|
@ -47,7 +46,7 @@ public enum TheFoods {
|
|||
public final boolean getsDrunken;
|
||||
public final int useDuration;
|
||||
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) {
|
||||
this.name = name;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class SpecialRenderInit {
|
|||
return new ItemStack(block);
|
||||
}
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
|
|
|
@ -22,11 +22,9 @@ import net.minecraft.inventory.container.INamedContainerProvider;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider {
|
||||
|
@ -92,7 +90,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed
|
|||
return slot;
|
||||
}
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,6 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public abstract class TileEntityInventoryBase extends TileEntityBase {
|
||||
|
||||
public final ItemStackHandlerAA inv;
|
||||
|
@ -59,7 +57,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase {
|
|||
CompoundNBT tagCompound = tagList.getCompound(i);
|
||||
slots.setStackInSlot(i, tagCompound.contains("id")
|
||||
? ItemStack.of(tagCompound)
|
||||
: StackUtil.getEmpty());
|
||||
: ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TileEntityItemInterface extends TileEntityBase {
|
|||
if (handler != null && handler.isLoaded()) {
|
||||
return handler.handler.getStackInSlot(handler.switchedIndex);
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,7 +90,7 @@ public class TileEntityItemInterface extends TileEntityBase {
|
|||
return extracted;
|
||||
}
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
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.inventory.ContainerFurnaceDouble;
|
||||
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.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -33,9 +30,7 @@ import net.minecraft.item.crafting.IRecipeType;
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.datafix.fixes.FurnaceRecipes;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
@ -73,7 +68,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
|||
ItemStack second = inv.getStackInSlot(slot2);
|
||||
|
||||
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) {
|
||||
toSplit = second;
|
||||
} else if (!StackUtil.isValid(second) && StackUtil.isValid(first) && first.getCount() > 1) {
|
||||
|
|
|
@ -7,15 +7,8 @@ import net.minecraftforge.fml.ForgeI18n;
|
|||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
@Deprecated
|
||||
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
|
||||
* like {1,000,000 / 1,000,000}
|
||||
|
|
|
@ -36,14 +36,6 @@ public final class StackUtil {
|
|||
// 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.
|
||||
*
|
||||
|
@ -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.
|
||||
*/
|
||||
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++) {
|
||||
stacks.set(i - slot, inv.getStackInSlot(i).copy());
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
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) {
|
||||
/* Object handler = extractWrapper.getSlotlessHandler();
|
||||
|
|
|
@ -506,8 +506,8 @@
|
|||
"tooltip.actuallyadditions.previouslyDoubleFurnace": "Previously \"Double Furnace\"",
|
||||
"tooltip.actuallyadditions.previouslyBag": "Previously \"Bag\"",
|
||||
"tooltip.actuallyadditions.previouslyVoidBag": "Previously \"Void Bag\"",
|
||||
"tooltip.actuallyadditions.item_filling_wand.selectedBlock": "Selected Block:",
|
||||
"tooltip.actuallyadditions.item_filling_wand.selectedBlock.none": "None",
|
||||
"tooltip.actuallyadditions.item_filling_wand.selected_block": "Selected Block:",
|
||||
"tooltip.actuallyadditions.item_filling_wand.selected_block.none": "None",
|
||||
"tooltip.actuallyadditions.coffeeCup.noEffect": "No Effects",
|
||||
"_comment": "Gui Information",
|
||||
"info.actuallyadditions.gui.animals": "Animals",
|
||||
|
|
Loading…
Reference in a new issue