Skip to content

Commit

Permalink
Merge pull request #4 from Vulpeus-Server/feature/data-types
Browse files Browse the repository at this point in the history
  • Loading branch information
topi-banana authored Jan 4, 2025
2 parents bddfb48 + 526f4b0 commit 0482119
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ Litematica support. Inspired by Syncmatica.
- [x] Pos
- [x] Mirror
- [x] Rotation
- [ ] Ignore Entities
- [ ] Subregion
- [x] Ignore Entities
- [x] Placement ON/OFF
- [x] Subregion
- [x] Pos
- [x] Mirror
- [x] Rotation
- [ ] Ignore Entities
- [ ] Placement ON/OFF
- [x] Ignore Entities
- [x] Placement ON/OFF

## Thanks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import fi.dy.masa.litematica.schematic.LitematicaSchematic;
import fi.dy.masa.litematica.schematic.placement.SchematicPlacement;
import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager;
import fi.dy.masa.litematica.schematic.placement.SubRegionPlacement;
import fi.dy.masa.malilib.util.JsonUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -61,10 +62,19 @@ public class SchematicPlacementMixin implements ISchematicPlacement {
self.getOrigin(),
self.getMirror(),
self.getRotation(),
self.getName()
self.getName(),
self.ignoreEntities(),
self.isEnabled()
),
self.getAllSubRegionsPlacements().stream().map(x ->
new KyoyuRegion(x.getPos(), x.getMirror(), x.getRotation(), x.getName())
new KyoyuRegion(
x.getPos(),
x.getMirror(),
x.getRotation(),
x.getName(),
x.ignoreEntities(),
x.isEnabled()
)
).collect(Collectors.toList()),
Minecraft.getInstance().name(),
Minecraft.getInstance().name(),
Expand All @@ -81,13 +91,26 @@ public class SchematicPlacementMixin implements ISchematicPlacement {

self.setMirror(kyoyuPlacement.getRegion().getMirror(), null);
self.setRotation(kyoyuPlacement.getRegion().getRotation(), null);
if (self.ignoreEntities() != kyoyuPlacement.getRegion().ignoreEntities()) {
self.toggleIgnoreEntities(null);
}
self.setEnabled(kyoyuPlacement.getRegion().isEnable());

BlockPos origin = kyoyuPlacement.getRegion().getPos();
for (KyoyuRegion subRegion: kyoyuPlacement.getSubRegions()) {
String subRegionName = subRegion.getName();

self.moveSubRegionTo(subRegionName, subRegion.getPos().offset(origin.getX(), origin.getY(), origin.getZ()), null);
self.setSubRegionMirror(subRegionName, subRegion.getMirror(), null);
self.setSubRegionRotation(subRegionName, subRegion.getRotation(), null);

SubRegionPlacement subRegionPlacement = self.getRelativeSubRegionPlacement(subRegionName);
if (subRegionPlacement != null && subRegionPlacement.ignoreEntities() != subRegion.ignoreEntities()) {
self.toggleSubRegionIgnoreEntities(subRegionName, null);
}
if (subRegionPlacement != null && subRegionPlacement.isEnabled() != subRegion.isEnable()) {
self.toggleSubRegionEnabled(subRegionName, null);
}
}
self.toggleLocked();
}
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/vulpeus/kyoyu/placement/KyoyuRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public class KyoyuRegion {
private final Mirror mirror;
private final Rotation rotation;
private final String name;
private final boolean ignoreEntity;
private final boolean enable;

public KyoyuRegion(BlockPos pos, Mirror mirror, Rotation rotation, String name) {
public KyoyuRegion(BlockPos pos, Mirror mirror, Rotation rotation, String name, boolean ignoreEntity, boolean enable) {
this.pos = pos;
this.mirror = mirror;
this.rotation = rotation;
this.name = name;
this.ignoreEntity = ignoreEntity;
this.enable = enable;
}

public BlockPos getPos() {
Expand All @@ -33,4 +37,12 @@ public Rotation getRotation() {
public String getName() {
return name;
}

public boolean ignoreEntities() {
return ignoreEntity;
}

public boolean isEnable() {
return enable;
}
}

0 comments on commit 0482119

Please sign in to comment.