Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,40 @@ private BaseEntity transformNbtData(BaseEntity state) {
tagX.value().intValue(), tagY.value().intValue(), tagZ.value().intValue()
);
BlockVector3 newLeash = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
return new BaseEntity(state.getType(), LazyReference.computed(tag.toBuilder()
state = new BaseEntity(state.getType(), LazyReference.computed(tag.toBuilder()
.put("Leash", leashCompound.toBuilder()
.putInt("X", newLeash.x())
.putInt("Y", newLeash.y())
.putInt("Z", newLeash.z())
.build()
).build()));
tag = state.getNbt();
}
}
LinIntArrayTag leashArray = tag.findTag("leash", LinTagType.intArrayTag());
if (leashArray != null) {
Vector3 tilePosition = Vector3.at(
leashArray.value()[0], leashArray.value()[1], leashArray.value()[2]
);
BlockVector3 newLeash = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
state = new BaseEntity(state.getType(), LazyReference.computed(tag.toBuilder()
.putIntArray("leash", new int[]{newLeash.x(), newLeash.y(), newLeash.z()})
.build()));
tag = state.getNbt();
}

// Handle home position for mobs
LinIntArrayTag homePosArray = tag.findTag("home_pos", LinTagType.intArrayTag());
if (homePosArray != null) {
Vector3 tilePosition = Vector3.at(
homePosArray.value()[0], homePosArray.value()[1], homePosArray.value()[2]
);
BlockVector3 newLeash = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
state = new BaseEntity(state.getType(), LazyReference.computed(tag.toBuilder()
.putIntArray("home_pos", new int[]{newLeash.x(), newLeash.y(), newLeash.z()})
.build()));
tag = state.getNbt();
}

// Handle hanging entities (paintings, item frames, etc.)

Expand Down