Add template arg to StructureProcessor#process

This commit is contained in:
tterrag 2019-09-22 23:35:00 -04:00
parent f03745ce45
commit dfbd61436b
5 changed files with 91 additions and 10 deletions

View File

@ -448,16 +448,17 @@
List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -952,7 +1044,7 @@
@@ -952,7 +1044,8 @@
}
public int func_181545_F() {
- return 63;
+ // FORGE: Allow modded dimensions to customize this value via ChunkGenerator
+ return this.field_73020_y.func_201711_g().func_222530_f();
}
public World func_201672_e() {
@@ -1000,7 +1092,7 @@
@@ -1000,7 +1093,7 @@
public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) {
BlockState blockstate = this.func_180495_p(p_175651_1_);
@ -466,7 +467,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -1045,7 +1137,7 @@
@@ -1045,7 +1138,7 @@
}
public long func_72905_C() {
@ -475,7 +476,7 @@
}
public long func_82737_E() {
@@ -1053,11 +1145,11 @@
@@ -1053,11 +1146,11 @@
}
public long func_72820_D() {
@ -489,7 +490,7 @@
}
protected void func_217389_a() {
@@ -1069,7 +1161,7 @@
@@ -1069,7 +1162,7 @@
}
public BlockPos func_175694_M() {
@ -498,7 +499,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) {
blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g()));
}
@@ -1078,10 +1170,14 @@
@@ -1078,10 +1171,14 @@
}
public void func_175652_B(BlockPos p_175652_1_) {
@ -514,7 +515,7 @@
return true;
}
@@ -1149,8 +1245,7 @@
@@ -1149,8 +1246,7 @@
}
public boolean func_180502_D(BlockPos p_180502_1_) {
@ -524,7 +525,7 @@
}
@Nullable
@@ -1164,11 +1259,11 @@
@@ -1164,11 +1260,11 @@
}
public int func_72940_L() {
@ -538,7 +539,7 @@
}
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -1199,16 +1294,15 @@
@@ -1199,16 +1295,15 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@ -559,7 +560,7 @@
blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
}
}
@@ -1287,4 +1381,16 @@
@@ -1287,4 +1382,16 @@
public BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_) {
return new BlockPos(p_205770_2_.func_177958_n(), this.func_201676_a(p_205770_1_, p_205770_2_.func_177958_n(), p_205770_2_.func_177952_p()), p_205770_2_.func_177952_p());
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
+++ b/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
@@ -88,7 +88,7 @@
if (!template.func_189962_a(p_214848_2_, p_214848_3_, placementsettings, 18)) {
return false;
} else {
- for(Template.BlockInfo template$blockinfo : Template.func_215387_a(p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) {
+ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(template, p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) {
this.func_214846_a(p_214848_2_, template$blockinfo, p_214848_3_, p_214848_4_, p_214848_6_, p_214848_5_);
}

View File

@ -0,0 +1,35 @@
--- a/net/minecraft/world/gen/feature/template/StructureProcessor.java
+++ b/net/minecraft/world/gen/feature/template/StructureProcessor.java
@@ -9,8 +9,31 @@
public abstract class StructureProcessor {
@Nullable
- public abstract Template.BlockInfo func_215194_a(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_);
+ @Deprecated
+ public Template.BlockInfo func_215194_a(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_) {
+ return p_215194_4_;
+ }
+ /**
+ * FORGE: Add template parameter
+ *
+ * @param p_215194_1_
+ * @param p_215194_2_
+ * @param p_215194_3_
+ * @param p_215194_4_
+ * @param p_215194_5_
+ * @param template The template being placed, can be null due to deprecated
+ * method calls.
+ * @see #process(IWorldReader, BlockPos,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * PlacementSettings)
+ */
+ @Nullable
+ public Template.BlockInfo process(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_, @Nullable Template template) {
+ return func_215194_a(p_215194_1_, p_215194_2_, p_215194_3_, p_215194_4_, p_215194_5_);
+ }
+
protected abstract IStructureProcessorType func_215192_a();
protected abstract <T> Dynamic<T> func_215193_a(DynamicOps<T> p_215193_1_);

View File

@ -0,0 +1,32 @@
--- a/net/minecraft/world/gen/feature/template/Template.java
+++ b/net/minecraft/world/gen/feature/template/Template.java
@@ -177,7 +177,7 @@
int i1 = Integer.MIN_VALUE;
int j1 = Integer.MIN_VALUE;
- for(Template.BlockInfo template$blockinfo : func_215387_a(p_189962_1_, p_189962_2_, p_189962_3_, list)) {
+ for(Template.BlockInfo template$blockinfo : processBlockInfos(this, p_189962_1_, p_189962_2_, p_189962_3_, list)) {
BlockPos blockpos = template$blockinfo.field_186242_a;
if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) {
IFluidState ifluidstate = p_189962_3_.func_204763_l() ? p_189962_1_.func_204610_c(blockpos) : null;
@@ -317,14 +317,19 @@
});
}
+ @Deprecated
public static List<Template.BlockInfo> func_215387_a(IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.BlockInfo> p_215387_3_) {
+ return processBlockInfos(null, p_215387_0_, p_215387_1_, p_215387_2_, p_215387_3_);
+ }
+
+ public static List<Template.BlockInfo> processBlockInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.BlockInfo> p_215387_3_) {
List<Template.BlockInfo> list = Lists.newArrayList();
for(Template.BlockInfo template$blockinfo : p_215387_3_) {
BlockPos blockpos = func_186266_a(p_215387_2_, template$blockinfo.field_186242_a).func_177971_a(p_215387_1_);
Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c);
- for(Iterator<StructureProcessor> iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_215194_a(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_)) {
+ for(Iterator<StructureProcessor> iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_, template)) {
;
}

View File

@ -70,6 +70,8 @@ net/minecraft/world/end/DragonFightManager.<init>(Lnet/minecraft/world/server/Se
net/minecraft/world/gen/feature/OreFeatureConfig$FillerBlockType.create(Ljava/lang/String;Ljava/lang/String;Ljava/util/function/Predicate;)Lnet/minecraft/world/gen/feature/OreFeatureConfig$FillerBlockType;=|enumName,p_i50618_3_,p_i50618_4_
net/minecraft/world/gen/feature/jigsaw/JigsawPattern$PlacementBehaviour.create(Ljava/lang/String;Ljava/lang/String;Lcom/google/common/collect/ImmutableList;)Lnet/minecraft/world/gen/feature/jigsaw/JigsawPattern$PlacementBehaviour;=|enumName,p_i50487_3_,p_i50487_4_
net/minecraft/world/gen/feature/template/StructureProcessor.process(Lnet/minecraft/world/IWorldReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;Lnet/minecraft/world/gen/feature/template/PlacementSettings;Lnet/minecraft/world/gen/feature/template/Template;)Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;=|p_215194_1_,p_215194_2_,p_215194_3_,p_215194_4_,p_215194_5_,template
net/minecraft/world/gen/feature/template/Template.processBlockInfos(Lnet/minecraft/world/gen/feature/template/Template;Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/template/PlacementSettings;Ljava/util/List;)Ljava/util/List;=|template,p_215387_0_,p_215387_1_,p_215387_2_,p_215387_3_
net/minecraft/entity/EntityType.<init>(Lnet/minecraft/entity/EntityType$IFactory;Lnet/minecraft/entity/EntityClassification;ZZZLcom/mojang/datafixers/types/Type;Lnet/minecraft/entity/EntitySize;Ljava/util/function/Predicate;Ljava/util/function/ToIntFunction;Ljava/util/function/ToIntFunction;Ljava/util/function/BiFunction;)V=|p_i50385_1_,p_i50385_2_,p_i50385_3_,p_i50385_4_,p_i50385_5_,p_i50385_6_,p_i50385_7_,velocityUpdateSupplier,trackingRangeSupplier,updateIntervalSupplier,customClientFactory
net/minecraft/world/spawner/WorldEntitySpawner.getSpawnList(Lnet/minecraft/world/gen/ChunkGenerator;Lnet/minecraft/entity/EntityClassification;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/World;)Z|p_222264_0_,p_222264_1_,p_222264_2_,p_222264_3_,world