mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-13 07:47:21 +01:00
Merge branch 'mc1.18/dev' into mc1.19/dev
This commit is contained in:
commit
5223cbe4fc
19 changed files with 150 additions and 158 deletions
|
@ -5,7 +5,7 @@
|
|||
<a href="https://github.com/Creators-of-Create/Create/blob/master/LICENSE"><img src="https://img.shields.io/github/license/Creators-of-Create/Create?style=flat&color=900c3f" alt="License"></a>
|
||||
<a href="https://discord.gg/hmaD7Se"><img src="https://img.shields.io/discord/620934202875183104?color=5865f2&label=Discord&style=flat" alt="Discord"></a>
|
||||
<a href="https://www.curseforge.com/minecraft/mc-mods/create"><img src="http://cf.way2muchnoise.eu/328085.svg" alt="CF"></a>
|
||||
<a href="https://modrinth.com/mod/create"><img src="https://img.shields.io/badge/dynamic/json?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+Cjxzdmcgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDUxMiA1MTQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM6c2VyaWY9Imh0dHA6Ly93d3cuc2VyaWYuY29tLyIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoyOyI+CiAgICA8Zz4KICAgICAgICA8ZyBpZD0ibW9k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vbnplcm87Ii8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K&label=&suffix=%20&query=downloads&url=https://api.modrinth.com/api/v1/mod/LNytGWDc&style=flat&color=242629&labelColor=5ca424" alt="Modrinth"></a>
|
||||
<a href="https://modrinth.com/mod/create"><img src="https://img.shields.io/modrinth/dt/create?logo=modrinth&label=&suffix=%20&style=flat&color=242629&labelColor=5ca424&logoColor=1c1c1c" alt="Modrinth"></a>
|
||||
<br><br>
|
||||
</h1>
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ 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.19.2
|
||||
|
||||
minecraft_version = 1.19.2
|
||||
forge_version = 43.1.52
|
||||
forge_version = 43.2.4
|
||||
|
||||
# build dependency versions
|
||||
forgegradle_version = 5.1.53
|
||||
|
|
|
@ -1121,6 +1121,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",
|
||||
|
@ -1214,6 +1215,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.",
|
||||
|
@ -1750,6 +1753,9 @@
|
|||
"create.contraption.minecart_contraption_too_big": "This Cart Contraption seems too big to pick up",
|
||||
"create.contraption.minecart_contraption_illegal_pickup": "A mystical force is binding this Cart Contraption to the world",
|
||||
|
||||
"enchantment.create.capacity.desc": "Increases Backtank air capacity.",
|
||||
"enchantment.create.potato_recovery.desc": "Potato Cannon projectiles have a chance to be reused.",
|
||||
|
||||
|
||||
"_": "->------------------------] Subtitles [------------------------<-",
|
||||
|
||||
|
|
|
@ -65,7 +65,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();
|
||||
|
||||
|
|
|
@ -168,6 +168,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();
|
||||
}
|
||||
|
|
|
@ -54,22 +54,26 @@ public class TrackGraphSync {
|
|||
public void nodeAdded(TrackGraph graph, TrackNode node) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.addedNodes.put(node.getNetId(), Pair.of(node.getLocation(), node.getNormal()));
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void edgeAdded(TrackGraph graph, TrackNode node1, TrackNode node2, TrackEdge edge) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.addedEdges
|
||||
.add(Pair.of(Couple.create(node1.getNetId(), node2.getNetId()), edge.getTurn()));
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void pointAdded(TrackGraph graph, TrackEdgePoint point) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.addedEdgePoints.add(point);
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void pointRemoved(TrackGraph graph, TrackEdgePoint point) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.removedEdgePoints.add(point.getId());
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void nodeRemoved(TrackGraph graph, TrackNode node) {
|
||||
|
@ -120,12 +124,14 @@ public class TrackGraphSync {
|
|||
public void edgeDataChanged(TrackGraph graph, TrackNode node1, TrackNode node2, TrackEdge edge) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.syncEdgeData(node1, node2, edge);
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void edgeDataChanged(TrackGraph graph, TrackNode node1, TrackNode node2, TrackEdge edge, TrackEdge edge2) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.syncEdgeData(node1, node2, edge);
|
||||
currentGraphSyncPacket.syncEdgeData(node2, node1, edge2);
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
public void sendFullGraphTo(TrackGraph graph, ServerPlayer player) {
|
||||
|
@ -190,6 +196,7 @@ public class TrackGraphSync {
|
|||
//
|
||||
|
||||
private TrackGraphSyncPacket currentGraphSyncPacket;
|
||||
private int currentPayload;
|
||||
|
||||
private void flushGraphPacket() {
|
||||
flushGraphPacket(null, 0);
|
||||
|
@ -201,14 +208,17 @@ public class TrackGraphSync {
|
|||
|
||||
private void flushGraphPacket(@Nullable UUID graphId, int netId) {
|
||||
if (currentGraphSyncPacket != null) {
|
||||
if (currentGraphSyncPacket.graphId.equals(graphId))
|
||||
if (currentGraphSyncPacket.graphId.equals(graphId) && currentPayload < 1000)
|
||||
return;
|
||||
queuedPackets.add(currentGraphSyncPacket);
|
||||
currentGraphSyncPacket = null;
|
||||
currentPayload = 0;
|
||||
}
|
||||
|
||||
if (graphId != null)
|
||||
if (graphId != null) {
|
||||
currentGraphSyncPacket = new TrackGraphSyncPacket(graphId, netId);
|
||||
currentPayload = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.function.Function;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableDouble;
|
||||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
|
@ -129,7 +131,7 @@ public class Carriage {
|
|||
boolean onTwoBogeys = isOnTwoBogeys();
|
||||
double stress = train.derailed ? 0 : onTwoBogeys ? bogeySpacing - getAnchorDiff() : 0;
|
||||
blocked = false;
|
||||
|
||||
|
||||
MutableDouble distanceMoved = new MutableDouble(distance);
|
||||
boolean iterateFromBack = distance < 0;
|
||||
|
||||
|
@ -141,7 +143,7 @@ public class Carriage {
|
|||
CarriageBogey bogey = bogeys.get(actuallyFirstBogey);
|
||||
double bogeyCorrection = stress * (actuallyFirstBogey ? 0.5d : -0.5d);
|
||||
double bogeyStress = bogey.getStress();
|
||||
|
||||
|
||||
for (boolean firstWheel : Iterate.trueAndFalse) {
|
||||
boolean actuallyFirstWheel = firstWheel ^ iterateFromBack;
|
||||
TravellingPoint point = bogey.points.get(actuallyFirstWheel);
|
||||
|
@ -249,8 +251,11 @@ public class Carriage {
|
|||
|
||||
boolean discard =
|
||||
!currentlyTraversedDimensions.isEmpty() && !currentlyTraversedDimensions.contains(entry.getKey());
|
||||
ServerLevel currentLevel = level.getServer()
|
||||
.getLevel(entry.getKey());
|
||||
|
||||
MinecraftServer server = level.getServer();
|
||||
if (server == null)
|
||||
continue;
|
||||
ServerLevel currentLevel = server.getLevel(entry.getKey());
|
||||
if (currentLevel == null)
|
||||
continue;
|
||||
|
||||
|
@ -848,7 +853,7 @@ public class Carriage {
|
|||
train.carriageWaitingForChunks = id;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (entity.getPassengers()
|
||||
.stream()
|
||||
.anyMatch(p -> p instanceof Player)
|
||||
|
|
|
@ -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;
|
||||
|
@ -125,9 +137,13 @@ public class SchematicPrinter {
|
|||
public boolean isLoaded() {
|
||||
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) {
|
||||
|
|
|
@ -303,8 +303,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
protected void tickPrinter() {
|
||||
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;
|
||||
schematic.placeInWorld(w, pos, pos, placementSettings, w.getRandom(), Block.UPDATE_CLIENTS);
|
||||
|
||||
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();
|
||||
|
|
|
@ -48,6 +48,7 @@ import net.minecraftforge.event.level.ChunkEvent;
|
|||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
|
@ -85,9 +86,11 @@ public class CommonEvents {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldTick(LevelTickEvent event) {
|
||||
public static void onServerWorldTick(LevelTickEvent event) {
|
||||
if (event.phase == Phase.START)
|
||||
return;
|
||||
if (event.side == LogicalSide.CLIENT)
|
||||
return;
|
||||
Level world = event.level;
|
||||
ContraptionHandler.tick(world);
|
||||
CapabilityMinecartController.tick(world);
|
||||
|
|
|
@ -3,35 +3,26 @@ package com.simibubi.create.foundation.data;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.hash.HashingOutputStream;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||
import com.simibubi.create.foundation.utility.FilesHelper;
|
||||
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
|
@ -51,10 +42,6 @@ public class LangMerger implements DataProvider {
|
|||
private final LangPartial[] langPartials;
|
||||
|
||||
private List<Object> mergedLangData;
|
||||
private Map<String, List<Object>> populatedLangData;
|
||||
private Map<String, Map<String, String>> allLocalizedEntries;
|
||||
private Map<String, MutableInt> missingTranslationTally;
|
||||
|
||||
private List<String> langIgnore;
|
||||
|
||||
public <T extends LangPartial> LangMerger(DataGenerator gen, String modid, String displayName, T[] langPartials) {
|
||||
|
@ -64,9 +51,6 @@ public class LangMerger implements DataProvider {
|
|||
this.langPartials = langPartials;
|
||||
this.mergedLangData = new ArrayList<>();
|
||||
this.langIgnore = new ArrayList<>();
|
||||
this.allLocalizedEntries = new HashMap<>();
|
||||
this.populatedLangData = new HashMap<>();
|
||||
this.missingTranslationTally = new HashMap<>();
|
||||
populateLangIgnore();
|
||||
}
|
||||
|
||||
|
@ -93,42 +77,11 @@ public class LangMerger implements DataProvider {
|
|||
Path path = this.gen.getOutputFolder()
|
||||
.resolve("assets/" + modid + "/lang/" + "en_us.json");
|
||||
|
||||
for (Pair<String, JsonElement> pair : getAllLocalizationFiles()) {
|
||||
if (!pair.getRight()
|
||||
.isJsonObject())
|
||||
continue;
|
||||
Map<String, String> localizedEntries = new HashMap<>();
|
||||
JsonObject jsonobject = pair.getRight()
|
||||
.getAsJsonObject();
|
||||
jsonobject.entrySet()
|
||||
.stream()
|
||||
.forEachOrdered(entry -> {
|
||||
String key = entry.getKey();
|
||||
if (key.startsWith("_"))
|
||||
return;
|
||||
String value = entry.getValue()
|
||||
.getAsString();
|
||||
localizedEntries.put(key, value);
|
||||
});
|
||||
String key = pair.getKey();
|
||||
allLocalizedEntries.put(key, localizedEntries);
|
||||
populatedLangData.put(key, new ArrayList<>());
|
||||
missingTranslationTally.put(key, new MutableInt(0));
|
||||
}
|
||||
|
||||
collectExistingEntries(path);
|
||||
collectEntries();
|
||||
if (mergedLangData.isEmpty())
|
||||
return;
|
||||
|
||||
save(cache, mergedLangData, -1, path, "Merging en_us.json with hand-written lang entries...");
|
||||
for (Entry<String, List<Object>> localization : populatedLangData.entrySet()) {
|
||||
String key = localization.getKey();
|
||||
Path populatedLangPath = this.gen.getOutputFolder()
|
||||
.resolve("assets/" + modid + "/lang/unfinished/" + key);
|
||||
save(cache, localization.getValue(), missingTranslationTally.get(key)
|
||||
.intValue(), populatedLangPath, "Populating " + key + " with missing entries...");
|
||||
}
|
||||
save(cache, mergedLangData, path, "Merging en_us.json with hand-written lang entries...");
|
||||
}
|
||||
|
||||
private void collectExistingEntries(Path path) throws IOException {
|
||||
|
@ -195,19 +148,10 @@ public class LangMerger implements DataProvider {
|
|||
|
||||
private void writeData(String data) {
|
||||
mergedLangData.add(data);
|
||||
populatedLangData.values()
|
||||
.forEach(l -> l.add(data));
|
||||
}
|
||||
|
||||
private void writeEntry(String key, String value) {
|
||||
mergedLangData.add(new LangEntry(key, value));
|
||||
populatedLangData.forEach((k, l) -> {
|
||||
ForeignLangEntry entry = new ForeignLangEntry(key, value, allLocalizedEntries.get(k));
|
||||
if (entry.isMissing())
|
||||
missingTranslationTally.get(k)
|
||||
.increment();
|
||||
l.add(entry);
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean shouldAddLineBreak(String key, String previousKey) {
|
||||
|
@ -229,29 +173,6 @@ public class LangMerger implements DataProvider {
|
|||
return !split[0].equals(split2[0]);
|
||||
}
|
||||
|
||||
private List<Pair<String, JsonElement>> getAllLocalizationFiles() {
|
||||
ArrayList<Pair<String, JsonElement>> list = new ArrayList<>();
|
||||
|
||||
String filepath = "assets/" + modid + "/lang/";
|
||||
try (InputStream resourceStream = ClassLoader.getSystemResourceAsStream(filepath)) {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(resourceStream));
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null)
|
||||
break;
|
||||
if (!readLine.endsWith(".json"))
|
||||
continue;
|
||||
if (readLine.startsWith("en_us") || readLine.startsWith("en_ud"))
|
||||
continue;
|
||||
list.add(Pair.of(readLine, FilesHelper.loadJsonResource(filepath + readLine)));
|
||||
}
|
||||
} catch (IOException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private void collectEntries() {
|
||||
for (LangPartial partial : langPartials)
|
||||
addAll(partial.getDisplayName(), partial.provide()
|
||||
|
@ -259,25 +180,22 @@ public class LangMerger implements DataProvider {
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void save(CachedOutput cache, List<Object> dataIn, int missingKeys, Path target, String message)
|
||||
private void save(CachedOutput cache, List<Object> dataIn, Path target, String message)
|
||||
throws IOException {
|
||||
Create.LOGGER.info(message);
|
||||
|
||||
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
||||
HashingOutputStream hashingoutputstream = new HashingOutputStream(Hashing.sha1(), bytearrayoutputstream);
|
||||
|
||||
Writer writer = new OutputStreamWriter(hashingoutputstream, StandardCharsets.UTF_8);
|
||||
writer.append(createString(dataIn, missingKeys));
|
||||
writer.append(createString(dataIn));
|
||||
writer.close();
|
||||
|
||||
cache.writeIfNeeded(target, bytearrayoutputstream.toByteArray(), hashingoutputstream.hash());
|
||||
}
|
||||
|
||||
protected String createString(List<Object> data, int missingKeys) {
|
||||
protected String createString(List<Object> data) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("{\n");
|
||||
if (missingKeys != -1)
|
||||
builder.append("\t\"_\": \"Missing Localizations: " + missingKeys + "\",\n");
|
||||
data.forEach(builder::append);
|
||||
builder.append("\t\"_\": \"Thank you for translating ").append(displayName).append("!\"\n\n");
|
||||
builder.append("}");
|
||||
|
@ -302,19 +220,4 @@ public class LangMerger implements DataProvider {
|
|||
|
||||
}
|
||||
|
||||
private class ForeignLangEntry extends LangEntry {
|
||||
|
||||
private boolean missing;
|
||||
|
||||
ForeignLangEntry(String key, String value, Map<String, String> localizationMap) {
|
||||
super(key, localizationMap.getOrDefault(key, "UNLOCALIZED: " + value));
|
||||
missing = !localizationMap.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean isMissing() {
|
||||
return missing;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.",
|
||||
|
@ -916,6 +919,9 @@
|
|||
"create.command.killTPSCommand.argument.tickTime": "tickTime",
|
||||
|
||||
"create.contraption.minecart_contraption_too_big": "This Cart Contraption seems too big to pick up",
|
||||
"create.contraption.minecart_contraption_illegal_pickup": "A mystical force is binding this Cart Contraption to the world"
|
||||
"create.contraption.minecart_contraption_illegal_pickup": "A mystical force is binding this Cart Contraption to the world",
|
||||
|
||||
"enchantment.create.capacity.desc": "Increases Backtank air capacity.",
|
||||
"enchantment.create.potato_recovery.desc": "Potato Cannon projectiles have a chance to be reused."
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "forge:mod_loaded",
|
||||
"modid": "appliedenergistics2"
|
||||
}
|
||||
],
|
||||
"type": "create:crushing",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "appliedenergistics2:charged_quartz_ore"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "appliedenergistics2:charged_certus_quartz_crystal",
|
||||
"count": 2
|
||||
},
|
||||
{
|
||||
"item": "appliedenergistics2:certus_quartz_dust",
|
||||
"count": 1,
|
||||
"chance": 0.25
|
||||
},
|
||||
{
|
||||
"item": "minecraft:cobblestone",
|
||||
"count": 1,
|
||||
"chance": 0.125
|
||||
}
|
||||
],
|
||||
"processingTime": 300
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "forge:mod_loaded",
|
||||
"modid": "ae2"
|
||||
}
|
||||
],
|
||||
"type": "create:crushing",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "ae2:deepslate_quartz_ore"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "ae2:certus_quartz_crystal",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"item": "ae2:certus_quartz_dust",
|
||||
"count": 4
|
||||
},
|
||||
{
|
||||
"item": "ae2:certus_quartz_dust",
|
||||
"count": 1,
|
||||
"chance": 0.5
|
||||
},
|
||||
{
|
||||
"item": "minecraft:cobbled_deepslate",
|
||||
"count": 1,
|
||||
"chance": 0.125
|
||||
}
|
||||
],
|
||||
"processingTime": 300
|
||||
}
|
|
@ -2,24 +2,28 @@
|
|||
"conditions": [
|
||||
{
|
||||
"type": "forge:mod_loaded",
|
||||
"modid": "appliedenergistics2"
|
||||
"modid": "ae2"
|
||||
}
|
||||
],
|
||||
"type": "create:crushing",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "appliedenergistics2:quartz_ore"
|
||||
"item": "ae2:quartz_ore"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "appliedenergistics2:certus_quartz_crystal",
|
||||
"count": 2
|
||||
"item": "ae2:certus_quartz_crystal",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"item": "appliedenergistics2:certus_quartz_dust",
|
||||
"item": "ae2:certus_quartz_dust",
|
||||
"count": 4
|
||||
},
|
||||
{
|
||||
"item": "ae2:certus_quartz_dust",
|
||||
"count": 1,
|
||||
"chance": 0.25
|
||||
"chance": 0.5
|
||||
},
|
||||
{
|
||||
"item": "minecraft:cobblestone",
|
Loading…
Reference in a new issue