Fixed Compiler errors on 1.18.2
This commit is contained in:
parent
7cf60dc206
commit
8f8ff011ac
5 changed files with 85 additions and 69 deletions
|
@ -89,25 +89,29 @@ public class OldBulbisGardens extends EndBiome.Config {
|
|||
HolderSet<PlacedFeature> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal());
|
||||
if (vegetal.size() > 2) {
|
||||
Supplier<PlacedFeature> getter;
|
||||
// Trees (first two features)
|
||||
// I couldn't process them with conditions, so that's why they are hardcoded (paulevs)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
getter = vegetal.get(i);
|
||||
Holder<PlacedFeature> feature = getter.get();
|
||||
ResourceLocation id = BetterEnd.makeID("obg_feature_" + i);
|
||||
feature = Registry.register(
|
||||
BuiltinRegistries.PLACED_FEATURE,
|
||||
id,
|
||||
feature
|
||||
);
|
||||
builder.feature(Decoration.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
// Grasses and other features
|
||||
for (int i = 2; i < vegetal.size(); i++) {
|
||||
getter = vegetal.get(i);
|
||||
Holder<PlacedFeature> feature = getter.get();
|
||||
builder.feature(Decoration.VEGETAL_DECORATION, feature);
|
||||
//TODO: 1.18.2 BRING BACK FEATURE COPY CODE
|
||||
for(var placed : vegetal){
|
||||
System.out.print(placed);
|
||||
}
|
||||
// // Trees (first two features)
|
||||
// // I couldn't process them with conditions, so that's why they are hardcoded (paulevs)
|
||||
// for (int i = 0; i < 2; i++) {
|
||||
// getter = vegetal.get(i);
|
||||
// Holder<PlacedFeature> feature = getter.get();
|
||||
// ResourceLocation id = BetterEnd.makeID("obg_feature_" + i);
|
||||
// feature = Registry.register(
|
||||
// BuiltinRegistries.PLACED_FEATURE,
|
||||
// id,
|
||||
// feature
|
||||
// );
|
||||
// builder.feature(Decoration.VEGETAL_DECORATION, feature);
|
||||
// }
|
||||
// // Grasses and other features
|
||||
// for (int i = 2; i < vegetal.size(); i++) {
|
||||
// getter = vegetal.get(i);
|
||||
// Holder<PlacedFeature> feature = getter.get();
|
||||
// builder.feature(Decoration.VEGETAL_DECORATION, feature);
|
||||
// }
|
||||
}
|
||||
|
||||
builder.feature(EndFeatures.PURPLE_POLYPORE)
|
||||
|
|
|
@ -115,22 +115,6 @@ public class EndHammerItem extends DiggerItem implements ItemModelProvider, TagP
|
|||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||
if (tag.equals(CommonItemTags.HAMMERS)) {
|
||||
return this.getDestroySpeed(stack, state);
|
||||
}
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||
if (tag.equals(CommonItemTags.HAMMERS)) {
|
||||
return this.getTier().getLevel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCorrectToolForDrops(BlockState state) {
|
||||
if (state.getMaterial().equals(Material.GLASS)) {
|
||||
|
|
|
@ -1,24 +1,75 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.levelgen.*;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.betterend.interfaces.TargetChecker;
|
||||
import ru.betterend.world.generator.TerrainGenerator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Mixin(NoiseChunk.class)
|
||||
public class NoiseChunkMixin implements TargetChecker {
|
||||
private boolean be_isEndGenerator;
|
||||
|
||||
|
||||
private static boolean be_is(NoiseGeneratorSettings gen, ResourceKey<NoiseGeneratorSettings> resourceKey) {
|
||||
return Objects.equals(gen, BuiltinRegistries.NOISE_GENERATOR_SETTINGS.get(resourceKey));
|
||||
}
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void be_onNoiseChunkInit(int i, int j, int k, NoiseRouter noiseRouter, int l, int m, DensityFunctions.BeardifierOrMarker beardifierOrMarker, NoiseGeneratorSettings noiseGeneratorSettings, Aquifer.FluidPicker fluidPicker, Blender blender, CallbackInfo ci) {
|
||||
be_isEndGenerator = noiseGeneratorSettings.stable(NoiseGeneratorSettings.END);
|
||||
//be_isEndGenerator = noiseGeneratorSettings.is(NoiseGeneratorSettings.END);
|
||||
be_isEndGenerator = be_is(noiseGeneratorSettings, NoiseGeneratorSettings.END);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return be_isEndGenerator;
|
||||
}
|
||||
|
||||
@Final
|
||||
@Shadow(aliases = "this$0")
|
||||
private NoiseChunk this$0;
|
||||
|
||||
@Shadow @Final private List<NoiseChunk.NoiseInterpolator> interpolators;
|
||||
|
||||
@Inject(method = "fillSlice", at = @At("HEAD"), cancellable = true)
|
||||
private void be_fillSlice(boolean primarySlice, int x, CallbackInfo info) {
|
||||
if (!TargetChecker.class.cast(this$0).isTarget()) {
|
||||
return;
|
||||
}
|
||||
|
||||
info.cancel();
|
||||
|
||||
NoiseChunkAccessor accessor = NoiseChunkAccessor.class.cast(this$0);
|
||||
NoiseSettings noiseSettings = accessor.bnv_getNoiseSettings();
|
||||
|
||||
final int sizeY = noiseSettings.getCellHeight();
|
||||
final int sizeXZ = noiseSettings.getCellWidth();
|
||||
//final int cellsY = accessor.bnv_getCellCountY() + 1;
|
||||
final int cellSizeXZ = accessor.bnv_getCellCountXZ() + 1;
|
||||
final int firstCellZ = accessor.bnv_getFirstCellZ();
|
||||
//final int cellNoiseMinY = accessor.bnv_getCellNoiseMinY();
|
||||
|
||||
x *= sizeXZ;
|
||||
|
||||
for (int cellXZ = 0; cellXZ < cellSizeXZ; ++cellXZ) {
|
||||
int z = (firstCellZ + cellXZ) * sizeXZ;
|
||||
for (NoiseChunk.NoiseInterpolator noiseInterpolator : this.interpolators) {
|
||||
if (noiseInterpolator instanceof NoiseInterpolatorMixin ni) {
|
||||
//TODO: 1.18.2 Check this implementation
|
||||
final double[] ds = (primarySlice ? ni.be_getSlice0() : ni.be_getSlice1())[cellXZ];
|
||||
TerrainGenerator.fillTerrainDensity(ds, x, z, sizeXZ, sizeY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +1,25 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.world.level.levelgen.DensityFunction;
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseSettings;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.betterend.interfaces.TargetChecker;
|
||||
import ru.betterend.world.generator.TerrainGenerator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(NoiseChunk.NoiseInterpolator.class)
|
||||
public class NoiseInterpolatorMixin {
|
||||
@Final
|
||||
@Shadow(aliases = "this$0")
|
||||
private NoiseChunk this$0;
|
||||
|
||||
@Inject(method = "fillSlice", at = @At("HEAD"), cancellable = true)
|
||||
private void be_fillSlice(double[][] data, int x, CallbackInfo info) {
|
||||
if (!TargetChecker.class.cast(this$0).isTarget()) {
|
||||
return;
|
||||
}
|
||||
|
||||
info.cancel();
|
||||
|
||||
NoiseChunkAccessor accessor = NoiseChunkAccessor.class.cast(this$0);
|
||||
NoiseSettings noiseSettings = accessor.bnv_getNoiseSettings();
|
||||
|
||||
final int sizeY = noiseSettings.getCellHeight();
|
||||
final int sizeXZ = noiseSettings.getCellWidth();
|
||||
//final int cellsY = accessor.bnv_getCellCountY() + 1;
|
||||
final int cellsXZ = accessor.bnv_getCellCountXZ() + 1;
|
||||
final int firstCellZ = accessor.bnv_getFirstCellZ();
|
||||
//final int cellNoiseMinY = accessor.bnv_getCellNoiseMinY();
|
||||
|
||||
x *= sizeXZ;
|
||||
|
||||
for (int cellXZ = 0; cellXZ < cellsXZ; ++cellXZ) {
|
||||
int z = (firstCellZ + cellXZ) * sizeXZ;
|
||||
TerrainGenerator.fillTerrainDensity(data[cellXZ], x, z, sizeXZ, sizeY);
|
||||
}
|
||||
}
|
||||
public interface NoiseInterpolatorMixin {
|
||||
@Accessor("slice0")
|
||||
public double[][] be_getSlice0();
|
||||
|
||||
@Accessor("slice1")
|
||||
public double[][] be_getSlice1();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.BonemealAPI;
|
||||
import ru.bclib.api.ComposterAPI;
|
||||
import ru.bclib.api.tag.CommonItemTags;
|
||||
import ru.bclib.api.tag.NamedBlockTags;
|
||||
import ru.bclib.api.tag.NamedCommonBlockTags;
|
||||
import ru.bclib.api.tag.NamedCommonItemTags;
|
||||
|
@ -109,8 +108,6 @@ public class EndTags {
|
|||
}
|
||||
});
|
||||
|
||||
ToolManagerImpl.tag(CommonItemTags.HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(ITEM_HAMMERS));
|
||||
|
||||
TagAPI.addBlockTag(
|
||||
NamedCommonBlockTags.GEN_END_STONES,
|
||||
EndBlocks.ENDER_ORE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue