Adopted new BCLib API

This commit is contained in:
Frank 2022-06-21 19:25:57 +02:00
parent 0f5d4e73fa
commit 6770bbbbea
84 changed files with 164 additions and 153 deletions

View file

@ -1,9 +1,9 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.tag.CommonBlockTags;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.world.generator.GeneratorOptions;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;

View file

@ -1,7 +1,7 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.tag.CommonBlockTags;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View file

@ -1,6 +1,6 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.tag.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.Registry;
import net.minecraft.util.RandomSource;

View file

@ -1,9 +1,9 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.WorldDataAPI;
import org.betterx.bclib.util.StructureHelper;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.world.generator.GeneratorOptions;
import org.betterx.worlds.together.world.WorldConfig;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
@ -74,7 +74,7 @@ public class EndPodiumFeatureMixin {
}
private BlockPos be_updatePortalPos(WorldGenLevel world) {
CompoundTag compound = WorldDataAPI.getRootTag(BetterEnd.MOD_ID).getCompound("portal");
CompoundTag compound = WorldConfig.getRootTag(BetterEnd.MOD_ID).getCompound("portal");
be_portalPosition = NbtUtils.readBlockPos(compound);
if (be_portalPosition.getY() == 0) {
@ -87,8 +87,8 @@ public class EndPodiumFeatureMixin {
}*/
int y = world.getHeight(Types.WORLD_SURFACE, 0, 0);
be_portalPosition = new BlockPos(0, y, 0);
WorldDataAPI.getRootTag(BetterEnd.MOD_ID).put("portal", NbtUtils.writeBlockPos(be_portalPosition));
WorldDataAPI.saveFile(BetterEnd.MOD_ID);
WorldConfig.getRootTag(BetterEnd.MOD_ID).put("portal", NbtUtils.writeBlockPos(be_portalPosition));
WorldConfig.saveFile(BetterEnd.MOD_ID);
}
return be_portalPosition;

View file

@ -1,8 +1,8 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.WorldDataAPI;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.world.generator.GeneratorOptions;
import org.betterx.worlds.together.world.WorldConfig;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.levelgen.feature.SpikeFeature.EndSpike;
@ -26,7 +26,7 @@ public class EndSpikeMixin {
int x = getCenterX();
int z = getCenterZ();
String pillarID = String.format("%d_%d", x, z);
CompoundTag pillar = WorldDataAPI.getCompoundTag(BetterEnd.MOD_ID, "pillars");
CompoundTag pillar = WorldConfig.getCompoundTag(BetterEnd.MOD_ID, "pillars");
int minY = pillar.contains(pillarID) ? pillar.getInt(pillarID) : 65;
int maxY = minY + height - 54;
info.setReturnValue(maxY);

View file

@ -1,10 +1,10 @@
package org.betterx.betterend.mixin.common;
import org.betterx.bclib.api.v2.WorldDataAPI;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.StructureHelper;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.world.generator.GeneratorOptions;
import org.betterx.worlds.together.world.WorldConfig;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
@ -60,14 +60,14 @@ public class SpikeFeatureMixin {
long lz = z;
if (lx * lx + lz * lz < 10000) {
String pillarID = String.format("%d_%d", x, z);
CompoundTag pillar = WorldDataAPI.getCompoundTag(BetterEnd.MOD_ID, "pillars");
CompoundTag pillar = WorldConfig.getCompoundTag(BetterEnd.MOD_ID, "pillars");
boolean haveValue = pillar.contains(pillarID);
minY = haveValue
? pillar.getInt(pillarID)
: world.getChunk(x >> 4, z >> 4).getHeight(Types.WORLD_SURFACE, x & 15, z);
if (!haveValue) {
pillar.putInt(pillarID, minY);
WorldDataAPI.saveFile(BetterEnd.MOD_ID);
WorldConfig.saveFile(BetterEnd.MOD_ID);
}
} else {
minY = world.getChunk(x >> 4, z >> 4).getHeight(Types.WORLD_SURFACE, x & 15, z);