Disabled putting storage units into other storage units.

The overflow can still be triggered in other ways, but players must be very deliberate for that...

Co-authored-by: ayutac <fly.high.android@gmail.com>
This commit is contained in:
Ayutac 2022-11-20 17:31:31 +01:00 committed by GitHub
parent 7be590d01d
commit 10468e762e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -73,6 +73,9 @@ class TRItemTagProvider extends ItemTagProvider {
getOrCreateTagBuilder(plate.asTag()).add(plate.asItem())
getOrCreateTagBuilder(TRContent.ItemTags.PLATES).add(plate.asItem())
}
TRContent.StorageUnit.values().each {unit ->
getOrCreateTagBuilder(TRContent.ItemTags.STORAGE_UNITS).add(unit.asItem())
}
getOrCreateTagBuilder(TRContent.ItemTags.RUBBER_LOGS)
.add(TRContent.RUBBER_LOG.asItem())

View file

@ -382,13 +382,18 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (slot != INPUT_SLOT) {
return false;
}
if (inputStack == ItemStack.EMPTY){
if (inputStack == ItemStack.EMPTY) {
return false;
}
// Do not allow player heads into storage due to lag. Fix #2888
if (inputStack.getItem() instanceof SkullItem){
if (inputStack.getItem() instanceof SkullItem) {
return false;
}
// do not allow other storage units to avoid NBT overflow. Fix #2580
if (inputStack.isIn(TRContent.ItemTags.STORAGE_UNITS)) {
return false;
}
if (isLocked()) {
return ItemUtils.isItemEqual(lockedItemStack, inputStack, true, true);
}

View file

@ -286,6 +286,7 @@ public class TRContent {
public static final TagKey<Item> GEMS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "gems"));
public static final TagKey<Item> NUGGETS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "nuggets"));
public static final TagKey<Item> PLATES = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "plates"));
public static final TagKey<Item> STORAGE_UNITS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "storage_units"));
private ItemTags() {
}