Skip to content

Commit

Permalink
Fix mixin error with ars additions (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustRed23 committed Jun 21, 2024
1 parent 9b88f34 commit af34d94
Showing 1 changed file with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
BlockPos blockpos = structuretemplate$structureblockinfo.pos;
if (boundingbox == null || boundingbox.isInside(blockpos)) {
FluidState fluidstate = p_230332_.shouldKeepLiquids() ? p_230329_.getFluidState(blockpos) : null;
@@ -330,7 +_,7 @@
}

if (!p_230332_.isIgnoreEntities()) {
- this.placeEntities(p_230329_, p_230330_, p_230332_.getMirror(), p_230332_.getRotation(), p_230332_.getRotationPivot(), boundingbox, p_230332_.shouldFinalizeEntities());
+ this.addEntitiesToWorld(p_230329_, p_230330_, p_230332_);
}

return true;
@@ -359,7 +_,15 @@
});
}
Expand All @@ -57,10 +66,14 @@
}

if (structuretemplate$structureblockinfo1 != null) {
@@ -383,6 +_,23 @@
@@ -383,13 +_,29 @@
return list1;
}

- private void placeEntities(ServerLevelAccessor p_74524_, BlockPos p_74525_, Mirror p_74526_, Rotation p_74527_, BlockPos p_74528_, @Nullable BoundingBox p_74529_, boolean p_74530_) {
- for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) {
- BlockPos blockpos = transform(structuretemplate$structureentityinfo.blockPos, p_74526_, p_74527_, p_74528_).offset(p_74525_);
- if (p_74529_ == null || p_74529_.isInside(blockpos)) {
+ public static List<StructureTemplate.StructureEntityInfo> processEntityInfos(@Nullable StructureTemplate template, LevelAccessor p_215387_0_, BlockPos p_215387_1_, StructurePlaceSettings p_215387_2_, List<StructureTemplate.StructureEntityInfo> p_215387_3_) {
+ List<StructureTemplate.StructureEntityInfo> list = Lists.newArrayList();
+ for(StructureTemplate.StructureEntityInfo entityInfo : p_215387_3_) {
Expand All @@ -78,9 +91,31 @@
+ return list;
+ }
+
private void placeEntities(ServerLevelAccessor p_74524_, BlockPos p_74525_, Mirror p_74526_, Rotation p_74527_, BlockPos p_74528_, @Nullable BoundingBox p_74529_, boolean p_74530_) {
for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) {
BlockPos blockpos = transform(structuretemplate$structureentityinfo.blockPos, p_74526_, p_74527_, p_74528_).offset(p_74525_);
+ private void addEntitiesToWorld(ServerLevelAccessor p_74524_, BlockPos p_74525_, StructurePlaceSettings placementIn) {
+ for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : processEntityInfos(this, p_74524_, p_74525_, placementIn, this.entityInfoList)) {
+ BlockPos blockpos = structuretemplate$structureentityinfo.blockPos; // FORGE: Position will have already been transformed by processEntityInfos
+ if (placementIn.getBoundingBox() == null || placementIn.getBoundingBox().isInside(blockpos)) {
CompoundTag compoundtag = structuretemplate$structureentityinfo.nbt.copy();
- Vec3 vec3 = transform(structuretemplate$structureentityinfo.pos, p_74526_, p_74527_, p_74528_);
- Vec3 vec31 = vec3.add((double)p_74525_.getX(), (double)p_74525_.getY(), (double)p_74525_.getZ());
+ Vec3 vec31 = structuretemplate$structureentityinfo.pos; // FORGE: Position will have already been transformed by processEntityInfos
ListTag listtag = new ListTag();
listtag.add(DoubleTag.valueOf(vec31.x));
listtag.add(DoubleTag.valueOf(vec31.y));
@@ -397,10 +_,10 @@
compoundtag.put("Pos", listtag);
compoundtag.remove("UUID");
createEntityIgnoreException(p_74524_, compoundtag).ifPresent((p_275190_) -> {
- float f = p_275190_.rotate(p_74527_);
- f += p_275190_.mirror(p_74526_) - p_275190_.getYRot();
+ float f = p_275190_.rotate(placementIn.getRotation());
+ f += p_275190_.mirror(placementIn.getMirror()) - p_275190_.getYRot();
p_275190_.moveTo(vec31.x, vec31.y, vec31.z, f, p_275190_.getXRot());
- if (p_74530_ && p_275190_ instanceof Mob) {
+ if (placementIn.shouldFinalizeEntities() && p_275190_ instanceof Mob) {
((Mob)p_275190_).finalizeSpawn(p_74524_, p_74524_.getCurrentDifficultyAt(BlockPos.containing(vec31)), MobSpawnType.STRUCTURE, (SpawnGroupData)null, compoundtag);
}

@@ -412,11 +_,13 @@
}

Expand Down

0 comments on commit af34d94

Please sign in to comment.