Skip to content

Commit

Permalink
Make browsing the files a bit faster by disabling the Data Fixers.
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 11, 2024
1 parent 116027b commit e316cce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2517,20 +2517,34 @@ public static Pair<SchematicSchema, SchematicMetadata> readMetadataAndVersionFro
case SPONGE_SCHEMATIC ->
{
LitematicaSchematic schem = new LitematicaSchematic(file, type);
DataFixerMode dataFixer = (DataFixerMode) Configs.Generic.DATAFIXER_MODE.getOptionListValue();
Configs.Generic.DATAFIXER_MODE.setOptionListValue(DataFixerMode.NEVER);

if (schem.readFromSpongeSchematic(fileName, nbt))
{
Configs.Generic.DATAFIXER_MODE.setOptionListValue(dataFixer);
return Pair.of(schem.getMetadata().getSchematicSchema(), schem.getMetadata());
}
else
{
Configs.Generic.DATAFIXER_MODE.setOptionListValue(dataFixer);
}
}
case VANILLA_STRUCTURE ->
{
LitematicaSchematic schem = new LitematicaSchematic(file, type);
DataFixerMode dataFixer = (DataFixerMode) Configs.Generic.DATAFIXER_MODE.getOptionListValue();
Configs.Generic.DATAFIXER_MODE.setOptionListValue(DataFixerMode.NEVER);

if (schem.readFromVanillaStructure(fileName, nbt))
{
Configs.Generic.DATAFIXER_MODE.setOptionListValue(dataFixer);
return Pair.of(schem.getMetadata().getSchematicSchema(), schem.getMetadata());
}
else
{
Configs.Generic.DATAFIXER_MODE.setOptionListValue(dataFixer);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,20 @@ private void addEntitiesToWorld(World world, BlockPos posStart, StructurePlaceme
for (NbtCompound tag : this.entities)
{
Vec3d relativePos = NbtUtils.readEntityPositionFromTag(tag);
Vec3d transformedRelativePos = Vec3d.of(PositionUtils.getTransformedPosition(relativePos.toVanilla(), mirror, rotation));
Vec3d realPos = transformedRelativePos.add(posStart.getX(), posStart.getY(), posStart.getZ());
Entity entity = EntityUtils.createEntityAndPassengersFromNBT(tag, world);

if (entity != null)
if (relativePos != null)
{
float rotationYaw = entity.applyMirror(mirror);
rotationYaw = rotationYaw + (entity.getYaw() - entity.applyRotation(rotation));
entity.refreshPositionAndAngles(realPos.x, realPos.y, realPos.z, rotationYaw, entity.getPitch());
EntityUtils.spawnEntityAndPassengersInWorld(entity, world);
Vec3d transformedRelativePos = Vec3d.of(PositionUtils.getTransformedPosition(relativePos.toVanilla(), mirror, rotation));
Vec3d realPos = transformedRelativePos.add(posStart.getX(), posStart.getY(), posStart.getZ());
Entity entity = EntityUtils.createEntityAndPassengersFromNBT(tag, world);

if (entity != null)
{
float rotationYaw = entity.applyMirror(mirror);
rotationYaw = rotationYaw + (entity.getYaw() - entity.applyRotation(rotation));
entity.refreshPositionAndAngles(realPos.x, realPos.y, realPos.z, rotationYaw, entity.getPitch());
EntityUtils.spawnEntityAndPassengersInWorld(entity, world);
}
}
}
}
Expand Down

0 comments on commit e316cce

Please sign in to comment.