mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Repeat offender
- Crashes that occur during schematic loading no longer terminate the server - Fixed crash when creating new belts at existing chutes/funnels - Fixed ghost items appearing on non-powered belts when extracted from
This commit is contained in:
parent
6606a07d44
commit
9ab3b77294
12 changed files with 67 additions and 10 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
|
|||
org.gradle.daemon = false
|
||||
|
||||
# mod version info
|
||||
mod_version = 0.5.0.h
|
||||
mod_version = 0.5.0.i
|
||||
artifact_minecraft_version = 1.18.2
|
||||
|
||||
minecraft_version = 1.18.2
|
||||
|
|
|
@ -559,7 +559,7 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
|
|||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
f85edc574ee6de0de7693ffb031266643db6724a assets/create/lang/en_ud.json
|
||||
c219c77242e645f32704201dd80e279b3759b794 assets/create/lang/en_us.json
|
||||
7e9712249a13bd4760d58e041473487ada1326ba assets/create/lang/en_us.json
|
||||
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
|
||||
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
|
||||
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
|
|
@ -1119,6 +1119,7 @@
|
|||
"create.schematicAndQuill.saved": "Saved as %1$s",
|
||||
|
||||
"create.schematic.invalid": "[!] Invalid Item - Use the Schematic Table instead",
|
||||
"create.schematic.error": "Schematic failed to Load - Check Game Logs",
|
||||
"create.schematic.position": "Position",
|
||||
"create.schematic.rotation": "Rotation",
|
||||
"create.schematic.rotation.none": "None",
|
||||
|
@ -1212,6 +1213,8 @@
|
|||
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
||||
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
|
||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||
"create.schematicannon.status.schematicErrored": "Incompatible Blocks",
|
||||
"create.schematicannon.status.schematicErroredCheckLogs": "Check Server Logs",
|
||||
|
||||
"create.materialChecklist": "Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "* Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
|
|
@ -67,7 +67,7 @@ public class Create {
|
|||
|
||||
public static final String ID = "create";
|
||||
public static final String NAME = "Create";
|
||||
public static final String VERSION = "0.5h";
|
||||
public static final String VERSION = "0.5i";
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
|
|
|
@ -169,6 +169,8 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
protected void initializeItemHandler() {
|
||||
if (level.isClientSide || itemHandler.isPresent())
|
||||
return;
|
||||
if (beltLength == 0 || controller == null)
|
||||
return;
|
||||
if (!level.isLoaded(controller))
|
||||
return;
|
||||
BlockEntity te = level.getBlockEntity(controller);
|
||||
|
|
|
@ -52,6 +52,8 @@ public class ItemHandlerBeltSegment implements IItemHandler {
|
|||
amount = Math.min(amount, transported.stack.getCount());
|
||||
ItemStack extracted = simulate ? transported.stack.copy().split(amount) : transported.stack.split(amount);
|
||||
if (!simulate) {
|
||||
if (transported.stack.isEmpty())
|
||||
this.beltInventory.toRemove.add(transported);
|
||||
this.beltInventory.belt.setChanged();
|
||||
this.beltInventory.belt.sendData();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform;
|
||||
import com.simibubi.create.content.schematics.item.SchematicItem;
|
||||
|
@ -37,6 +38,7 @@ public class SchematicPrinter {
|
|||
}
|
||||
|
||||
private boolean schematicLoaded;
|
||||
private boolean isErrored;
|
||||
private SchematicWorld blockReader;
|
||||
private BlockPos schematicAnchor;
|
||||
|
||||
|
@ -93,7 +95,16 @@ public class SchematicPrinter {
|
|||
schematicAnchor = NbtUtils.readBlockPos(blueprint.getTag()
|
||||
.getCompound("Anchor"));
|
||||
blockReader = new SchematicWorld(schematicAnchor, originalWorld);
|
||||
activeTemplate.placeInWorld(blockReader, schematicAnchor, schematicAnchor, settings, blockReader.getRandom(), Block.UPDATE_CLIENTS);
|
||||
|
||||
try {
|
||||
activeTemplate.placeInWorld(blockReader, schematicAnchor, schematicAnchor, settings,
|
||||
blockReader.getRandom(), Block.UPDATE_CLIENTS);
|
||||
} catch (Exception e) {
|
||||
Create.LOGGER.error("Failed to load Schematic for Printing", e);
|
||||
schematicLoaded = true;
|
||||
isErrored = true;
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos extraBounds = StructureTemplate.calculateRelativePosition(settings, new BlockPos(activeTemplate.getSize())
|
||||
.offset(-1, -1, -1));
|
||||
|
@ -115,6 +126,7 @@ public class SchematicPrinter {
|
|||
public void resetSchematic() {
|
||||
schematicLoaded = false;
|
||||
schematicAnchor = null;
|
||||
isErrored = false;
|
||||
currentPos = null;
|
||||
blockReader = null;
|
||||
printingEntityIndex = -1;
|
||||
|
@ -126,8 +138,12 @@ public class SchematicPrinter {
|
|||
return schematicLoaded;
|
||||
}
|
||||
|
||||
public boolean isErrored() {
|
||||
return isErrored;
|
||||
}
|
||||
|
||||
public BlockPos getCurrentTarget() {
|
||||
if (!isLoaded())
|
||||
if (!isLoaded() || isErrored())
|
||||
return null;
|
||||
return schematicAnchor.offset(currentPos);
|
||||
}
|
||||
|
|
|
@ -310,6 +310,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
font.drawShadow(ms, msg, x + 103 - stringWidth / 2, y + 53, 0xCCDDFF);
|
||||
|
||||
if ("schematicErrored".equals(te.statusMsg))
|
||||
font.drawShadow(ms, Lang.translateDirect("schematicannon.status.schematicErroredCheckLogs"),
|
||||
x + 103 - stringWidth / 2, y + 65, 0xCCDDFF);
|
||||
}
|
||||
|
||||
protected void renderBlueprintHighlight(PoseStack matrixStack, int x, int y) {
|
||||
|
|
|
@ -304,7 +304,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
ItemStack blueprint = inventory.getStackInSlot(0);
|
||||
blockSkipped = false;
|
||||
|
||||
if (blueprint.isEmpty() && !statusMsg.equals("idle")) {
|
||||
if (blueprint.isEmpty() && !statusMsg.equals("idle") && inventory.getStackInSlot(1)
|
||||
.isEmpty()) {
|
||||
state = State.STOPPED;
|
||||
statusMsg = "idle";
|
||||
sendUpdate = true;
|
||||
|
@ -448,12 +449,23 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
// Load blocks into reader
|
||||
printer.loadSchematic(blueprint, level, true);
|
||||
|
||||
if (printer.isErrored()) {
|
||||
state = State.STOPPED;
|
||||
statusMsg = "schematicErrored";
|
||||
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_SCHEMATIC.get()));
|
||||
printer.resetSchematic();
|
||||
sendUpdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (printer.isWorldEmpty()) {
|
||||
state = State.STOPPED;
|
||||
statusMsg = "schematicExpired";
|
||||
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_SCHEMATIC.get()));
|
||||
printer.resetSchematic();
|
||||
sendUpdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -462,6 +474,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
state = State.STOPPED;
|
||||
statusMsg = "targetOutsideRange";
|
||||
printer.resetSchematic();
|
||||
sendUpdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -663,6 +676,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
boolean outputFull = inventory.getStackInSlot(BookOutput)
|
||||
.getCount() == inventory.getSlotLimit(BookOutput);
|
||||
|
||||
if (printer.isErrored())
|
||||
return;
|
||||
|
||||
if (!printer.isLoaded()) {
|
||||
if (!blueprint.isEmpty())
|
||||
initializePrinter(blueprint);
|
||||
|
@ -796,11 +812,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
checklist.damageRequired.clear();
|
||||
checklist.blocksNotLoaded = false;
|
||||
|
||||
if (printer.isLoaded()) {
|
||||
if (printer.isLoaded() && !printer.isErrored()) {
|
||||
blocksToPlace = blocksPlaced;
|
||||
blocksToPlace += printer.markAllBlockRequirements(checklist, level, this::shouldPlace);
|
||||
printer.markAllEntityRequirements(checklist);
|
||||
}
|
||||
|
||||
checklist.gathered.clear();
|
||||
findInventories();
|
||||
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform;
|
||||
import com.simibubi.create.content.schematics.SchematicWorld;
|
||||
import com.simibubi.create.content.schematics.client.tools.Tools;
|
||||
|
@ -18,6 +19,7 @@ import com.simibubi.create.content.schematics.packet.SchematicSyncPacket;
|
|||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||
|
||||
|
@ -157,7 +159,15 @@ public class SchematicHandler {
|
|||
BlockPos pos;
|
||||
|
||||
pos = BlockPos.ZERO;
|
||||
|
||||
try {
|
||||
schematic.placeInWorld(w, pos, pos, placementSettings, w.getRandom(), Block.UPDATE_CLIENTS);
|
||||
} catch (Exception e) {
|
||||
Minecraft.getInstance().player.displayClientMessage(Lang.translate("schematic.error")
|
||||
.component(), false);
|
||||
Create.LOGGER.error("Failed to load Schematic for Previewing", e);
|
||||
return;
|
||||
}
|
||||
|
||||
placementSettings.setMirror(Mirror.FRONT_BACK);
|
||||
pos = BlockPos.ZERO.east(size.getX() - 1);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SchematicPlacePacket extends SimplePacketBase {
|
|||
Level world = player.getLevel();
|
||||
SchematicPrinter printer = new SchematicPrinter();
|
||||
printer.loadSchematic(stack, world, !player.canUseGameMasterBlocks());
|
||||
if (!printer.isLoaded())
|
||||
if (!printer.isLoaded() || printer.isErrored())
|
||||
return;
|
||||
|
||||
boolean includeAir = AllConfigs.SERVER.schematics.creativePrintIncludesAir.get();
|
||||
|
|
|
@ -271,6 +271,7 @@
|
|||
"create.schematicAndQuill.saved": "Saved as %1$s",
|
||||
|
||||
"create.schematic.invalid": "[!] Invalid Item - Use the Schematic Table instead",
|
||||
"create.schematic.error": "Schematic failed to Load - Check Game Logs",
|
||||
"create.schematic.position": "Position",
|
||||
"create.schematic.rotation": "Rotation",
|
||||
"create.schematic.rotation.none": "None",
|
||||
|
@ -369,6 +370,8 @@
|
|||
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
||||
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
|
||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||
"create.schematicannon.status.schematicErrored": "Incompatible Blocks",
|
||||
"create.schematicannon.status.schematicErroredCheckLogs": "Check Server Logs",
|
||||
|
||||
"create.materialChecklist": "Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "* Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
|
Loading…
Reference in a new issue