Fix max entity radius not being settable by making it a instance method on world. Closes #5601

Fix VoidFluidHandler.INSTANCE not being a instance of VoidFluidHandler. Closes #5602
Remove backwards compat code and make IItemHandler.isItemValid non-default. Closes #5598
This commit is contained in:
LexManos committed 2019-03-11 15:04:04 -07:00
1 parent 7292b63052
commit 7113f4400c
7 files changed
+41 -41

No files matched your search

@@ -117,6 +117,5 @@ public interface IItemHandler
* @return true if the slot can insert the ItemStack, not considering the current state of the inventory.
* false if the slot can never insert the ItemStack in any situation.
*/
//todo Make non-default and/or replace in 1.13
default boolean isItemValid(int slot, @Nonnull ItemStack stack) { return true; }
boolean isItemValid(int slot, @Nonnull ItemStack stack);
}
@@ -44,27 +44,9 @@ public class SlotItemHandler extends Slot
@Override
public boolean isItemValid(@Nonnull ItemStack stack)
{
if (stack.isEmpty() || !itemHandler.isItemValid(index, stack))
if (stack.isEmpty())
return false;
IItemHandler handler = this.getItemHandler();
ItemStack remainder;
if (handler instanceof IItemHandlerModifiable)
{
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
remainder = handlerModifiable.insertItem(index, stack, true);
handlerModifiable.setStackInSlot(index, currentStack);
}
else
{
remainder = handler.insertItem(index, stack, true);
}
return remainder.getCount() < stack.getCount();
return itemHandler.isItemValid(index, stack);
}
@Override
@@ -183,7 +183,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
@Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack)
{
return IItemHandlerModifiable.super.isItemValid(slot, stack);
return true;
}
protected EntityEquipmentSlot validateSlotIndex(final int slot)