Fixed Compiletime issue

This commit is contained in:
Frank 2022-12-09 16:01:06 +01:00
parent fd2559e038
commit a8856fff15
94 changed files with 562 additions and 574 deletions

View file

@ -81,7 +81,8 @@ public class BetterEnd implements ModInitializer {
}
});
if (RUNS_TRINKETS) {
org.betterx.betterend.integration.trinkets.Elytra.register();
//TODO: 1.19.3 Reenable when Trinkets is available
//org.betterx.betterend.integration.trinkets.Elytra.register();
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
@ -38,7 +39,7 @@ public class BoluxMushroomBlock extends EndPlantBlock {
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -8,6 +8,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -43,7 +44,7 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements AddMine
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
@ -34,7 +33,7 @@ public class BulbVineBlock extends BaseVineBlock {
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -12,6 +12,7 @@ import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -68,7 +69,7 @@ public class CrystalMossCoverBlock extends MultifaceBlock implements Bonemealabl
@Override
public boolean isValidBonemealTarget(
BlockGetter blockGetter,
LevelReader blockGetter,
BlockPos blockPos,
BlockState blockState,
boolean bl

View file

@ -114,7 +114,7 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock implements AddMineable
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -3,7 +3,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.blocks.basis.PedestalBlock;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@ -19,7 +19,7 @@ public class EndPedestal extends PedestalBlock {
@Override
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", BetterEnd.MOD_ID);

View file

@ -17,6 +17,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
@ -151,7 +152,7 @@ public class EndPortalBlock extends NetherPortalBlock implements RenderLayerProv
) {
if (targetWorld == null) return null;
Registry<DimensionType> registry = targetWorld.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
.registryOrThrow(Registries.DIMENSION_TYPE);
ResourceLocation targetWorldId = targetWorld.dimension().location();
ResourceLocation currentWorldId = currentWorld.dimension().location();
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();

View file

@ -8,7 +8,7 @@ import org.betterx.betterend.rituals.EternalRitual;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -60,7 +60,7 @@ public class EternalPedestal extends PedestalBlock {
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, false).setValue(HAS_LIGHT, false));
} else {
ItemStack itemStack = pedestal.getItem(0);
ResourceLocation id = Registry.ITEM.getKey(itemStack.getItem());
ResourceLocation id = BuiltInRegistries.ITEM.getKey(itemStack.getItem());
if (EndPortals.isAvailableItem(id)) {
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true));
if (pedestal.hasRitual()) {

View file

@ -19,14 +19,13 @@ import org.betterx.betterend.interfaces.PottableTerrain;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -58,6 +57,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.joml.Vector3f;
import java.io.File;
import java.util.List;
@ -191,7 +191,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
}
private void processBlock(Block[] target, Block block, String path, Map<String, Integer> idMap) {
ResourceLocation location = Registry.BLOCK.getKey(block);
ResourceLocation location = BuiltInRegistries.BLOCK.getKey(block);
if (idMap.containsKey(location.getPath())) {
target[idMap.get(location.getPath())] = block;
} else {
@ -315,7 +315,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
}
final int compareID = i + 1;
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
ResourceLocation modelPath = BuiltInRegistries.BLOCK.getKey(plants[i]);
ResourceLocation objSource = new ResourceLocation(
modelPath.getNamespace(),
"models/block/" + modelPath.getPath() + "_potted.json"
@ -329,7 +329,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.add();
continue;
} else if (plants[i] instanceof SaplingBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%modid%", loc.getNamespace());
@ -343,7 +343,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.add();
continue;
} else if (plants[i] instanceof PottableLeavesBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%leaves%", loc.getPath().contains("lucernia") ? loc.getPath() + "_1" : loc.getPath());
@ -396,7 +396,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
} else {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%modid%", loc.getNamespace());
@ -418,7 +418,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
ResourceLocation soilLoc = BetterEnd.makeID("flower_pot_soil_" + i);
if (!modelCache.containsKey(soilLoc)) {
String texture = Registry.BLOCK.getKey(soils[i]).getPath() + "_top";
String texture = BuiltInRegistries.BLOCK.getKey(soils[i]).getPath() + "_top";
if (texture.contains("rutiscus")) {
texture += "_1";
}

View file

@ -62,7 +62,7 @@ public class HydraluxBlock extends UnderwaterPlantBlock implements AddMineableSh
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -59,7 +59,7 @@ public class LargeAmaranitaBlock extends EndPlantBlock implements AddMineableShe
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -2,7 +2,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PedestalBlock;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@ -17,7 +17,7 @@ public class PedestalVanilla extends PedestalBlock {
@Override
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath().replace("_block", "");
return new HashMap<String, String>() {
private static final long serialVersionUID = 1L;

View file

@ -8,6 +8,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
@ -40,7 +41,7 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements AddMine
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -92,7 +92,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return state.getValue(FACING) == Direction.UP && world.getBlockState(pos.below())
.is(CommonBlockTags.END_STONES);
}

View file

@ -12,8 +12,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import net.fabricmc.api.EnvType;
@ -57,7 +57,7 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements CustomColorPro
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -16,7 +16,7 @@ import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionHand;
@ -433,7 +433,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
}
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", blockId.getNamespace());

View file

@ -1,7 +1,5 @@
package org.betterx.betterend.client;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.util.TranslationHelper;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.client.render.BetterEndSkyRenderer;
import org.betterx.betterend.events.ItemTooltipCallback;
@ -33,11 +31,6 @@ public class BetterEndClient implements ClientModInitializer {
ClientOptions.init();
registerTooltips();
if (BCLib.isDevEnvironment()) {
TranslationHelper.printMissingEnNames(BetterEnd.MOD_ID);
TranslationHelper.printMissingNames(BetterEnd.MOD_ID, "ru_ru");
}
ResourceLocation checkFlowerId = new ResourceLocation("item/chorus_flower");
ResourceLocation checkPlantId = new ResourceLocation("item/chorus_plant");
ResourceLocation toLoadFlowerId = new ResourceLocation("betterend", "item/custom_chorus_flower");
@ -58,7 +51,8 @@ public class BetterEndClient implements ClientModInitializer {
}
if (BetterEnd.RUNS_TRINKETS) {
org.betterx.betterend.integration.trinkets.ElytraClient.register();
//TODO: 1.19.3 Reenable when Trinkets is available
//org.betterx.betterend.integration.trinkets.ElytraClient.register();
}
}

View file

@ -139,10 +139,4 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
progress = menu.getSmeltProgress();
blit(matrices, leftPos + 92, topPos + 34, 176, 14, progress + 1, 16);
}
@Override
public void removed() {
recipeBook.removed();
super.removed();
}
}

View file

@ -2,15 +2,16 @@ package org.betterx.betterend.client.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
public class BeamRenderer {
private static final ResourceLocation BEAM_TEXTURE = new ResourceLocation("textures/entity/end_gateway_beam.png");
@ -41,7 +42,7 @@ public class BeamRenderer {
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderType.beaconBeam(BEAM_TEXTURE, true));
matrices.pushPose();
matrices.mulPose(Vector3f.YP.rotation(-rotation));
matrices.mulPose(Axis.YP.rotation(-rotation));
renderBeam(
matrices,
vertexConsumer,

View file

@ -7,9 +7,6 @@ import org.betterx.betterend.BetterEnd;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.FogRenderer;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
@ -19,6 +16,10 @@ import net.minecraft.world.level.levelgen.LegacyRandomSource;
import net.fabricmc.fabric.api.client.rendering.v1.DimensionRenderingRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRenderer {
@FunctionalInterface
interface BufferFunction {
@ -90,7 +91,7 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
if (blindA > 0) {
matrices.pushPose();
matrices.mulPose(new Quaternion(0, time, 0, false));
matrices.mulPose(new Quaternionf().rotationXYZ(0, time, 0));
RenderSystem.setShaderTexture(0, HORIZON);
renderBuffer(
matrices,
@ -105,7 +106,7 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
matrices.popPose();
matrices.pushPose();
matrices.mulPose(new Quaternion(0, -time, 0, false));
matrices.mulPose(new Quaternionf().rotationXYZ(0, -time, 0));
RenderSystem.setShaderTexture(0, NEBULA_1);
renderBuffer(
matrices,
@ -120,7 +121,7 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
matrices.popPose();
matrices.pushPose();
matrices.mulPose(new Quaternion(0, time2, 0, false));
matrices.mulPose(new Quaternionf().rotationXYZ(0, time2, 0));
RenderSystem.setShaderTexture(0, NEBULA_2);
renderBuffer(
matrices,
@ -137,7 +138,7 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
RenderSystem.setShaderTexture(0, STARS);
matrices.pushPose();
matrices.mulPose(axis3.rotation(time));
matrices.mulPose(new Quaternionf().setAngleAxis(time, axis3.x, axis3.y, axis3.z));
renderBuffer(
matrices,
projectionMatrix,
@ -151,7 +152,7 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
matrices.popPose();
matrices.pushPose();
matrices.mulPose(axis4.rotation(time2));
matrices.mulPose(new Quaternionf().setAngleAxis(time2, axis4.x, axis4.y, axis4.z));
renderBuffer(matrices, projectionMatrix, stars4, DefaultVertexFormat.POSITION_TEX, 1F, 1F, 1F, blind06);
matrices.popPose();
}
@ -176,12 +177,12 @@ public class BetterEndSkyRenderer implements DimensionRenderingRegistry.SkyRende
if (blindA > 0) {
matrices.pushPose();
matrices.mulPose(axis1.rotation(time3));
matrices.mulPose(new Quaternionf().setAngleAxis(time3, axis1.x, axis1.y, axis1.z));
renderBuffer(matrices, projectionMatrix, stars1, DefaultVertexFormat.POSITION, 1, 1, 1, blind06);
matrices.popPose();
matrices.pushPose();
matrices.mulPose(axis2.rotation(time2));
matrices.mulPose(new Quaternionf().setAngleAxis(time2, axis2.x, axis2.y, axis2.z));
renderBuffer(
matrices,
projectionMatrix,

View file

@ -2,8 +2,8 @@ package org.betterx.betterend.client.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import com.mojang.math.Constants;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
@ -15,6 +15,8 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import org.joml.Quaternionf;
public class EndCrystalRenderer {
private static final ResourceLocation CRYSTAL_TEXTURE = new ResourceLocation(
"textures/entity/end_crystal/end_crystal.png");
@ -25,6 +27,7 @@ public class EndCrystalRenderer {
private static final ModelPart FRAME;
private static final int AGE_CYCLE = 240;
private static final float SINE_45_DEGREES;
private static final Quaternionf ROTATOR;
public static void render(
int age,
@ -40,17 +43,20 @@ public class EndCrystalRenderer {
matrices.pushPose();
matrices.scale(0.8F, 0.8F, 0.8F);
matrices.translate(0.0D, -0.5D, 0.0D);
matrices.mulPose(Vector3f.YP.rotationDegrees(rotation));
matrices.mulPose(Axis.YP.rotationDegrees(rotation));
matrices.translate(0.0D, 0.8F, 0.0D);
matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
//matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.mulPose(ROTATOR);
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY);
matrices.scale(0.875F, 0.875F, 0.875F);
matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.mulPose(Vector3f.YP.rotationDegrees(rotation));
//matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.mulPose(ROTATOR);
matrices.mulPose(Axis.YP.rotationDegrees(rotation));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY);
matrices.scale(0.875F, 0.875F, 0.875F);
matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.mulPose(Vector3f.YP.rotationDegrees(rotation));
//matrices.mulPose(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.mulPose(ROTATOR);
matrices.mulPose(Axis.YP.rotationDegrees(rotation));
CORE.render(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY);
matrices.popPose();
}
@ -81,5 +87,12 @@ public class EndCrystalRenderer {
ModelPart root = getTexturedModelData().bakeRoot();
FRAME = root.getChild("FRAME");
CORE = root.getChild("CORE");
ROTATOR = new Quaternionf().setAngleAxis(
60.0f * Constants.DEG_TO_RAD,
SINE_45_DEGREES,
0.0F,
SINE_45_DEGREES
);
}
}

View file

@ -7,7 +7,7 @@ import org.betterx.ui.ColorUtil;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
@ -38,7 +38,7 @@ public class EternalCrystalRenderer {
float rotation = (age + tickDelta) / 25.0F + 6.0F;
matrices.pushPose();
matrices.scale(0.6F, 0.6F, 0.6F);
matrices.mulPose(Vector3f.YP.rotation(rotation));
matrices.mulPose(Axis.YP.rotation(rotation));
CORE.render(
matrices,
vertexConsumer,

View file

@ -7,7 +7,7 @@ import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndItems;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
@ -24,6 +24,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.joml.Vector3f;
@Environment(EnvType.CLIENT)
public class PedestalItemRenderer<T extends PedestalBlockEntity> implements BlockEntityRenderer<T> {
public PedestalItemRenderer(BlockEntityRendererProvider.Context ctx) {
@ -84,7 +86,7 @@ public class PedestalItemRenderer<T extends PedestalBlockEntity> implements Bloc
EternalCrystalRenderer.render(age, tickDelta, matrices, vertexConsumers, light);
} else {
float rotation = (age + tickDelta) / 25.0F + 6.0F;
matrices.mulPose(Vector3f.YP.rotation(rotation));
matrices.mulPose(Axis.YP.rotation(rotation));
minecraft.getItemRenderer()
.render(
activeItem,

View file

@ -6,6 +6,7 @@ import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.registry.EndBiomes;
import org.betterx.betterend.registry.EndPoiTypes;
import org.betterx.betterend.world.biome.EndBiome;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
@ -14,16 +15,16 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
import com.mojang.datafixers.util.Either;
import com.mojang.datafixers.util.Pair;
import com.mojang.math.Vector3d;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.ResourceOrTagLocationArgument;
import net.minecraft.commands.arguments.ResourceOrTagKeyArgument;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Holder;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceKey;
@ -38,6 +39,9 @@ import net.minecraft.world.phys.Vec3;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import com.google.common.base.Stopwatch;
import org.joml.Vector3d;
import java.util.*;
public class CommandRegistry {
@ -174,14 +178,14 @@ public class CommandRegistry {
0,
Collections.EMPTY_SET
);
ResourceOrTagLocationArgument.Result result = new ResourceOrTagLocationArgument.Result() {
ResourceOrTagKeyArgument.Result result = new ResourceOrTagKeyArgument.Result() {
@Override
public Either<ResourceKey, TagKey> unwrap() {
return Either.left(biome.getBiomeKey());
}
@Override
public Optional<ResourceOrTagLocationArgument.Result> cast(ResourceKey resourceKey) {
public Optional<ResourceOrTagKeyArgument.Result> cast(ResourceKey resourceKey) {
return Optional.empty();
}
@ -196,15 +200,24 @@ public class CommandRegistry {
}
};
ResourceKey<Biome> a = biome.getBiomeKey();
Holder<Biome> h = BuiltinRegistries.BIOME.getHolder(a).orElseThrow();
return LocateCommand.showLocateResult(
source,
result,
currentPosition,
new Pair<>(biomePosition, h),
"commands.locatebiome.success",
false
);
if (WorldBootstrap.getLastRegistryAccess() != null) {
Stopwatch stopwatch = Stopwatch.createStarted(Util.TICKER);
Holder<Biome> h = WorldBootstrap.getLastRegistryAccess()
.registryOrThrow(Registries.BIOME)
.getHolder(a)
.orElseThrow();
stopwatch.stop();
return LocateCommand.showLocateResult(
source,
result,
currentPosition,
new Pair<>(biomePosition, h),
"commands.locatebiome.success",
false,
stopwatch.elapsed()
);
}
return Command.SINGLE_SUCCESS;
}
}
}

View file

@ -6,7 +6,7 @@ import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.config.Configs;
import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.DyeItem;
import net.minecraft.world.level.ItemLike;
@ -36,7 +36,7 @@ public class ColoredMaterial {
Map<Integer, ItemLike> dyes,
boolean craftEight
) {
String id = Registry.BLOCK.getKey(source).getPath();
String id = BuiltInRegistries.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> {
String blockName = id + "_" + name;
Block block = constructor.apply(FabricBlockSettings.copyOf(source).mapColor(MaterialColor.COLOR_BLACK));

View file

@ -6,6 +6,7 @@ import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndItems;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.Items;
@ -21,7 +22,7 @@ public class EndPotions {
}
public static Potion registerPotion(String name, Potion potion) {
return Registry.register(Registry.POTION, BetterEnd.makeID(name), potion);
return Registry.register(BuiltInRegistries.POTION, BetterEnd.makeID(name), potion);
}
public static void register() {

View file

@ -4,6 +4,7 @@ import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.effects.status.EndVeilEffect;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
@ -37,6 +38,6 @@ public class EndStatusEffects {
public final static MobEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect());
public static <E extends MobEffect> MobEffect registerEffect(String name, E effect) {
return Registry.register(Registry.MOB_EFFECT, BetterEnd.makeID(name), effect);
return Registry.register(BuiltInRegistries.MOB_EFFECT, BetterEnd.makeID(name), effect);
}
}

View file

@ -116,7 +116,7 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
@Override
public SoundEvent getAmbientSound() {
return EndSounds.ENTITY_DRAGONFLY;
return EndSounds.ENTITY_DRAGONFLY.value();
}
@Override

View file

@ -82,17 +82,17 @@ public class ShadowWalkerEntity extends Monster {
@Override
protected SoundEvent getAmbientSound() {
return EndSounds.ENTITY_SHADOW_WALKER;
return EndSounds.ENTITY_SHADOW_WALKER.value();
}
@Override
protected SoundEvent getHurtSound(DamageSource source) {
return EndSounds.ENTITY_SHADOW_WALKER_DAMAGE;
return EndSounds.ENTITY_SHADOW_WALKER_DAMAGE.value();
}
@Override
protected SoundEvent getDeathSound() {
return EndSounds.ENTITY_SHADOW_WALKER_DEATH;
return EndSounds.ENTITY_SHADOW_WALKER_DEATH.value();
}
@Override

View file

@ -9,7 +9,7 @@ import org.betterx.betterend.registry.EndEntities;
import org.betterx.betterend.registry.EndItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceKey;
@ -95,7 +95,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
hivePos = NbtUtils.readBlockPos(tag.getCompound("HivePos"));
ResourceLocation worldID = new ResourceLocation(tag.getString("HiveWorld"));
try {
hiveWorld = level.getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, worldID));
hiveWorld = level.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, worldID));
} catch (Exception e) {
BetterEnd.LOGGER.warning("Silk Moth Hive World {} is missing!", worldID);
hivePos = null;

View file

@ -50,17 +50,17 @@ public class NightshadeRedwoods extends EndBiome.Config {
.feature(BYGFeatures.NIGHTSHADE_MOSS);
if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent()
.get();
SoundEvent music = effects.getBackgroundMusic()
.get()
.getEvent();
SoundEvent additions = effects.getAmbientAdditionsSettings()
.get()
.getSoundEvent();
SoundEvent mood = effects.getAmbientMoodSettings()
.get()
.getSoundEvent();
Holder<SoundEvent> loop = effects.getAmbientLoopSoundEvent()
.get();
Holder<SoundEvent> music = effects.getBackgroundMusic()
.get()
.getEvent();
Holder<SoundEvent> additions = effects.getAmbientAdditionsSettings()
.get()
.getSoundEvent();
Holder<SoundEvent> mood = effects.getAmbientMoodSettings()
.get()
.getSoundEvent();
builder.loop(loop)
.music(music)
.additions(additions)

View file

@ -51,17 +51,17 @@ public class OldBulbisGardens extends EndBiome.Config {
.feature(BYGFeatures.OLD_BULBIS_TREE);
if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent()
.get();
SoundEvent music = effects.getBackgroundMusic()
.get()
.getEvent();
SoundEvent additions = effects.getAmbientAdditionsSettings()
.get()
.getSoundEvent();
SoundEvent mood = effects.getAmbientMoodSettings()
.get()
.getSoundEvent();
Holder<SoundEvent> loop = effects.getAmbientLoopSoundEvent()
.get();
Holder<SoundEvent> music = effects.getBackgroundMusic()
.get()
.getEvent();
Holder<SoundEvent> additions = effects.getAmbientAdditionsSettings()
.get()
.getSoundEvent();
Holder<SoundEvent> mood = effects.getAmbientMoodSettings()
.get()
.getSoundEvent();
builder.loop(loop)
.music(music)
.additions(additions)

View file

@ -100,12 +100,12 @@ public class BYGFeatures {
return BCLFeatureBuilder
.start(id, feature)
.configuration(config)
.buildAndRegister()
.build()
.place()
.countMax(density)
.squarePlacement()
.heightmap()
.onlyInBiome()
.buildAndRegister();
.build();
}
}

View file

@ -7,7 +7,6 @@ import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.integration.Integrations;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
@ -17,6 +16,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.base.Function;
import org.joml.Vector3f;
import java.util.List;

View file

@ -14,7 +14,6 @@ import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.integration.Integrations;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -29,6 +28,7 @@ import net.minecraft.world.level.material.Material;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;

View file

@ -13,7 +13,6 @@ import org.betterx.betterend.integration.Integrations;
import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
@ -26,6 +25,7 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -1,19 +1,18 @@
package org.betterx.betterend.integration.emi;
import org.betterx.ui.layout.components.render.RenderHelper;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.renderer.GameRenderer;
import dev.emi.emi.EmiClient;
import dev.emi.emi.EmiConfig;
import dev.emi.emi.EmiRenderHelper;
import dev.emi.emi.api.render.EmiRender;
import dev.emi.emi.api.stack.EmiIngredient;
import dev.emi.emi.api.widget.Bounds;
import dev.emi.emi.api.widget.SlotWidget;
import dev.emi.emi.config.EmiConfig;
import org.wunder.lib.ui.layout.components.render.RenderHelper;
public class TransparentSlotWidget extends SlotWidget {

View file

@ -1,88 +1,75 @@
package org.betterx.betterend.integration.trinkets;
import org.betterx.bclib.items.elytra.BCLElytraItem;
import org.betterx.bclib.items.elytra.BCLElytraUtils;
import net.minecraft.util.Tuple;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
import dev.emi.trinkets.api.SlotReference;
import dev.emi.trinkets.api.TrinketComponent;
import dev.emi.trinkets.api.TrinketsApi;
import java.util.List;
import java.util.Optional;
public class Elytra {
private static boolean isElytra(ItemStack stack) {
return stack.getItem() instanceof ElytraItem
|| stack.getItem() instanceof FabricElytraItem;
}
public static void register() {
BCLElytraUtils.slotProvider = (entity, slotGetter) -> {
ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST);
if (isElytra(itemStack)) return itemStack;
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra);
if (!equipped.isEmpty()) return equipped.get(0).getB();
}
return null;
};
BCLElytraUtils.onBreak = (entity, chestStack) -> {
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra);
for (Tuple<SlotReference, ItemStack> slot : equipped) {
ItemStack slotStack = slot.getB();
if (slotStack == chestStack) {
TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity);
}
}
}
};
EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket);
}
private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) {
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra);
for (Tuple<SlotReference, ItemStack> slot : equipped) {
ItemStack stack = slot.getB();
Item item = stack.getItem();
if (item instanceof ElytraItem) {
if (ElytraItem.isFlyEnabled(stack)) {
BCLElytraItem.vanillaElytraTick(entity, stack);
return true;
}
} else if (item instanceof FabricElytraItem fabricElytraItem) {
if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) {
return true;
}
}
}
}
return false;
}
}
//import dev.emi.trinkets.api.SlotReference;
//import dev.emi.trinkets.api.TrinketComponent;
//import dev.emi.trinkets.api.TrinketsApi;
//
//import java.util.List;
//import java.util.Optional;
//
//public class Elytra {
// private static boolean isElytra(ItemStack stack) {
// return stack.getItem() instanceof ElytraItem
// || stack.getItem() instanceof FabricElytraItem;
// }
//
// public static void register() {
// BCLElytraUtils.slotProvider = (entity, slotGetter) -> {
// ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST);
// if (isElytra(itemStack)) return itemStack;
//
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
// if (oTrinketComponent.isPresent()) {
// List<Tuple<SlotReference, ItemStack>> equipped =
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
// if (!equipped.isEmpty()) return equipped.get(0).getB();
// }
// return null;
// };
//
// BCLElytraUtils.onBreak = (entity, chestStack) -> {
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
// if (oTrinketComponent.isPresent()) {
// List<Tuple<SlotReference, ItemStack>> equipped =
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
// for (Tuple<SlotReference, ItemStack> slot : equipped) {
// ItemStack slotStack = slot.getB();
// if (slotStack == chestStack) {
// TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity);
// }
// }
// }
// };
//
// EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket);
// }
//
// private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) {
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
// if (oTrinketComponent.isPresent()) {
// List<Tuple<SlotReference, ItemStack>> equipped =
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
// for (Tuple<SlotReference, ItemStack> slot : equipped) {
// ItemStack stack = slot.getB();
// Item item = stack.getItem();
//
// if (item instanceof ElytraItem) {
// if (ElytraItem.isFlyEnabled(stack)) {
// BCLElytraItem.vanillaElytraTick(entity, stack);
// return true;
// }
// } else if (item instanceof FabricElytraItem fabricElytraItem) {
// if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) {
// return true;
// }
// }
// }
// }
// return false;
// }
//}

View file

@ -1,22 +1,22 @@
package org.betterx.betterend.integration.trinkets;
import net.minecraft.world.item.ElytraItem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
import dev.emi.trinkets.api.TrinketsApi;
@Environment(EnvType.CLIENT)
public class ElytraClient {
public static void register() {
LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi
.getTrinketComponent(player)
.map(trinketComponent -> trinketComponent.getEquipped(
stack -> stack.getItem() instanceof ElytraItem ||
stack.getItem() instanceof FabricElytraItem
).size() == 0).orElse(true));
}
}
//import net.minecraft.world.item.ElytraItem;
//
//import net.fabricmc.api.EnvType;
//import net.fabricmc.api.Environment;
//import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
//import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
//
//import dev.emi.trinkets.api.TrinketsApi;
//
//@Environment(EnvType.CLIENT)
//public class ElytraClient {
// public static void register() {
// LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi
// .getTrinketComponent(player)
// .map(trinketComponent -> trinketComponent.getEquipped(
// stack -> stack.getItem() instanceof ElytraItem ||
// stack.getItem() instanceof FabricElytraItem
// ).size() == 0).orElse(true));
// }
//}

View file

@ -5,7 +5,7 @@ import org.betterx.bclib.items.ModelProviderItem;
import org.betterx.betterend.registry.EndItems;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -31,7 +31,7 @@ public class EnchantedItem extends ModelProviderItem {
@Override
@Environment(EnvType.CLIENT)
public BlockModel getItemModel(ResourceLocation resourceLocation) {
ResourceLocation sourceId = Registry.ITEM.getKey(source);
ResourceLocation sourceId = BuiltInRegistries.ITEM.getKey(source);
return ModelsHelper.createItemModel(sourceId);
}
}

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.util.LangUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
@ -17,8 +16,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import vazkii.patchouli.api.PatchouliAPI;
import java.util.List;
public class GuideBookItem extends ModelProviderItem {
@ -34,10 +31,11 @@ public class GuideBookItem extends ModelProviderItem {
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
if (!world.isClientSide && user instanceof ServerPlayer) {
PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
return InteractionResultHolder.success(user.getItemInHand(hand));
}
//TODO: 1.19.3 Re-Enable once patchouli is available
// if (!world.isClientSide && user instanceof ServerPlayer) {
// PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
// return InteractionResultHolder.success(user.getItemInHand(hand));
// }
return InteractionResultHolder.consume(user.getItemInHand(hand));
}

View file

@ -91,8 +91,10 @@ public abstract class MusicTrackerMixin {
}
private boolean be_shouldChangeSound(Music musicSound) {
//TODO: 1.19.3 do we need this?
return currentMusic != null && !musicSound
.getEvent()
.value()
.getLocation()
.equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
}

View file

@ -2,7 +2,7 @@ package org.betterx.betterend.mixin.common;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.util.RandomSource;
import net.minecraft.world.Container;
import net.minecraft.world.inventory.*;
@ -122,7 +122,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
if (list != null && !list.isEmpty()) {
EnchantmentInstance enchantmentLevelEntry = list.get(this.random.nextInt(
list.size()));
enchantClue[j] = Registry.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment);
enchantClue[j] = BuiltInRegistries.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment);
levelClue[j] = enchantmentLevelEntry.level;
}
}

View file

@ -1,50 +0,0 @@
package org.betterx.betterend.mixin.common;
import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MappedRegistry.class)
public class MappedRegistryMixin<T> {
// TODO Make this a part of BCLib (implement froze/unfroze methods)
@Inject(method = "validateWrite", at = @At("HEAD"), cancellable = true)
private void be_validateWrite(ResourceKey<T> resourceKey, CallbackInfo info) {
//info.cancel();
}
// @Inject(method = "registerMapping(ILnet/minecraft/resources/ResourceKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Lnet/minecraft/core/Holder;", at = @At("HEAD"))
// private void be_debugDummy(
// int i,
// ResourceKey<T> resourceKey,
// T object,
// Lifecycle lifecycle,
// boolean bl,
// CallbackInfoReturnable<Holder<T>> cir
// ) {
// if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
// System.out.println("Promenade registers: " + resourceKey);
// }
// }
//
// @Inject(method = "getOrCreateHolderOrThrow", at = @At("HEAD"))
// private void be_debugDummy2(
// ResourceKey<T> resourceKey, CallbackInfoReturnable<Holder<T>> cir
// ) {
// if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
// System.out.println("Promenade registers: " + resourceKey);
// }
// }
//
// @Inject(method = "getOrCreateHolder", at = @At("HEAD"))
// private void be_debugDummy3(
// ResourceKey<T> resourceKey, CallbackInfoReturnable<Holder<T>> cir
// ) {
// if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
// System.out.println("Promenade registers: " + resourceKey);
// }
// }
}

View file

@ -15,7 +15,6 @@ import net.minecraft.server.players.PlayerList;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.ProfilePublicKey;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.portal.PortalInfo;
@ -31,7 +30,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
@Mixin(ServerPlayer.class)
public abstract class ServerPlayerMixin extends Player implements TeleportingEntity {
@ -55,14 +53,8 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
private BlockPos exitPos;
private int be_teleportDelay = 0;
public ServerPlayerMixin(
Level level,
BlockPos blockPos,
float f,
GameProfile gameProfile,
@Nullable ProfilePublicKey profilePublicKey
) {
super(level, blockPos, f, gameProfile, profilePublicKey);
public ServerPlayerMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile) {
super(level, blockPos, f, gameProfile);
}
@ -96,6 +88,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
ServerLevel serverWorld = getLevel();
LevelData worldProperties = destination.getLevelData();
ServerPlayer player = ServerPlayer.class.cast(this);
connection.send(new ClientboundRespawnPacket(
destination.dimensionTypeId(),
destination.dimension(),
@ -104,7 +97,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
gameMode.getPreviousGameModeForPlayer(),
destination.isDebug(),
destination.isFlat(),
true,
(byte) 1,
Optional.empty()
));
connection.send(new ClientboundChangeDifficultyPacket(

View file

@ -8,10 +8,9 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.serialization.Codec;
import net.minecraft.commands.arguments.item.ItemInput;
import net.minecraft.commands.arguments.item.ItemParser;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.item.ItemStack;
@ -31,8 +30,9 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
StringReader stringReader
) throws CommandSyntaxException {
stringReader.expect(' ');
//TODO: 1.19.3 check if this is the correct way to gte the HolderLookup, or if PaintedMountainPiece is correct
ItemParser.ItemResult itemResult = ItemParser.parseForItem(
HolderLookup.forRegistry(Registry.ITEM),
BuiltInRegistries.ITEM.asLookup(),
stringReader
);
ItemStack itemStack = new ItemInput(itemResult.item(), itemResult.nbt()).createItemStack(1, false);
@ -79,7 +79,7 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
@Override
public String writeToString() {
return Registry.PARTICLE_TYPE.getKey(this).toString();
return BuiltInRegistries.PARTICLE_TYPE.getKey(this).toString();
}
@Override

View file

@ -4,6 +4,7 @@ import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.item.EndAttribute;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
@ -12,7 +13,7 @@ public class EndAttributes {
public static Attribute registerAttribute(String name, double value, boolean syncable) {
return Registry.register(
Registry.ATTRIBUTE,
BuiltInRegistries.ATTRIBUTE,
BetterEnd.makeID(name),
new EndAttribute("attribute.name." + name, value).setSyncable(syncable)
);

View file

@ -87,7 +87,7 @@ public class EndBiomes {
CAVE_BIOMES = new BiomePicker(registry);
registry.stream()
.filter(biome -> registry.getResourceKey(biome).isPresent())
.map(biome -> registry.getOrCreateHolderOrThrow(registry.getResourceKey(biome).get()))
.map(biome -> registry.getHolderOrThrow(registry.getResourceKey(biome).get()))
.map(biome -> biome.unwrapKey().orElseThrow().location())
.filter(id -> BiomeAPI.wasRegisteredAs(id, END_CAVE))
.map(id -> BiomeAPI.getBiome(id))
@ -112,12 +112,7 @@ public class EndBiomes {
* @return registered {@link EndBiome}
*/
public static EndBiome registerSubBiome(EndBiome.Config biomeConfig, EndBiome parent) {
final EndBiome biome = EndBiome.create(biomeConfig);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BiomeAPI.registerSubBiome(parent, biome);
}
return biome;
return EndBiome.createSubBiome(biomeConfig, parent);
}
/**
@ -129,14 +124,7 @@ public class EndBiomes {
*/
public static EndBiome registerBiome(EndBiome.Config biomeConfig, BiomeType type) {
final EndBiome biome = EndBiome.create(biomeConfig);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
if (type == BiomeType.LAND) {
BiomeAPI.registerEndLandBiome(biome);
} else {
BiomeAPI.registerEndVoidBiome(biome);
}
ALL_BE_BIOMES.add(biome);
}
ALL_BE_BIOMES.add(biome);
return biome;
}
@ -147,11 +135,8 @@ public class EndBiomes {
* @return registered {@link EndBiome}
*/
public static EndBiome registerSubBiomeIntegration(EndBiome.Config biomeConfig) {
EndBiome biome = EndBiome.create(biomeConfig);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BiomeAPI.registerBuiltinBiomeAndOverrideIntendedDimension(biome, BiomeAPI.BiomeType.END);
}
return biome;
//TODO: 1.19.3 this was don on runtime, but biomes are now created in DataGen, so we need a fix...
return EndBiome.create(biomeConfig);
}
/**
@ -163,19 +148,14 @@ public class EndBiomes {
public static void addSubBiomeIntegration(EndBiome biome, ResourceLocation parent) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BCLBiome parentBiome = BiomeAPI.getBiome(parent);
if (parentBiome != null && !parentBiome.containsSubBiome(biome)) {
if (parentBiome != null && biome.getParentBiome().getID().equals(biome.getID())) {
parentBiome.addSubBiome(biome);
}
}
}
public static EndCaveBiome registerCaveBiome(EndCaveBiome.Config biomeConfig) {
final EndCaveBiome biome = EndCaveBiome.create(biomeConfig);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BiomeAPI.registerBuiltinBiomeAndOverrideIntendedDimension(biome, END_CAVE);
//ALL_BE_BIOMES.add(biome);
}
return biome;
return EndCaveBiome.create(biomeConfig);
}
public static BiomePicker.ActualBiome getCaveBiome(int x, int z) {

View file

@ -6,6 +6,7 @@ import org.betterx.betterend.blocks.basis.PedestalBlock;
import org.betterx.betterend.blocks.entities.*;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
@ -38,7 +39,7 @@ public class EndBlockEntities {
String id,
FabricBlockEntityTypeBuilder<T> builder
) {
return Registry.register(Registry.BLOCK_ENTITY_TYPE, BetterEnd.makeID(id), builder.build(null));
return Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, BetterEnd.makeID(id), builder.build(null));
//return Registry.register(Registry.BLOCK_ENTITY_TYPE, BetterEnd.makeID(id), builder.build(null));
}

View file

@ -5,6 +5,7 @@ import org.betterx.betterend.config.Configs;
import org.betterx.betterend.effects.enchantment.EndVeilEnchantment;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.enchantment.Enchantment;
public class EndEnchantments {
@ -14,7 +15,7 @@ public class EndEnchantments {
if (!Configs.ENCHANTMENT_CONFIG.getBooleanRoot(name, true)) {
return enchantment;
}
return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment);
return Registry.register(BuiltInRegistries.ENCHANTMENT, BetterEnd.makeID(name), enchantment);
}
public static void register() {

View file

@ -8,6 +8,7 @@ import org.betterx.betterend.entity.*;
import org.betterx.ui.ColorUtil;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.EntityType.EntityFactory;
@ -123,7 +124,7 @@ public class EndEntities {
.dimensions(EntityDimensions.fixed(width, height))
.build();
if (Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true)) {
return Registry.register(Registry.ENTITY_TYPE, id, type);
return Registry.register(BuiltInRegistries.ENTITY_TYPE, id, type);
}
return type;
}
@ -148,7 +149,7 @@ public class EndEntities {
.build();
FabricDefaultAttributeRegistry.register(type, attributes);
EndItems.registerEndEgg("spawn_egg_" + name, type, eggColor, dotsColor);
Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), type);
Registry.register(BuiltInRegistries.ENTITY_TYPE, BetterEnd.makeID(name), type);
return new BCLEntityWrapper<>(type, Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true));
}

View file

@ -22,10 +22,11 @@ import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeat
import org.betterx.betterend.world.features.terrain.caves.RoundCaveFeature;
import org.betterx.betterend.world.features.terrain.caves.TunelCaveFeature;
import org.betterx.betterend.world.features.trees.*;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
@ -786,10 +787,10 @@ public class EndFeatures {
BetterEnd.makeID("overworld_island"),
inlineBuild("overworld_island", new BiomeIslandFeature())
)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.RAW_GENERATION)
.buildAndRegister();
.build();
public static final BCLFeature<SinglePlantFeature, SinglePlantFeatureConfig> FLAMAEA = registerVegetation(
"flamaea",
new SinglePlantFeatureConfig(EndBlocks.FLAMAEA, 12, false, 5),
@ -848,13 +849,13 @@ public class EndFeatures {
BetterEnd.makeID("sulphuric_cave"),
inlineBuild("sulphuric_cave", new SulphuricCaveFeature())
)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.RAW_GENERATION)
.count(2)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
public static final IceStarFeature ICE_STAR_FEATURE = inlineBuild("ice_star", new IceStarFeature());
public static final BCLFeature<IceStarFeature, IceStarFeatureConfig> ICE_STAR = registerRawGen(
@ -898,12 +899,12 @@ public class EndFeatures {
.start(
BetterEnd.makeID("tunel_cave"),
inlineBuild("tunel_cave", new TunelCaveFeature())
).buildAndRegister()
).build()
.place()
.decoration(Decoration.RAW_GENERATION)
.count(1)
.onlyInBiome()
.buildAndRegister();
.build();
public static final BCLFeature<ArchFeature, ArchFeatureConfig> UMBRALITH_ARCH = registerChanced(
"umbralith_arch",
ARCH_FEATURE, new ArchFeatureConfig(
@ -983,46 +984,46 @@ public class EndFeatures {
BetterEnd.makeID("smaragdant_crystal"),
inlineBuild("smaragdant_crystal", new SmaragdantCrystalFeature())
)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> SMARAGDANT_CRYSTAL_SHARD = BCLFeatureBuilder
.start(BetterEnd.makeID("smaragdant_crystal_shard"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.SMARAGDANT_CRYSTAL_SHARD)))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<BigAuroraCrystalFeature, NoneFeatureConfiguration> BIG_AURORA_CRYSTAL = BCLFeatureBuilder
.start(
BetterEnd.makeID("big_aurora_crystal"),
inlineBuild("big_aurora_crystal", new BigAuroraCrystalFeature())
)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<BushFeature, BushFeatureConfig> CAVE_BUSH = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_bush"), BUSH_FEATURE)
.configuration(new BushFeatureConfig(EndBlocks.CAVE_BUSH, EndBlocks.CAVE_BUSH))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> CAVE_GRASS = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_grass"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.CAVE_GRASS)))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> RUBINEA = BCLFeatureBuilder
.start(BetterEnd.makeID("rubinea"), VINE_FEATURE)
.configuration(new VineFeatureConfig(EndBlocks.RUBINEA, 8))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> MAGNULA = BCLFeatureBuilder
.start(BetterEnd.makeID("magnula"), VINE_FEATURE)
.configuration(new VineFeatureConfig(EndBlocks.MAGNULA, 8))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(true, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(false, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(
@ -1031,7 +1032,7 @@ public class EndFeatures {
Blocks.END_STONE,
EndBlocks.CAVE_MOSS
))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(
@ -1039,20 +1040,20 @@ public class EndFeatures {
EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
EndBlocks.CAVE_MOSS
))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<CavePumpkinFeature, NoneFeatureConfiguration> CAVE_PUMPKIN = BCLFeatureBuilder
.start(
BetterEnd.makeID("cave_pumpkin"),
inlineBuild("cave_pumpkin", new CavePumpkinFeature())
)
.buildAndRegister();
.build();
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_not_glowing_grasslands"))
.add(EndBlocks.CREEPING_MOSS, 10)
.add(EndBlocks.UMBRELLA_MOSS, 10)
.inlinePlace().build();
.inlinePlace().build().placedFeature;
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_glowing_grasslands"))
@ -1063,7 +1064,7 @@ public class EndFeatures {
.add(EndBlocks.FRACTURN, 100)
.add(EndBlocks.SALTEAGO, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 10)
.inlinePlace().build();
.inlinePlace().build().placedFeature;
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_END_MOSS = BCLFeatureBuilder
.start(
@ -1075,7 +1076,7 @@ public class EndFeatures {
BONEMEAL_END_MOSS_GLOWING_GRASSLANDS,
BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS
))
.buildAndRegister();
.build();
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_not_lantern_woods"))
@ -1084,7 +1085,7 @@ public class EndFeatures {
.add(EndBlocks.LUTEBUS, 20)
.add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace()
.build();
.build().placedFeature;
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_lantern_woods"))
@ -1092,7 +1093,7 @@ public class EndFeatures {
.add(EndBlocks.BOLUX_MUSHROOM, 5)
.add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace()
.build();
.build().placedFeature;
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_RUTISCUS = BCLFeatureBuilder
.start(
@ -1104,78 +1105,83 @@ public class EndFeatures {
BONEMEAL_RUTISCUS_LANTERN_WOODS,
BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS
))
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_END_MYCELIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_mycelium"))
.add(EndBlocks.CREEPING_MOSS, 100)
.add(EndBlocks.UMBRELLA_MOSS, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_JUNGLE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_jungle_moss"))
.add(EndBlocks.JUNGLE_GRASS, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 100)
.add(EndBlocks.SMALL_JELLYSHROOM, 10)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SANGNUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_sangnum"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_DRAGON_BONE = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_dragon_bone"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_OBSIDIAN = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_obsidian"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CAVE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_cave_moss"))
.add(EndBlocks.CAVE_GRASS, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CHORUS_NYLIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_chorus_nylium"))
.add(EndBlocks.CHORUS_GRASS, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CRYSTAL_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_crystal_moss"))
.add(EndBlocks.CRYSTAL_GRASS, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SHADOW_GRASS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_shadow_grass"))
.add(EndBlocks.SHADOW_PLANT, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_PINK_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_pink_moss"))
.add(EndBlocks.BUSHY_GRASS, 100)
.buildAndRegister();
.build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_AMBER_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_amber_moss"))
.add(EndBlocks.AMBER_GRASS, 100)
.buildAndRegister();
.build();
public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) {
ResourceLocation l = BetterEnd.makeID(name);
if (Registry.FEATURE.containsKey(l)) {
return (F) Registry.FEATURE.get(l);
if (WorldBootstrap.getLastRegistryAccess() != null) {
Registry<Feature<?>> features = WorldBootstrap.getLastRegistryAccess().registryOrThrow(Registries.FEATURE);
if (features.containsKey(l)) {
return (F) features.get(l);
}
}
return BCLFeature.register(l, feature);
}
@ -1212,11 +1218,11 @@ public class EndFeatures {
ResourceLocation id = BetterEnd.makeID(name);
return BCLFeatureBuilder.start(id, feature)
.configuration(config)
.buildAndRegister()
.build()
.place()
.onEveryLayerMax(density)
.onlyInBiome()
.buildAndRegister();
.build();
}
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerRawGen(
@ -1236,13 +1242,13 @@ public class EndFeatures {
return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.configuration(config)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.RAW_GENERATION)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
}
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerLake(
@ -1252,13 +1258,13 @@ public class EndFeatures {
) {
return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.LAKES)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
}
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerChanced(
@ -1279,13 +1285,13 @@ public class EndFeatures {
BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.configuration(config)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
}
private static BCLFeature<OreFeature, OreConfiguration> registerOre(
@ -1299,14 +1305,14 @@ public class EndFeatures {
.add(Blocks.END_STONE, blockOre)
.veinSize(veinSize)
.discardChanceOnAirExposure(0)
.buildAndRegister()
.build()
.place()
.decoration(Decoration.UNDERGROUND_ORES)
.count(veins)
.randomHeight8FromFloorCeil()
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
}
private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer(
@ -1321,11 +1327,11 @@ public class EndFeatures {
return BCLFeatureBuilder
.start(BetterEnd.makeID(name), layer)
.configuration(new OreLayerFeatureConfig(block.defaultBlockState(), radius, minY, maxY))
.buildAndRegister()
.build()
.place()
.decoration(GenerationStep.Decoration.UNDERGROUND_ORES)
.count(count)
.buildAndRegister();
.build();
}
private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer(
@ -1380,8 +1386,12 @@ public class EndFeatures {
private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(String ns, String nm) {
ResourceLocation id = new ResourceLocation(ns, nm + "_structures");
if (BuiltinRegistries.PLACED_FEATURE.containsKey(id)) {
BCLib.LOGGER.info("Feature for " + id + " was already build");
if (WorldBootstrap.getLastRegistryAccess() != null) {
Registry<PlacedFeature> features = WorldBootstrap.getLastRegistryAccess()
.registryOrThrow(Registries.PLACED_FEATURE);
if (features.containsKey(id)) {
BCLib.LOGGER.info("Feature for " + id + " was already build");
}
}
String path = "/data/" + ns + "/structures/biome/" + nm + "/";
@ -1409,13 +1419,13 @@ public class EndFeatures {
list,
Blocks.END_STONE.defaultBlockState()
))
.buildAndRegister()
.build()
.place()
.decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(10)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
.build();
}
}
}

View file

@ -17,6 +17,7 @@ import org.betterx.betterend.item.tool.EndHammerItem;
import org.betterx.betterend.item.tool.EndPickaxe;
import org.betterx.betterend.tab.CreativeTabs;
import net.minecraft.core.Holder;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
@ -279,7 +280,10 @@ public class EndItems {
"bucket_end_fish",
new EndBucketItem(EndEntities.END_FISH.type())
);
public final static Item BUCKET_CUBOZOA = registerEndItem("bucket_cubozoa", new EndBucketItem(EndEntities.CUBOZOA.type()));
public final static Item BUCKET_CUBOZOA = registerEndItem(
"bucket_cubozoa",
new EndBucketItem(EndEntities.CUBOZOA.type())
);
public final static Item SWEET_BERRY_JELLY = registerEndFood("sweet_berry_jelly", 8, 0.7F);
public final static Item SHADOW_BERRY_JELLY = registerEndFood(
"shadow_berry_jelly",
@ -302,8 +306,8 @@ public class EndItems {
return BaseRegistry.getModItems(BetterEnd.MOD_ID);
}
public static Item registerEndDisc(String name, int power, SoundEvent sound, int lengthInSeconds) {
return getItemRegistry().registerDisc(BetterEnd.makeID(name), power, sound, lengthInSeconds);
public static Item registerEndDisc(String name, int power, Holder<SoundEvent> sound, int lengthInSeconds) {
return getItemRegistry().registerDisc(BetterEnd.makeID(name), power, sound.value(), lengthInSeconds);
}
public static Item registerEndItem(String name) {

View file

@ -5,6 +5,7 @@ import org.betterx.betterend.blocks.EndStoneSmelter;
import org.betterx.betterend.client.gui.EndStoneSmelterMenu;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
@ -23,7 +24,7 @@ public class EndMenuTypes {
BiFunction<Integer, Inventory, T> factory
) {
MenuType<T> type = new MenuType<>((syncId, inventory) -> factory.apply(syncId, inventory));
return Registry.register(Registry.MENU, id, type);
return Registry.register(BuiltInRegistries.MENU, id, type);
}
public final static void ensureStaticallyLoaded() {

View file

@ -2,48 +2,54 @@ package org.betterx.betterend.registry;
import org.betterx.betterend.BetterEnd;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
public class EndSounds {
// Music
public static final SoundEvent MUSIC_FOREST = register("music", "forest");
public static final SoundEvent MUSIC_WATER = register("music", "water");
public static final SoundEvent MUSIC_DARK = register("music", "dark");
public static final SoundEvent MUSIC_OPENSPACE = register("music", "openspace");
public static final SoundEvent MUSIC_CAVES = register("music", "caves");
public static final Holder<SoundEvent> MUSIC_FOREST = register("music", "forest");
public static final Holder<SoundEvent> MUSIC_WATER = register("music", "water");
public static final Holder<SoundEvent> MUSIC_DARK = register("music", "dark");
public static final Holder<SoundEvent> MUSIC_OPENSPACE = register("music", "openspace");
public static final Holder<SoundEvent> MUSIC_CAVES = register("music", "caves");
// Ambient
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
public static final SoundEvent AMBIENT_CHORUS_FOREST = register("ambient", "chorus_forest");
public static final SoundEvent AMBIENT_MEGALAKE = register("ambient", "megalake");
public static final SoundEvent AMBIENT_DUST_WASTELANDS = register("ambient", "dust_wastelands");
public static final SoundEvent AMBIENT_MEGALAKE_GROVE = register("ambient", "megalake_grove");
public static final SoundEvent AMBIENT_BLOSSOMING_SPIRES = register("ambient", "blossoming_spires");
public static final SoundEvent AMBIENT_SULPHUR_SPRINGS = register("ambient", "sulphur_springs");
public static final SoundEvent AMBIENT_UMBRELLA_JUNGLE = register("ambient", "umbrella_jungle");
public static final SoundEvent AMBIENT_GLOWING_GRASSLANDS = register("ambient", "glowing_grasslands");
public static final SoundEvent AMBIENT_CAVES = register("ambient", "caves");
public static final SoundEvent AMBIENT_AMBER_LAND = register("ambient", "amber_land");
public static final SoundEvent UMBRA_VALLEY = register("ambient", "umbra_valley");
public static final Holder<SoundEvent> AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
public static final Holder<SoundEvent> AMBIENT_CHORUS_FOREST = register("ambient", "chorus_forest");
public static final Holder<SoundEvent> AMBIENT_MEGALAKE = register("ambient", "megalake");
public static final Holder<SoundEvent> AMBIENT_DUST_WASTELANDS = register("ambient", "dust_wastelands");
public static final Holder<SoundEvent> AMBIENT_MEGALAKE_GROVE = register("ambient", "megalake_grove");
public static final Holder<SoundEvent> AMBIENT_BLOSSOMING_SPIRES = register("ambient", "blossoming_spires");
public static final Holder<SoundEvent> AMBIENT_SULPHUR_SPRINGS = register("ambient", "sulphur_springs");
public static final Holder<SoundEvent> AMBIENT_UMBRELLA_JUNGLE = register("ambient", "umbrella_jungle");
public static final Holder<SoundEvent> AMBIENT_GLOWING_GRASSLANDS = register("ambient", "glowing_grasslands");
public static final Holder<SoundEvent> AMBIENT_CAVES = register("ambient", "caves");
public static final Holder<SoundEvent> AMBIENT_AMBER_LAND = register("ambient", "amber_land");
public static final Holder<SoundEvent> UMBRA_VALLEY = register("ambient", "umbra_valley");
// Entity
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");
public static final SoundEvent ENTITY_SHADOW_WALKER = register("entity", "shadow_walker");
public static final SoundEvent ENTITY_SHADOW_WALKER_DAMAGE = register("entity", "shadow_walker_damage");
public static final SoundEvent ENTITY_SHADOW_WALKER_DEATH = register("entity", "shadow_walker_death");
public static final Holder<SoundEvent> ENTITY_DRAGONFLY = register("entity", "dragonfly");
public static final Holder<SoundEvent> ENTITY_SHADOW_WALKER = register("entity", "shadow_walker");
public static final Holder<SoundEvent> ENTITY_SHADOW_WALKER_DAMAGE = register("entity", "shadow_walker_damage");
public static final Holder<SoundEvent> ENTITY_SHADOW_WALKER_DEATH = register("entity", "shadow_walker_death");
// Records
public static final SoundEvent RECORD_STRANGE_AND_ALIEN = register("record", "strange_and_alien");
public static final SoundEvent RECORD_GRASPING_AT_STARS = register("record", "grasping_at_stars");
public static final SoundEvent RECORD_ENDSEEKER = register("record", "endseeker");
public static final SoundEvent RECORD_EO_DRACONA = register("record", "eo_dracona");
public static final Holder<SoundEvent> RECORD_STRANGE_AND_ALIEN = register("record", "strange_and_alien");
public static final Holder<SoundEvent> RECORD_GRASPING_AT_STARS = register("record", "grasping_at_stars");
public static final Holder<SoundEvent> RECORD_ENDSEEKER = register("record", "endseeker");
public static final Holder<SoundEvent> RECORD_EO_DRACONA = register("record", "eo_dracona");
public static void register() {
}
private static SoundEvent register(String type, String id) {
id = "betterend." + type + "." + id;
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(BetterEnd.makeID(id)));
private static Holder<SoundEvent> register(String type, String id) {
ResourceLocation loc = BetterEnd.makeID("betterend." + type + "." + id);
return Registry.registerForHolder(
BuiltInRegistries.SOUND_EVENT,
loc, SoundEvent.createVariableRangeEvent(loc)
);
}
}

View file

@ -9,6 +9,7 @@ import org.betterx.worlds.together.tag.v3.TagManager;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
@ -68,7 +69,7 @@ public class EndStructures {
}
private static StructurePieceType register(String id, StructurePieceType pieceType) {
return Registry.register(Registry.STRUCTURE_PIECE, BetterEnd.makeID(id), pieceType);
return Registry.register(BuiltInRegistries.STRUCTURE_PIECE, BetterEnd.makeID(id), pieceType);
}
public static void addBiomeStructures(ResourceLocation biomeID, Holder<Biome> biome) {

View file

@ -10,6 +10,7 @@ import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.registry.EndPoiTypes;
import org.betterx.betterend.registry.EndPortals;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -17,6 +18,8 @@ import net.minecraft.core.Registry;
import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
@ -189,7 +192,7 @@ public class EternalRitual {
private void activatePortal(Item keyItem) {
if (active) return;
ResourceLocation itemId = Registry.ITEM.getKey(keyItem);
ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(keyItem);
int portalId = EndPortals.getPortalIdByItem(itemId);
Level targetWorld = getTargetWorld(portalId);
ResourceLocation worldId = targetWorld.dimension().location();
@ -404,7 +407,7 @@ public class EternalRitual {
ServerLevel targetWorld = (ServerLevel) getTargetWorld(portalId);
Registry<DimensionType> registry = Objects.requireNonNull(server)
.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
.registryOrThrow(Registries.DIMENSION_TYPE);
double multiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
BlockPos.MutableBlockPos basePos = center.mutable()
.set(
@ -461,12 +464,15 @@ public class EternalRitual {
}
}
if (targetWorld.dimension() == Level.END) {
net.minecraft.data.worldgen.features.EndFeatures.END_ISLAND.value().place(
targetWorld,
targetWorld.getChunkSource().getGenerator(),
new LegacyRandomSource(basePos.asLong()),
basePos.below()
);
WorldBootstrap.getLastRegistryAccess()
.registryOrThrow(Registries.CONFIGURED_FEATURE)
.get(net.minecraft.data.worldgen.features.EndFeatures.END_ISLAND)
.place(
targetWorld,
targetWorld.getChunkSource().getGenerator(),
new LegacyRandomSource(basePos.asLong()),
basePos.below()
);
} else if (targetWorld.dimension() == Level.OVERWORLD) {
basePos.setY(targetWorld.getChunk(basePos)
.getHeight(Heightmap.Types.WORLD_SURFACE, basePos.getX(), basePos.getZ()) + 1);

View file

@ -7,7 +7,7 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import java.util.stream.Collectors;
@ -16,21 +16,21 @@ public class CreativeTabs {
public static final CreativeModeTab TAB_ITEMS;
static {
TAB_BLOCKS = FabricItemGroupBuilder
.create(BetterEnd.makeID("end_blocks"))
TAB_BLOCKS = FabricItemGroup
.builder(BetterEnd.makeID("end_blocks"))
.icon(() -> new ItemStack(EndBlocks.END_MYCELIUM))
.appendItems(stacks -> stacks.addAll(EndBlocks.getModBlockItems()
.stream()
.map(ItemStack::new)
.collect(Collectors.toList())))
.displayItems((featureFlagSet, output, bl) -> output.acceptAll(EndBlocks.getModBlockItems()
.stream()
.map(ItemStack::new)
.collect(Collectors.toList())))
.build();
TAB_ITEMS = FabricItemGroupBuilder
.create(BetterEnd.makeID("end_items"))
TAB_ITEMS = FabricItemGroup
.builder(BetterEnd.makeID("end_items"))
.icon(() -> new ItemStack(EndItems.ETERNAL_CRYSTAL))
.appendItems(stacks -> stacks.addAll(EndItems.getModItems()
.stream()
.map(ItemStack::new)
.collect(Collectors.toList())))
.displayItems((featureFlagSet, output, bl) -> output.acceptAll(EndItems.getModItems()
.stream()
.map(ItemStack::new)
.collect(Collectors.toList())))
.build();
}
}

View file

@ -12,6 +12,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Blocks;
@ -30,7 +31,7 @@ public class BlockFixer {
public static void fixBlocks(LevelAccessor level, BlockPos start, BlockPos end) {
final Registry<DimensionType> registry = level.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
.registryOrThrow(Registries.DIMENSION_TYPE);
final ResourceLocation dimKey = registry.getKey(level.dimensionType());
if (dimKey != null && "world_blender".equals(dimKey.getNamespace())) {
return;

View file

@ -7,7 +7,6 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
import org.betterx.bclib.util.WeightedList;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures;
@ -18,6 +17,7 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.data.worldgen.placement.EndPlacements;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.KeyDispatchDataCodec;
@ -59,7 +59,6 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface
@ -74,7 +73,6 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType
);
this.hasCaves = hasCaves;
@ -171,21 +169,30 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
}
public EndBiome(ResourceLocation biomeID, Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public EndBiome(ResourceKey<Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
}
public static EndBiome create(Config biomeConfig) {
return create(biomeConfig, null);
}
public static EndBiome createSubBiome(Config data, BCLBiome parentBiome) {
return create(data, parentBiome);
}
private static EndBiome create(Config biomeConfig, BCLBiome parentBiome) {
BCLBiomeBuilder builder = BCLBiomeBuilder
.start(biomeConfig.ID)
.music(SoundEvents.MUSIC_END)
.waterColor(4159204)
.waterFogColor(329011)
.fogColor(0xA080A0)
.skyColor(0)
.waterColor(BCLBiomeBuilder.DEFAULT_END_WATER_COLOR)
.waterFogColor(BCLBiomeBuilder.DEFAULT_END_WATER_FOG_COLOR)
.fogColor(BCLBiomeBuilder.DEFAULT_END_FOG_COLOR)
.skyColor(BCLBiomeBuilder.DEFAULT_END_SKY_COLOR)
.mood(EndSounds.AMBIENT_DUST_WASTELANDS)
.temperature(0.5f)
.wetness(0.5f)
.temperature(BCLBiomeBuilder.DEFAULT_END_TEMPERATURE)
.wetness(BCLBiomeBuilder.DEFAULT_END_WETNESS)
.parentBiome(parentBiome)
.precipitation(Biome.Precipitation.NONE)
.surface(biomeConfig.surfaceMaterial().surface().build())
.endLandBiome();
@ -197,7 +204,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
builder.feature(GenerationStep.Decoration.SURFACE_STRUCTURES, EndPlacements.END_GATEWAY_RETURN);
}
EndBiome biome = builder.build(biomeConfig.getSupplier());
EndBiome biome = builder.build(biomeConfig.getSupplier()).biome();
biome.setHasCaves(biomeConfig.hasCaves());
biome.setSurfaceMaterial(biomeConfig.surfaceMaterial());

View file

@ -12,6 +12,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate;
@ -25,8 +26,8 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
public static final KeyDispatchDataCodec<EmptyAuroraCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL.configuredFeature, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
@ -47,7 +48,6 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -64,7 +64,6 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -11,6 +11,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate;
@ -24,8 +25,8 @@ public class EmptyEndCaveBiome extends EndCaveBiome.Config {
public static final KeyDispatchDataCodec<EmptyEndCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE.configuredFeature, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
@ -46,7 +47,6 @@ public class EmptyEndCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -63,7 +63,6 @@ public class EmptyEndCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -12,6 +12,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate;
@ -26,8 +27,8 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
public static final KeyDispatchDataCodec<EmptySmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
@ -50,7 +51,6 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -67,7 +67,6 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -16,11 +16,12 @@ import org.betterx.betterend.world.biome.EndBiome;
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeature;
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeatureConfig;
import com.mojang.datafixers.util.Function15;
import com.mojang.datafixers.util.Function14;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.util.RandomSource;
@ -36,7 +37,7 @@ import java.util.Optional;
public class EndCaveBiome extends EndBiome {
public static final Codec<EndCaveBiome> CODEC = simpleCaveBiomeCodec(EndCaveBiome::new);
public static <T extends EndCaveBiome> Codec<T> simpleCaveBiomeCodec(Function15<Float, Float, Float, Integer, Boolean, Optional<ResourceLocation>, ResourceLocation, Optional<List<Climate.ParameterPoint>>, Optional<ResourceLocation>, Optional<WeightedList<ResourceLocation>>, Optional<String>, Boolean, SurfaceMaterialProvider, WeightedList<Holder<ConfiguredFeature<?, ?>>>, WeightedList<Holder<ConfiguredFeature<?, ?>>>, T> builder) {
public static <T extends EndCaveBiome> Codec<T> simpleCaveBiomeCodec(Function14<Float, Float, Float, Integer, Boolean, Optional<ResourceLocation>, ResourceLocation, Optional<List<Climate.ParameterPoint>>, Optional<ResourceLocation>, Optional<String>, Boolean, SurfaceMaterialProvider, WeightedList<Holder<ConfiguredFeature<?, ?>>>, WeightedList<Holder<ConfiguredFeature<?, ?>>>, T> builder) {
return RecordCodecBuilder.create(instance ->
codecWithSettings(
instance,
@ -71,7 +72,6 @@ public class EndCaveBiome extends EndBiome {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -88,7 +88,6 @@ public class EndCaveBiome extends EndBiome {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface
@ -104,19 +103,19 @@ public class EndCaveBiome extends EndBiome {
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.type(EndBiomes.END_CAVE);
BCLFeature<CaveChunkPopulatorFeature, CaveChunkPopulatorFeatureConfig> feature = BCLFeatureBuilder
.start(
BetterEnd.makeID(ID.getPath() + "_cave_populator"),
EndFeatures.CAVE_CHUNK_POPULATOR
)
.configuration(new CaveChunkPopulatorFeatureConfig(ID))
.buildAndRegister()
.build()
.place()
.decoration(GenerationStep.Decoration.UNDERGROUND_DECORATION)
.count(1)
.onlyInBiome()
.buildAndRegister();
.build();
builder.feature(feature)
.intendedType(EndBiomes.END_CAVE)
@ -143,8 +142,8 @@ public class EndCaveBiome extends EndBiome {
private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> floorFeatures = new WeightedList<>();
private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> ceilFeatures = new WeightedList<>();
public EndCaveBiome(ResourceLocation biomeID, Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public EndCaveBiome(ResourceKey<Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
}
public void addFloorFeature(Holder<? extends ConfiguredFeature<?, ?>> feature, float weight) {

View file

@ -13,6 +13,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.util.Mth;
@ -33,8 +34,8 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
private static final BlockState[] JADE = new BlockState[3];
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
JADE[0] = EndBlocks.VIRID_JADESTONE.stone.defaultBlockState();
JADE[1] = EndBlocks.AZURE_JADESTONE.stone.defaultBlockState();
@ -56,7 +57,6 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -73,7 +73,6 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -15,6 +15,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate;
@ -29,8 +30,8 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
public static final KeyDispatchDataCodec<LushAuroraCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.CAVE_BUSH.configuredFeature, 5);
@ -59,7 +60,6 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -76,7 +76,6 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -13,6 +13,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate;
@ -28,8 +29,8 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
public static final KeyDispatchDataCodec<LushSmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
@ -52,7 +53,6 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType,
boolean hasCaves,
SurfaceMaterialProvider surface,
@ -69,7 +69,6 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
biomeID,
parameterPoints,
biomeParent,
subbiomes,
intendedType,
hasCaves,
surface,

View file

@ -5,13 +5,12 @@ import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.api.v2.levelgen.structures.templatesystem.DestructionStructureProcessor;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.*;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.resources.ResourceLocation;
@ -20,6 +19,7 @@ import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
@ -214,10 +214,13 @@ public abstract class NBTFeature<FC extends NBTFeatureConfig> extends Feature<FC
}
private static StructureTemplate readStructureFromStream(InputStream stream) throws IOException {
final HolderLookup<Block> blockLookup = WorldBootstrap.getLastRegistryAccess()
.lookup(Registries.BLOCK)
.orElseThrow();
CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
StructureTemplate template = new StructureTemplate();
template.load(nbttagcompound);
template.load(blockLookup, nbttagcompound);
return template;
}

View file

@ -9,7 +9,6 @@ import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
@ -17,6 +16,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class BigAuroraCrystalFeature extends DefaultFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {

View file

@ -11,7 +11,6 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
@ -21,6 +20,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class FallenPillarFeature extends DefaultFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {

View file

@ -16,7 +16,7 @@ import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.util.BlockFixer;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -111,7 +111,7 @@ public class GeyserFeature extends DefaultFeature {
bowl = new SDFSubtraction().setSourceA(bowl).setSourceB(cut);
bowl = new SDFTranslate().setTranslate(radius, py - radius, 0).setSource(bowl);
bowl = new SDFRotation().setRotation(Vector3f.YP, i * 4F).setSource(bowl);
bowl = new SDFRotation().setRotation(Axis.YP, i * 4F).setSource(bowl);
sdf = new SDFUnion().setSourceA(sdf).setSourceB(bowl);
}
sdf.setReplaceFunction(REPLACE2).fillRecursive(world, pos);

View file

@ -8,7 +8,6 @@ import org.betterx.bclib.sdf.primitive.SDFCappedCone;
import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
@ -16,6 +15,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import org.joml.Vector3f;
import java.util.ArrayList;
import java.util.List;
@ -44,12 +45,12 @@ public class IceStarFeature extends Feature<IceStarFeatureConfig> {
for (Vector3f point : points) {
SDF rotated = spike;
point = MHelper.normalize(point);
float angle = MHelper.angle(Vector3f.YP, point);
float angle = MHelper.angle(MHelper.YP, point);
if (angle > 0.01F && angle < 3.14F) {
Vector3f axis = MHelper.normalize(MHelper.cross(Vector3f.YP, point));
Vector3f axis = MHelper.normalize(MHelper.cross(MHelper.YP, point));
rotated = new SDFRotation().setRotation(axis, angle).setSource(spike);
} else if (angle > 1) {
rotated = new SDFRotation().setRotation(Vector3f.YP, (float) Math.PI).setSource(spike);
rotated = new SDFRotation().setRotation(MHelper.YP, (float) Math.PI).setSource(spike);
}
sdf = (sdf == null) ? rotated : new SDFUnion().setSourceA(sdf).setSourceB(rotated);
}

View file

@ -13,7 +13,6 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
@ -23,6 +22,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class ObsidianPillarBasementFeature extends DefaultFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {

View file

@ -11,7 +11,7 @@ import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
@ -61,7 +61,7 @@ public class ThinArchFeature extends Feature<ThinArchFeatureConfig> {
.setSmallRadius(smallRadius)
.setBlock(block);
float angle = (i - count * 0.5F) * 0.3F + random.nextFloat() * 0.05F + (float) Math.PI * 0.5F;
arch = new SDFRotation().setRotation(Vector3f.XP, angle).setSource(arch);
arch = new SDFRotation().setRotation(Axis.XP, angle).setSource(arch);
sdf = sdf == null ? arch : new SDFUnion().setSourceA(sdf).setSourceB(arch);
}

View file

@ -12,7 +12,6 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -26,6 +25,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -9,7 +9,6 @@ import org.betterx.bclib.util.MHelper;
import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -24,6 +23,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -10,7 +10,7 @@ import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.blocks.HelixTreeLeavesBlock;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.tags.BlockTags;
@ -22,6 +22,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.phys.AABB;
import org.joml.Vector3f;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
@ -53,7 +55,7 @@ public class HelixTreeFeature extends DefaultFeature {
SDF sdf = SplineHelper.buildSDF(spline, 1.7F, 0.5F, (p) -> {
return EndBlocks.HELIX_TREE.getBark().defaultBlockState();
});
SDF rotated = new SDFRotation().setRotation(Vector3f.YP, (float) Math.PI).setSource(sdf);
SDF rotated = new SDFRotation().setRotation(Axis.YP, (float) Math.PI).setSource(sdf);
sdf = new SDFUnion().setSourceA(rotated).setSourceB(sdf);
Vector3f lastPoint = spline.get(spline.size() - 1);

View file

@ -10,7 +10,6 @@ import org.betterx.betterend.blocks.JellyshroomCapBlock;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
@ -22,6 +21,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -14,7 +14,6 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -27,6 +26,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -14,7 +14,6 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -28,6 +27,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -14,7 +14,6 @@ import org.betterx.betterend.blocks.basis.FurBlock;
import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
@ -24,6 +23,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -14,7 +14,6 @@ import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -26,6 +25,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -13,7 +13,6 @@ import org.betterx.betterend.blocks.basis.FurBlock;
import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -27,6 +26,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -12,7 +12,6 @@ import org.betterx.betterend.blocks.UmbrellaTreeMembraneBlock;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -26,6 +25,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;

View file

@ -6,7 +6,7 @@ import org.betterx.bclib.api.v2.generator.BiomeDecider;
import org.betterx.bclib.api.v2.generator.config.BCLEndBiomeSourceConfig;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import net.minecraft.core.Registry;
import net.minecraft.core.HolderGetter;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSource;
@ -15,7 +15,7 @@ public class EndLandBiomeDecider extends BiomeDecider {
this(null);
}
protected EndLandBiomeDecider(Registry<Biome> biomeRegistry) {
protected EndLandBiomeDecider(HolderGetter<Biome> biomeRegistry) {
super(biomeRegistry, (biome) -> false);
}

View file

@ -114,14 +114,14 @@ public class TerrainGenerator {
if (biomeSource == null) {
return 0;
}
if (getBiome(biomeSource, x, z).getTerrainHeight() < 0.1F) {
if (getBiome(biomeSource, x, z).settings.getTerrainHeight() < 0.1F) {
return 0F;
}
float depth = 0F;
for (int i = 0; i < OFFS.length; i++) {
int px = x + OFFS[i].x;
int pz = z + OFFS[i].y;
depth += getBiome(biomeSource, px, pz).getTerrainHeight() * COEF[i];
depth += getBiome(biomeSource, px, pz).settings.getTerrainHeight() * COEF[i];
}
return depth;
}

View file

@ -10,7 +10,7 @@ import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndStructures;
import org.betterx.betterend.world.structures.piece.VoxelPiece;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.ChunkPos;
@ -20,6 +20,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.structure.StructureType;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
import org.joml.Vector3f;
import java.util.ArrayList;
import java.util.List;
@ -51,12 +53,12 @@ public class GiantIceStarStructure extends SDFStructureFeature {
for (Vector3f point : points) {
SDF rotated = spike;
point = MHelper.normalize(point);
float angle = MHelper.angle(Vector3f.YP, point);
float angle = MHelper.angle(MHelper.YP, point);
if (angle > 0.01F && angle < 3.14F) {
Vector3f axis = MHelper.normalize(MHelper.cross(Vector3f.YP, point));
Vector3f axis = MHelper.normalize(MHelper.cross(MHelper.YP, point));
rotated = new SDFRotation().setRotation(axis, angle).setSource(spike);
} else if (angle > 1) {
rotated = new SDFRotation().setRotation(Vector3f.YP, (float) Math.PI).setSource(spike);
rotated = new SDFRotation().setRotation(Axis.YP, (float) Math.PI).setSource(spike);
}
sdf = (sdf == null) ? rotated : new SDFUnion().setSourceA(sdf).setSourceB(rotated);
}

View file

@ -14,13 +14,14 @@ import org.betterx.betterend.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndStructures;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.levelgen.structure.StructureType;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
import org.joml.Vector3f;
import java.util.List;
public class GiantMossyGlowshroomStructure extends SDFStructureFeature {

View file

@ -7,10 +7,13 @@ import org.betterx.betterend.world.structures.piece.PaintedMountainPiece;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
@ -50,6 +53,7 @@ public class PaintedMountainStructure extends FeatureBaseStructure {
for (int i = 0; i < count; i++) {
slices[i] = VARIANTS[random.nextInt(VARIANTS.length)];
}
HolderLookup<Block> blockHolderLookup = context.registryAccess().lookup(Registries.BLOCK).orElseThrow();
structurePiecesBuilder.addPiece(new PaintedMountainPiece(
new BlockPos(x, y, z),
radius,

View file

@ -3,10 +3,13 @@ package org.betterx.betterend.world.structures.piece;
import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.registry.EndStructures;
import org.betterx.betterend.util.GlobalState;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
@ -15,6 +18,7 @@ import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
@ -55,10 +59,14 @@ public class PaintedMountainPiece extends MountainPiece {
@Override
protected void fromNbt(CompoundTag tag) {
super.fromNbt(tag);
//TODO: 1.19.3 check if this is the correct way to gte the HolderLookup
final HolderLookup<Block> blockLookup = WorldBootstrap.getLastRegistryAccess()
.lookup(Registries.BLOCK)
.orElseThrow();
ListTag slise = tag.getList("slises", 10);
slices = new BlockState[slise.size()];
for (int i = 0; i < slices.length; i++) {
slices[i] = NbtUtils.readBlockState(slise.getCompound(i));
slices[i] = NbtUtils.readBlockState(blockLookup, slise.getCompound(i));
}
}

View file

@ -5,7 +5,7 @@ import org.betterx.bclib.mixin.common.SurfaceRulesContextAccessor;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.Noises;
import net.minecraft.world.level.levelgen.synth.NormalNoise;
@ -20,7 +20,7 @@ public class VerticalBandNoiseCondition implements NumericProvider {
);
public static final Codec<VerticalBandNoiseCondition> CODEC = RecordCodecBuilder.create(instance -> instance
.group(
ResourceKey.codec(Registry.NOISE_REGISTRY).fieldOf("noise").forGetter(o -> o.noise),
ResourceKey.codec(Registries.NOISE).fieldOf("noise").forGetter(o -> o.noise),
Codec.DOUBLE.fieldOf("offset_scale").orElse(4.0).forGetter(o -> o.offsetScale),
Codec.DOUBLE.fieldOf("band_scale").orElse(4.0).forGetter(o -> o.bandScale),
Codec.DOUBLE.fieldOf("xz_scale").orElse(6.0).forGetter(o -> o.xzScale),

View file

@ -1,38 +1,37 @@
{
"required": true,
"minVersion": "0.8",
"package": "org.betterx.betterend.mixin.common",
"compatibilityLevel": "JAVA_17",
"mixins": [
"BlockBehaviourMixin",
"ChorusFlowerBlockMixin",
"ChorusPlantBlockMixin",
"ChorusPlantFeatureMixin",
"CraftingMenuMixin",
"EndCityFeatureMixin",
"EndDragonFightMixin",
"EnderManMixin",
"EndPodiumFeatureMixin",
"EndSpikeMixin",
"EntityMixin",
"LevelMixin",
"LivingEntityMixin",
"MappedRegistryMixin",
"MonsterMixin",
"NoiseBasedChunkGeneratorAccessor",
"NoiseChunkAccessor",
"NoiseChunkMixin",
"NoiseGeneratorSettingsMixin",
"NoiseInterpolatorAccessor",
"PlayerAdvancementsMixin",
"PlayerMixin",
"ServerLevelMixin",
"ServerPlayerMixin",
"SlimeMixin",
"SpikeFeatureMixin",
"WorldGenRegionMixin"
],
"injectors": {
"defaultRequire": 1
}
"required": true,
"minVersion": "0.8",
"package": "org.betterx.betterend.mixin.common",
"compatibilityLevel": "JAVA_17",
"mixins": [
"BlockBehaviourMixin",
"ChorusFlowerBlockMixin",
"ChorusPlantBlockMixin",
"ChorusPlantFeatureMixin",
"CraftingMenuMixin",
"EndCityFeatureMixin",
"EndDragonFightMixin",
"EnderManMixin",
"EndPodiumFeatureMixin",
"EndSpikeMixin",
"EntityMixin",
"LevelMixin",
"LivingEntityMixin",
"MonsterMixin",
"NoiseBasedChunkGeneratorAccessor",
"NoiseChunkAccessor",
"NoiseChunkMixin",
"NoiseGeneratorSettingsMixin",
"NoiseInterpolatorAccessor",
"PlayerAdvancementsMixin",
"PlayerMixin",
"ServerLevelMixin",
"ServerPlayerMixin",
"SlimeMixin",
"SpikeFeatureMixin",
"WorldGenRegionMixin"
],
"injectors": {
"defaultRequire": 1
}
}