diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 940b54a14..d5ac0c37d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -535,9 +535,10 @@ public class BeltTileEntity extends KineticTileEntity implements ILightUpdateLis @Override public boolean onLightUpdate(IBlockDisplayReader world, LightType type, GridAlignedBB changed) { - if (this.remove) { + if (this.remove) return true; - } + if (this.level == null || this.light == null) + return false; GridAlignedBB beltVolume = getBeltVolume(); diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 9c1b40ea1..e63010098 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -17,6 +17,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.Create; import com.simibubi.create.content.schematics.block.SchematicTableTileEntity; +import com.simibubi.create.content.schematics.item.SchematicAndQuillItem; import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CSchematics; @@ -319,6 +320,7 @@ public class ServerSchematicLoader { try (OutputStream outputStream = Files.newOutputStream(path)) { CompoundNBT nbttagcompound = t.save(new CompoundNBT()); + SchematicAndQuillItem.replaceStructureVoidWithAir(nbttagcompound); CompressedStreamTools.writeCompressed(nbttagcompound, outputStream); player.setItemInHand(Hand.MAIN_HAND, SchematicItem.create(schematic, player.getGameProfile().getName())); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java index 02243a42d..7cf0cda24 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java @@ -15,6 +15,7 @@ import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.Create; import com.simibubi.create.CreateClient; import com.simibubi.create.content.schematics.ClientSchematicLoader; +import com.simibubi.create.content.schematics.item.SchematicAndQuillItem; import com.simibubi.create.content.schematics.packet.InstantSchematicPacket; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.networking.AllPackets; @@ -126,7 +127,7 @@ public class SchematicAndQuillHandler { firstPos = selectedPos; Lang.sendStatus(player, "schematicAndQuill.firstPos"); } - + public void discard() { ClientPlayerEntity player = Minecraft.getInstance().player; firstPos = null; @@ -213,7 +214,8 @@ public class SchematicAndQuillHandler { t.fillFromWorld(Minecraft.getInstance().level, origin, bounds, true, Blocks.AIR); if (string.isEmpty()) - string = Lang.translate("schematicAndQuill.fallbackName").getString(); + string = Lang.translate("schematicAndQuill.fallbackName") + .getString(); String folderPath = "schematics"; FilesHelper.createFolderIfMissing(folderPath); @@ -225,6 +227,7 @@ public class SchematicAndQuillHandler { try { outputStream = Files.newOutputStream(path, StandardOpenOption.CREATE); CompoundNBT nbttagcompound = t.save(new CompoundNBT()); + SchematicAndQuillItem.replaceStructureVoidWithAir(nbttagcompound); CompressedStreamTools.writeCompressed(nbttagcompound, outputStream); } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java b/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java index 30e330076..591208f2d 100644 --- a/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java @@ -1,6 +1,10 @@ package com.simibubi.create.content.schematics.item; +import com.simibubi.create.foundation.utility.NBTHelper; + +import net.minecraft.block.Blocks; import net.minecraft.item.Item; +import net.minecraft.nbt.CompoundNBT; public class SchematicAndQuillItem extends Item { @@ -8,4 +12,18 @@ public class SchematicAndQuillItem extends Item { super(properties); } + public static void replaceStructureVoidWithAir(CompoundNBT nbt) { + String air = Blocks.AIR.getRegistryName() + .toString(); + String structureVoid = Blocks.STRUCTURE_VOID.getRegistryName() + .toString(); + + NBTHelper.iterateCompoundList(nbt.getList("palette", 10), c -> { + if (c.contains("Name") && c.getString("Name") + .equals(structureVoid)) { + c.putString("Name", air); + } + }); + } + }