Fixed initial runtime crashes in BetterEnd

This commit is contained in:
Frank 2022-04-08 18:17:14 +02:00
parent defa88bbff
commit f59cf8bad2
3 changed files with 10 additions and 13 deletions

View file

@ -1,5 +1,5 @@
package ru.betterend.interfaces; package ru.betterend.interfaces;
public interface TargetChecker { public interface TargetChecker {
boolean isTarget(); boolean be_isTarget();
} }

View file

@ -31,25 +31,21 @@ public class NoiseChunkMixin implements TargetChecker {
} }
@Override @Override
public boolean isTarget() { public boolean be_isTarget() {
return be_isEndGenerator; return be_isEndGenerator;
} }
@Final
@Shadow(aliases = "this$0")
private NoiseChunk this$0;
@Shadow @Final private List<NoiseChunk.NoiseInterpolator> interpolators; @Shadow @Final private List<NoiseChunk.NoiseInterpolator> interpolators;
@Inject(method = "fillSlice", at = @At("HEAD"), cancellable = true) @Inject(method = "fillSlice", at = @At("HEAD"), cancellable = true)
private void be_fillSlice(boolean primarySlice, int x, CallbackInfo info) { private void be_fillSlice(boolean primarySlice, int x, CallbackInfo info) {
if (!TargetChecker.class.cast(this$0).isTarget()) { if (!TargetChecker.class.cast(this).be_isTarget()) {
return; return;
} }
info.cancel(); info.cancel();
NoiseChunkAccessor accessor = NoiseChunkAccessor.class.cast(this$0); NoiseChunkAccessor accessor = NoiseChunkAccessor.class.cast(this);
NoiseSettings noiseSettings = accessor.bnv_getNoiseSettings(); NoiseSettings noiseSettings = accessor.bnv_getNoiseSettings();
final int sizeY = noiseSettings.getCellHeight(); final int sizeY = noiseSettings.getCellHeight();

View file

@ -324,12 +324,13 @@ public class EndFeatures {
BiomeAPI.addBiomeFeature(biome, THALLASIUM_ORE); BiomeAPI.addBiomeFeature(biome, THALLASIUM_ORE);
BiomeAPI.addBiomeFeature(biome, ENDER_ORE); BiomeAPI.addBiomeFeature(biome, ENDER_ORE);
BiomeAPI.addBiomeFeature(biome, CRASHED_SHIP); BiomeAPI.addBiomeFeature(biome, CRASHED_SHIP);
BCLBiome bclbiome = BiomeAPI.getBiome(id); BCLBiome bclbiome = BiomeAPI.getBiome(id);
BCLFeature feature = getBiomeStructures(bclbiome); //TODO: 1.18.2 - Not sure what this code is supposed to do....
if (feature != null) { // BCLFeature feature = getBiomeStructures(bclbiome);
BiomeAPI.addBiomeFeature(biome, feature); // if (feature != null) {
} // BiomeAPI.addBiomeFeature(biome, feature);
// }
if (id.getNamespace().equals(BetterEnd.MOD_ID)) { if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
return; return;