Remove the use of SlotItemHandler since we are only faking an inventory-backed slot, (#4654)
we might as well use what we had used pre-2017, which is simply extending a normal Slot. This should also fix #4652.
This commit is contained in:
committed by
Sebastian Hartte
parent
00d4c20d9f
commit
db9ec2b070
@@ -8,19 +8,18 @@ import net.minecraft.inventory.container.Slot;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A proxy for a slot that will always return an itemstack with size 1, if there
|
* A proxy for a slot that will always return an itemstack with size 1, if there
|
||||||
* is an item in the slot. Used to prevent the default item count from
|
* is an item in the slot. Used to prevent the default item count from
|
||||||
* rendering.
|
* rendering.
|
||||||
*/
|
*/
|
||||||
class Size1Slot extends SlotItemHandler {
|
class Size1Slot extends Slot {
|
||||||
|
|
||||||
private final SlotItemHandler delegate;
|
private final Slot delegate;
|
||||||
|
|
||||||
public Size1Slot(SlotItemHandler delegate) {
|
public Size1Slot(Slot delegate) {
|
||||||
super(delegate.getItemHandler(), delegate.getSlotIndex(), delegate.xPos, delegate.yPos);
|
super(delegate.inventory, delegate.getSlotIndex(), delegate.xPos, delegate.yPos);
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,6 @@ import appeng.fluids.util.FluidSorters;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.prioritylist.IPartitionList;
|
import appeng.util.prioritylist.IPartitionList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author BrockWS
|
|
||||||
* @version rv6 - 22/05/2018
|
|
||||||
* @since rv6 22/05/2018
|
|
||||||
*/
|
|
||||||
public class FluidRepo {
|
public class FluidRepo {
|
||||||
private final IItemList<IAEFluidStack> list = Api.instance().storage().getStorageChannel(IFluidStorageChannel.class)
|
private final IItemList<IAEFluidStack> list = Api.instance().storage().getStorageChannel(IFluidStorageChannel.class)
|
||||||
.createList();
|
.createList();
|
||||||
|
|||||||
@@ -21,23 +21,22 @@ package appeng.client.me;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Inventory;
|
||||||
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||||
|
|
||||||
/**
|
public class SlotFluidME extends Slot implements IMEFluidSlot {
|
||||||
* @author BrockWS
|
|
||||||
* @version rv6 - 22/05/2018
|
|
||||||
* @since rv6 22/05/2018
|
|
||||||
*/
|
|
||||||
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
|
||||||
|
|
||||||
private InternalFluidSlotME slot;
|
private static final IInventory EMPTY_INVENTORY = new Inventory(0);
|
||||||
|
|
||||||
|
private final InternalFluidSlotME slot;
|
||||||
|
|
||||||
public SlotFluidME(InternalFluidSlotME slot) {
|
public SlotFluidME(InternalFluidSlotME slot) {
|
||||||
super(null, 0, slot.getxPosition(), slot.getyPosition());
|
super(EMPTY_INVENTORY, 0, slot.getxPosition(), slot.getyPosition());
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(final ItemStack par1ItemStack) {
|
public boolean isItemValid(final ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStack(final ItemStack par1ItemStack) {
|
public void putStack(final ItemStack stack) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +84,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
|
public boolean canTakeStack(final PlayerEntity player) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,23 +19,27 @@
|
|||||||
package appeng.client.me;
|
package appeng.client.me;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Inventory;
|
||||||
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
public class SlotME extends SlotItemHandler {
|
public class SlotME extends Slot {
|
||||||
|
|
||||||
private final InternalSlotME mySlot;
|
private static final IInventory EMPTY_INVENTORY = new Inventory(0);
|
||||||
|
|
||||||
public SlotME(final InternalSlotME me) {
|
private final InternalSlotME slot;
|
||||||
super(null, 0, me.getxPosition(), me.getyPosition());
|
|
||||||
this.mySlot = me;
|
public SlotME(final InternalSlotME slot) {
|
||||||
|
super(EMPTY_INVENTORY, 0, slot.getxPosition(), slot.getyPosition());
|
||||||
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAEItemStack getAEStack() {
|
public IAEItemStack getAEStack() {
|
||||||
if (this.mySlot.hasPower()) {
|
if (this.slot.hasPower()) {
|
||||||
return this.mySlot.getAEStack();
|
return this.slot.getAEStack();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -47,15 +51,15 @@ public class SlotME extends SlotItemHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
if (this.mySlot.hasPower()) {
|
if (this.slot.hasPower()) {
|
||||||
return this.mySlot.getStack();
|
return this.slot.getStack();
|
||||||
}
|
}
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasStack() {
|
public boolean getHasStack() {
|
||||||
if (this.mySlot.hasPower()) {
|
if (this.slot.hasPower()) {
|
||||||
return !this.getStack().isEmpty();
|
return !this.getStack().isEmpty();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user