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

@ -60,7 +60,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi "vazkii.patchouli:Patchouli:${project.patchouli_version}" //1.19.3 modApi "vazkii.patchouli:Patchouli:${project.patchouli_version}"
println "Using local BCLib: ${local_bclib}" println "Using local BCLib: ${local_bclib}"
if (local_bclib) { if (local_bclib) {
implementation(project(path: ":BCLib", configuration: 'dev')) implementation(project(path: ":BCLib", configuration: 'dev'))
@ -70,15 +70,9 @@ dependencies {
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}" modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
// compile against the JEI API but do not include it at runtime
modCompileOnlyApi "mezz.jei:jei-1.19-common-api:${project.jei_version}"
modCompileOnlyApi "mezz.jei:jei-1.19-fabric-api:${project.jei_version}"
// at runtime, use the full JEI jar for Fabric
//modRuntimeOnly "mezz.jei:jei-${project.minecraft_version}-fabric:${project.jei_version}"
//needed for trinkets, otherwise BetterEnd would require users to install trinkets //needed for trinkets, otherwise BetterEnd would require users to install trinkets
modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" //1.19.3 modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}"
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" //1.19.3 modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
modCompileOnly "dev.emi:emi:${emi_version}" modCompileOnly "dev.emi:emi:${emi_version}"
//modRuntimeOnly "dev.emi:emi:${emi_version}" //modRuntimeOnly "dev.emi:emi:${emi_version}"
} }

View file

@ -81,7 +81,8 @@ public class BetterEnd implements ModInitializer {
} }
}); });
if (RUNS_TRINKETS) { 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.item.ItemStack;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; 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.Block;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -38,7 +39,7 @@ public class BoluxMushroomBlock extends EndPlantBlock {
@Override @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; return false;
} }

View file

@ -8,6 +8,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; 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.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
@ -43,7 +44,7 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements AddMine
} }
@Override @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; return false;
} }

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -34,7 +33,7 @@ public class BulbVineBlock extends BaseVineBlock {
} }
@Override @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; 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.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
@ -68,7 +69,7 @@ public class CrystalMossCoverBlock extends MultifaceBlock implements Bonemealabl
@Override @Override
public boolean isValidBonemealTarget( public boolean isValidBonemealTarget(
BlockGetter blockGetter, LevelReader blockGetter,
BlockPos blockPos, BlockPos blockPos,
BlockState blockState, BlockState blockState,
boolean bl boolean bl

View file

@ -114,7 +114,7 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock implements AddMineable
} }
@Override @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; return false;
} }

View file

@ -3,7 +3,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.blocks.basis.PedestalBlock; 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.resources.ResourceLocation;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -19,7 +19,7 @@ public class EndPedestal extends PedestalBlock {
@Override @Override
protected Map<String, String> createTexturesMap() { protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent); ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath(); String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap(); Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", BetterEnd.MOD_ID); 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.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -151,7 +152,7 @@ public class EndPortalBlock extends NetherPortalBlock implements RenderLayerProv
) { ) {
if (targetWorld == null) return null; if (targetWorld == null) return null;
Registry<DimensionType> registry = targetWorld.registryAccess() Registry<DimensionType> registry = targetWorld.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); .registryOrThrow(Registries.DIMENSION_TYPE);
ResourceLocation targetWorldId = targetWorld.dimension().location(); ResourceLocation targetWorldId = targetWorld.dimension().location();
ResourceLocation currentWorldId = currentWorld.dimension().location(); ResourceLocation currentWorldId = currentWorld.dimension().location();
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale(); 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.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; 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)); world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, false).setValue(HAS_LIGHT, false));
} else { } else {
ItemStack itemStack = pedestal.getItem(0); ItemStack itemStack = pedestal.getItem(0);
ResourceLocation id = Registry.ITEM.getKey(itemStack.getItem()); ResourceLocation id = BuiltInRegistries.ITEM.getKey(itemStack.getItem());
if (EndPortals.isAvailableItem(id)) { if (EndPortals.isAvailableItem(id)) {
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true)); world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true));
if (pedestal.hasRitual()) { if (pedestal.hasRitual()) {

View file

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

View file

@ -62,7 +62,7 @@ public class HydraluxBlock extends UnderwaterPlantBlock implements AddMineableSh
} }
@Override @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; return false;
} }

View file

@ -59,7 +59,7 @@ public class LargeAmaranitaBlock extends EndPlantBlock implements AddMineableShe
} }
@Override @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; return false;
} }

View file

@ -2,7 +2,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PedestalBlock; 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.resources.ResourceLocation;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -17,7 +17,7 @@ public class PedestalVanilla extends PedestalBlock {
@Override @Override
protected Map<String, String> createTexturesMap() { protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent); ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath().replace("_block", ""); String name = blockId.getPath().replace("_block", "");
return new HashMap<String, String>() { return new HashMap<String, String>() {
private static final long serialVersionUID = 1L; 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.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; 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.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -40,7 +41,7 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements AddMine
} }
@Override @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; return false;
} }

View file

@ -92,7 +92,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
} }
@Override @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()) return state.getValue(FACING) == Direction.UP && world.getBlockState(pos.below())
.is(CommonBlockTags.END_STONES); .is(CommonBlockTags.END_STONES);
} }

View file

@ -12,8 +12,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i; import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@ -57,7 +57,7 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements CustomColorPro
} }
@Override @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; 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;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
@ -433,7 +433,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
} }
protected Map<String, String> createTexturesMap() { protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent); ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath(); String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap(); Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", blockId.getNamespace()); textures.put("%mod%", blockId.getNamespace());

View file

@ -1,7 +1,5 @@
package org.betterx.betterend.client; 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.BetterEnd;
import org.betterx.betterend.client.render.BetterEndSkyRenderer; import org.betterx.betterend.client.render.BetterEndSkyRenderer;
import org.betterx.betterend.events.ItemTooltipCallback; import org.betterx.betterend.events.ItemTooltipCallback;
@ -33,11 +31,6 @@ public class BetterEndClient implements ClientModInitializer {
ClientOptions.init(); ClientOptions.init();
registerTooltips(); registerTooltips();
if (BCLib.isDevEnvironment()) {
TranslationHelper.printMissingEnNames(BetterEnd.MOD_ID);
TranslationHelper.printMissingNames(BetterEnd.MOD_ID, "ru_ru");
}
ResourceLocation checkFlowerId = new ResourceLocation("item/chorus_flower"); ResourceLocation checkFlowerId = new ResourceLocation("item/chorus_flower");
ResourceLocation checkPlantId = new ResourceLocation("item/chorus_plant"); ResourceLocation checkPlantId = new ResourceLocation("item/chorus_plant");
ResourceLocation toLoadFlowerId = new ResourceLocation("betterend", "item/custom_chorus_flower"); ResourceLocation toLoadFlowerId = new ResourceLocation("betterend", "item/custom_chorus_flower");
@ -58,7 +51,8 @@ public class BetterEndClient implements ClientModInitializer {
} }
if (BetterEnd.RUNS_TRINKETS) { 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(); progress = menu.getSmeltProgress();
blit(matrices, leftPos + 92, topPos + 34, 176, 14, progress + 1, 16); 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.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f; import com.mojang.math.Axis;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
public class BeamRenderer { public class BeamRenderer {
private static final ResourceLocation BEAM_TEXTURE = new ResourceLocation("textures/entity/end_gateway_beam.png"); 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)); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderType.beaconBeam(BEAM_TEXTURE, true));
matrices.pushPose(); matrices.pushPose();
matrices.mulPose(Vector3f.YP.rotation(-rotation)); matrices.mulPose(Axis.YP.rotation(-rotation));
renderBeam( renderBeam(
matrices, matrices,
vertexConsumer, vertexConsumer,

View file

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

View file

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

View file

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

View file

@ -6,6 +6,7 @@ import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.registry.EndBiomes; import org.betterx.betterend.registry.EndBiomes;
import org.betterx.betterend.registry.EndPoiTypes; import org.betterx.betterend.registry.EndPoiTypes;
import org.betterx.betterend.world.biome.EndBiome; import org.betterx.betterend.world.biome.EndBiome;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import com.mojang.brigadier.Command; import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
@ -14,16 +15,16 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Either;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import com.mojang.math.Vector3d;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; 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;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Holder; 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.Component;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
@ -38,6 +39,9 @@ import net.minecraft.world.phys.Vec3;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import com.google.common.base.Stopwatch;
import org.joml.Vector3d;
import java.util.*; import java.util.*;
public class CommandRegistry { public class CommandRegistry {
@ -174,14 +178,14 @@ public class CommandRegistry {
0, 0,
Collections.EMPTY_SET Collections.EMPTY_SET
); );
ResourceOrTagLocationArgument.Result result = new ResourceOrTagLocationArgument.Result() { ResourceOrTagKeyArgument.Result result = new ResourceOrTagKeyArgument.Result() {
@Override @Override
public Either<ResourceKey, TagKey> unwrap() { public Either<ResourceKey, TagKey> unwrap() {
return Either.left(biome.getBiomeKey()); return Either.left(biome.getBiomeKey());
} }
@Override @Override
public Optional<ResourceOrTagLocationArgument.Result> cast(ResourceKey resourceKey) { public Optional<ResourceOrTagKeyArgument.Result> cast(ResourceKey resourceKey) {
return Optional.empty(); return Optional.empty();
} }
@ -196,16 +200,25 @@ public class CommandRegistry {
} }
}; };
ResourceKey<Biome> a = biome.getBiomeKey(); ResourceKey<Biome> a = biome.getBiomeKey();
Holder<Biome> h = BuiltinRegistries.BIOME.getHolder(a).orElseThrow(); 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( return LocateCommand.showLocateResult(
source, source,
result, result,
currentPosition, currentPosition,
new Pair<>(biomePosition, h), new Pair<>(biomePosition, h),
"commands.locatebiome.success", "commands.locatebiome.success",
false 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.config.Configs;
import org.betterx.betterend.registry.EndBlocks; 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.DyeColor;
import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.DyeItem;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
@ -36,7 +36,7 @@ public class ColoredMaterial {
Map<Integer, ItemLike> dyes, Map<Integer, ItemLike> dyes,
boolean craftEight boolean craftEight
) { ) {
String id = Registry.BLOCK.getKey(source).getPath(); String id = BuiltInRegistries.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> { colors.forEach((color, name) -> {
String blockName = id + "_" + name; String blockName = id + "_" + name;
Block block = constructor.apply(FabricBlockSettings.copyOf(source).mapColor(MaterialColor.COLOR_BLACK)); 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 org.betterx.betterend.registry.EndItems;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -21,7 +22,7 @@ public class EndPotions {
} }
public static Potion registerPotion(String name, Potion potion) { 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() { public static void register() {

View file

@ -4,6 +4,7 @@ import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.effects.status.EndVeilEffect; import org.betterx.betterend.effects.status.EndVeilEffect;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects; 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 final static MobEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect());
public static <E extends MobEffect> MobEffect registerEffect(String name, E effect) { 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 @Override
public SoundEvent getAmbientSound() { public SoundEvent getAmbientSound() {
return EndSounds.ENTITY_DRAGONFLY; return EndSounds.ENTITY_DRAGONFLY.value();
} }
@Override @Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,7 +7,6 @@ import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.integration.Integrations; import org.betterx.betterend.integration.Integrations;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; 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 net.minecraft.world.level.material.Material;
import com.google.common.base.Function; import com.google.common.base.Function;
import org.joml.Vector3f;
import java.util.List; 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.betterend.integration.Integrations;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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.base.Function;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; 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.betterend.noise.OpenSimplexNoise;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
@ -26,6 +25,7 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;

View file

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

View file

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

View file

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

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.util.LangUtil;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player; 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.item.TooltipFlag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import vazkii.patchouli.api.PatchouliAPI;
import java.util.List; import java.util.List;
public class GuideBookItem extends ModelProviderItem { public class GuideBookItem extends ModelProviderItem {
@ -34,10 +31,11 @@ public class GuideBookItem extends ModelProviderItem {
@Override @Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
if (!world.isClientSide && user instanceof ServerPlayer) { //TODO: 1.19.3 Re-Enable once patchouli is available
PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID); // if (!world.isClientSide && user instanceof ServerPlayer) {
return InteractionResultHolder.success(user.getItemInHand(hand)); // PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
} // return InteractionResultHolder.success(user.getItemInHand(hand));
// }
return InteractionResultHolder.consume(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) { private boolean be_shouldChangeSound(Music musicSound) {
//TODO: 1.19.3 do we need this?
return currentMusic != null && !musicSound return currentMusic != null && !musicSound
.getEvent() .getEvent()
.value()
.getLocation() .getLocation()
.equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic(); .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 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.util.RandomSource;
import net.minecraft.world.Container; import net.minecraft.world.Container;
import net.minecraft.world.inventory.*; import net.minecraft.world.inventory.*;
@ -122,7 +122,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
EnchantmentInstance enchantmentLevelEntry = list.get(this.random.nextInt( EnchantmentInstance enchantmentLevelEntry = list.get(this.random.nextInt(
list.size())); list.size()));
enchantClue[j] = Registry.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment); enchantClue[j] = BuiltInRegistries.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment);
levelClue[j] = enchantmentLevelEntry.level; 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.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; 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.Level;
import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.portal.PortalInfo; 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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
@Mixin(ServerPlayer.class) @Mixin(ServerPlayer.class)
public abstract class ServerPlayerMixin extends Player implements TeleportingEntity { public abstract class ServerPlayerMixin extends Player implements TeleportingEntity {
@ -55,14 +53,8 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
private BlockPos exitPos; private BlockPos exitPos;
private int be_teleportDelay = 0; private int be_teleportDelay = 0;
public ServerPlayerMixin( public ServerPlayerMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile) {
Level level, super(level, blockPos, f, gameProfile);
BlockPos blockPos,
float f,
GameProfile gameProfile,
@Nullable ProfilePublicKey profilePublicKey
) {
super(level, blockPos, f, gameProfile, profilePublicKey);
} }
@ -96,6 +88,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
ServerLevel serverWorld = getLevel(); ServerLevel serverWorld = getLevel();
LevelData worldProperties = destination.getLevelData(); LevelData worldProperties = destination.getLevelData();
ServerPlayer player = ServerPlayer.class.cast(this); ServerPlayer player = ServerPlayer.class.cast(this);
connection.send(new ClientboundRespawnPacket( connection.send(new ClientboundRespawnPacket(
destination.dimensionTypeId(), destination.dimensionTypeId(),
destination.dimension(), destination.dimension(),
@ -104,7 +97,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
gameMode.getPreviousGameModeForPlayer(), gameMode.getPreviousGameModeForPlayer(),
destination.isDebug(), destination.isDebug(),
destination.isFlat(), destination.isFlat(),
true, (byte) 1,
Optional.empty() Optional.empty()
)); ));
connection.send(new ClientboundChangeDifficultyPacket( connection.send(new ClientboundChangeDifficultyPacket(

View file

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

View file

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

View file

@ -87,7 +87,7 @@ public class EndBiomes {
CAVE_BIOMES = new BiomePicker(registry); CAVE_BIOMES = new BiomePicker(registry);
registry.stream() registry.stream()
.filter(biome -> registry.getResourceKey(biome).isPresent()) .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()) .map(biome -> biome.unwrapKey().orElseThrow().location())
.filter(id -> BiomeAPI.wasRegisteredAs(id, END_CAVE)) .filter(id -> BiomeAPI.wasRegisteredAs(id, END_CAVE))
.map(id -> BiomeAPI.getBiome(id)) .map(id -> BiomeAPI.getBiome(id))
@ -112,12 +112,7 @@ public class EndBiomes {
* @return registered {@link EndBiome} * @return registered {@link EndBiome}
*/ */
public static EndBiome registerSubBiome(EndBiome.Config biomeConfig, EndBiome parent) { public static EndBiome registerSubBiome(EndBiome.Config biomeConfig, EndBiome parent) {
final EndBiome biome = EndBiome.create(biomeConfig); return EndBiome.createSubBiome(biomeConfig, parent);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BiomeAPI.registerSubBiome(parent, biome);
}
return biome;
} }
/** /**
@ -129,14 +124,7 @@ public class EndBiomes {
*/ */
public static EndBiome registerBiome(EndBiome.Config biomeConfig, BiomeType type) { public static EndBiome registerBiome(EndBiome.Config biomeConfig, BiomeType type) {
final EndBiome biome = EndBiome.create(biomeConfig); 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; return biome;
} }
@ -147,11 +135,8 @@ public class EndBiomes {
* @return registered {@link EndBiome} * @return registered {@link EndBiome}
*/ */
public static EndBiome registerSubBiomeIntegration(EndBiome.Config biomeConfig) { public static EndBiome registerSubBiomeIntegration(EndBiome.Config biomeConfig) {
EndBiome biome = EndBiome.create(biomeConfig); //TODO: 1.19.3 this was don on runtime, but biomes are now created in DataGen, so we need a fix...
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) { return EndBiome.create(biomeConfig);
BiomeAPI.registerBuiltinBiomeAndOverrideIntendedDimension(biome, BiomeAPI.BiomeType.END);
}
return biome;
} }
/** /**
@ -163,19 +148,14 @@ public class EndBiomes {
public static void addSubBiomeIntegration(EndBiome biome, ResourceLocation parent) { public static void addSubBiomeIntegration(EndBiome biome, ResourceLocation parent) {
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) { if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BCLBiome parentBiome = BiomeAPI.getBiome(parent); BCLBiome parentBiome = BiomeAPI.getBiome(parent);
if (parentBiome != null && !parentBiome.containsSubBiome(biome)) { if (parentBiome != null && biome.getParentBiome().getID().equals(biome.getID())) {
parentBiome.addSubBiome(biome); parentBiome.addSubBiome(biome);
} }
} }
} }
public static EndCaveBiome registerCaveBiome(EndCaveBiome.Config biomeConfig) { public static EndCaveBiome registerCaveBiome(EndCaveBiome.Config biomeConfig) {
final EndCaveBiome biome = EndCaveBiome.create(biomeConfig); return EndCaveBiome.create(biomeConfig);
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
BiomeAPI.registerBuiltinBiomeAndOverrideIntendedDimension(biome, END_CAVE);
//ALL_BE_BIOMES.add(biome);
}
return biome;
} }
public static BiomePicker.ActualBiome getCaveBiome(int x, int z) { 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 org.betterx.betterend.blocks.entities.*;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
@ -38,7 +39,7 @@ public class EndBlockEntities {
String id, String id,
FabricBlockEntityTypeBuilder<T> builder 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)); //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 org.betterx.betterend.effects.enchantment.EndVeilEnchantment;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantment;
public class EndEnchantments { public class EndEnchantments {
@ -14,7 +15,7 @@ public class EndEnchantments {
if (!Configs.ENCHANTMENT_CONFIG.getBooleanRoot(name, true)) { if (!Configs.ENCHANTMENT_CONFIG.getBooleanRoot(name, true)) {
return enchantment; return enchantment;
} }
return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment); return Registry.register(BuiltInRegistries.ENCHANTMENT, BetterEnd.makeID(name), enchantment);
} }
public static void register() { public static void register() {

View file

@ -8,6 +8,7 @@ import org.betterx.betterend.entity.*;
import org.betterx.ui.ColorUtil; import org.betterx.ui.ColorUtil;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.*; import net.minecraft.world.entity.*;
import net.minecraft.world.entity.EntityType.EntityFactory; import net.minecraft.world.entity.EntityType.EntityFactory;
@ -123,7 +124,7 @@ public class EndEntities {
.dimensions(EntityDimensions.fixed(width, height)) .dimensions(EntityDimensions.fixed(width, height))
.build(); .build();
if (Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true)) { 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; return type;
} }
@ -148,7 +149,7 @@ public class EndEntities {
.build(); .build();
FabricDefaultAttributeRegistry.register(type, attributes); FabricDefaultAttributeRegistry.register(type, attributes);
EndItems.registerEndEgg("spawn_egg_" + name, type, eggColor, dotsColor); 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)); 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.RoundCaveFeature;
import org.betterx.betterend.world.features.terrain.caves.TunelCaveFeature; import org.betterx.betterend.world.features.terrain.caves.TunelCaveFeature;
import org.betterx.betterend.world.features.trees.*; import org.betterx.betterend.world.features.trees.*;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries; import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -786,10 +787,10 @@ public class EndFeatures {
BetterEnd.makeID("overworld_island"), BetterEnd.makeID("overworld_island"),
inlineBuild("overworld_island", new BiomeIslandFeature()) inlineBuild("overworld_island", new BiomeIslandFeature())
) )
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.RAW_GENERATION) .decoration(Decoration.RAW_GENERATION)
.buildAndRegister(); .build();
public static final BCLFeature<SinglePlantFeature, SinglePlantFeatureConfig> FLAMAEA = registerVegetation( public static final BCLFeature<SinglePlantFeature, SinglePlantFeatureConfig> FLAMAEA = registerVegetation(
"flamaea", "flamaea",
new SinglePlantFeatureConfig(EndBlocks.FLAMAEA, 12, false, 5), new SinglePlantFeatureConfig(EndBlocks.FLAMAEA, 12, false, 5),
@ -848,13 +849,13 @@ public class EndFeatures {
BetterEnd.makeID("sulphuric_cave"), BetterEnd.makeID("sulphuric_cave"),
inlineBuild("sulphuric_cave", new SulphuricCaveFeature()) inlineBuild("sulphuric_cave", new SulphuricCaveFeature())
) )
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.RAW_GENERATION) .decoration(Decoration.RAW_GENERATION)
.count(2) .count(2)
.squarePlacement() .squarePlacement()
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
public static final IceStarFeature ICE_STAR_FEATURE = inlineBuild("ice_star", new IceStarFeature()); public static final IceStarFeature ICE_STAR_FEATURE = inlineBuild("ice_star", new IceStarFeature());
public static final BCLFeature<IceStarFeature, IceStarFeatureConfig> ICE_STAR = registerRawGen( public static final BCLFeature<IceStarFeature, IceStarFeatureConfig> ICE_STAR = registerRawGen(
@ -898,12 +899,12 @@ public class EndFeatures {
.start( .start(
BetterEnd.makeID("tunel_cave"), BetterEnd.makeID("tunel_cave"),
inlineBuild("tunel_cave", new TunelCaveFeature()) inlineBuild("tunel_cave", new TunelCaveFeature())
).buildAndRegister() ).build()
.place() .place()
.decoration(Decoration.RAW_GENERATION) .decoration(Decoration.RAW_GENERATION)
.count(1) .count(1)
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
public static final BCLFeature<ArchFeature, ArchFeatureConfig> UMBRALITH_ARCH = registerChanced( public static final BCLFeature<ArchFeature, ArchFeatureConfig> UMBRALITH_ARCH = registerChanced(
"umbralith_arch", "umbralith_arch",
ARCH_FEATURE, new ArchFeatureConfig( ARCH_FEATURE, new ArchFeatureConfig(
@ -983,46 +984,46 @@ public class EndFeatures {
BetterEnd.makeID("smaragdant_crystal"), BetterEnd.makeID("smaragdant_crystal"),
inlineBuild("smaragdant_crystal", new SmaragdantCrystalFeature()) inlineBuild("smaragdant_crystal", new SmaragdantCrystalFeature())
) )
.buildAndRegister(); .build();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> SMARAGDANT_CRYSTAL_SHARD = BCLFeatureBuilder public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> SMARAGDANT_CRYSTAL_SHARD = BCLFeatureBuilder
.start(BetterEnd.makeID("smaragdant_crystal_shard"), SINGLE_BLOCK_FEATURE) .start(BetterEnd.makeID("smaragdant_crystal_shard"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.SMARAGDANT_CRYSTAL_SHARD))) .configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.SMARAGDANT_CRYSTAL_SHARD)))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<BigAuroraCrystalFeature, NoneFeatureConfiguration> BIG_AURORA_CRYSTAL = BCLFeatureBuilder public static final BCLConfigureFeature<BigAuroraCrystalFeature, NoneFeatureConfiguration> BIG_AURORA_CRYSTAL = BCLFeatureBuilder
.start( .start(
BetterEnd.makeID("big_aurora_crystal"), BetterEnd.makeID("big_aurora_crystal"),
inlineBuild("big_aurora_crystal", new BigAuroraCrystalFeature()) inlineBuild("big_aurora_crystal", new BigAuroraCrystalFeature())
) )
.buildAndRegister(); .build();
public static final BCLConfigureFeature<BushFeature, BushFeatureConfig> CAVE_BUSH = BCLFeatureBuilder public static final BCLConfigureFeature<BushFeature, BushFeatureConfig> CAVE_BUSH = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_bush"), BUSH_FEATURE) .start(BetterEnd.makeID("cave_bush"), BUSH_FEATURE)
.configuration(new BushFeatureConfig(EndBlocks.CAVE_BUSH, EndBlocks.CAVE_BUSH)) .configuration(new BushFeatureConfig(EndBlocks.CAVE_BUSH, EndBlocks.CAVE_BUSH))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> CAVE_GRASS = BCLFeatureBuilder public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> CAVE_GRASS = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_grass"), SINGLE_BLOCK_FEATURE) .start(BetterEnd.makeID("cave_grass"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.CAVE_GRASS))) .configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.CAVE_GRASS)))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> RUBINEA = BCLFeatureBuilder public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> RUBINEA = BCLFeatureBuilder
.start(BetterEnd.makeID("rubinea"), VINE_FEATURE) .start(BetterEnd.makeID("rubinea"), VINE_FEATURE)
.configuration(new VineFeatureConfig(EndBlocks.RUBINEA, 8)) .configuration(new VineFeatureConfig(EndBlocks.RUBINEA, 8))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> MAGNULA = BCLFeatureBuilder public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> MAGNULA = BCLFeatureBuilder
.start(BetterEnd.makeID("magnula"), VINE_FEATURE) .start(BetterEnd.makeID("magnula"), VINE_FEATURE)
.configuration(new VineFeatureConfig(EndBlocks.MAGNULA, 8)) .configuration(new VineFeatureConfig(EndBlocks.MAGNULA, 8))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE = BCLFeatureBuilder public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite"), STALACTITE_FEATURE) .start(BetterEnd.makeID("end_stone_stalactite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(true, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE)) .configuration(new StalactiteFeatureConfig(true, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE = BCLFeatureBuilder public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite"), STALACTITE_FEATURE) .start(BetterEnd.makeID("end_stone_stalagmite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(false, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE)) .configuration(new StalactiteFeatureConfig(false, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE_CAVEMOSS = BCLFeatureBuilder public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite_cavemoss"), STALACTITE_FEATURE) .start(BetterEnd.makeID("end_stone_stalactite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig( .configuration(new StalactiteFeatureConfig(
@ -1031,7 +1032,7 @@ public class EndFeatures {
Blocks.END_STONE, Blocks.END_STONE,
EndBlocks.CAVE_MOSS EndBlocks.CAVE_MOSS
)) ))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE_CAVEMOSS = BCLFeatureBuilder public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite_cavemoss"), STALACTITE_FEATURE) .start(BetterEnd.makeID("end_stone_stalagmite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig( .configuration(new StalactiteFeatureConfig(
@ -1039,20 +1040,20 @@ public class EndFeatures {
EndBlocks.END_STONE_STALACTITE_CAVEMOSS, EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
EndBlocks.CAVE_MOSS EndBlocks.CAVE_MOSS
)) ))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<CavePumpkinFeature, NoneFeatureConfiguration> CAVE_PUMPKIN = BCLFeatureBuilder public static final BCLConfigureFeature<CavePumpkinFeature, NoneFeatureConfiguration> CAVE_PUMPKIN = BCLFeatureBuilder
.start( .start(
BetterEnd.makeID("cave_pumpkin"), BetterEnd.makeID("cave_pumpkin"),
inlineBuild("cave_pumpkin", new CavePumpkinFeature()) inlineBuild("cave_pumpkin", new CavePumpkinFeature())
) )
.buildAndRegister(); .build();
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS = BCLFeatureBuilder private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_not_glowing_grasslands")) .startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_not_glowing_grasslands"))
.add(EndBlocks.CREEPING_MOSS, 10) .add(EndBlocks.CREEPING_MOSS, 10)
.add(EndBlocks.UMBRELLA_MOSS, 10) .add(EndBlocks.UMBRELLA_MOSS, 10)
.inlinePlace().build(); .inlinePlace().build().placedFeature;
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_GLOWING_GRASSLANDS = BCLFeatureBuilder private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_glowing_grasslands")) .startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_glowing_grasslands"))
@ -1063,7 +1064,7 @@ public class EndFeatures {
.add(EndBlocks.FRACTURN, 100) .add(EndBlocks.FRACTURN, 100)
.add(EndBlocks.SALTEAGO, 100) .add(EndBlocks.SALTEAGO, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 10) .add(EndBlocks.TWISTED_UMBRELLA_MOSS, 10)
.inlinePlace().build(); .inlinePlace().build().placedFeature;
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_END_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_END_MOSS = BCLFeatureBuilder
.start( .start(
@ -1075,7 +1076,7 @@ public class EndFeatures {
BONEMEAL_END_MOSS_GLOWING_GRASSLANDS, BONEMEAL_END_MOSS_GLOWING_GRASSLANDS,
BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS
)) ))
.buildAndRegister(); .build();
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS = BCLFeatureBuilder private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_not_lantern_woods")) .startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_not_lantern_woods"))
@ -1084,7 +1085,7 @@ public class EndFeatures {
.add(EndBlocks.LUTEBUS, 20) .add(EndBlocks.LUTEBUS, 20)
.add(EndBlocks.LAMELLARIUM, 100) .add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace() .inlinePlace()
.build(); .build().placedFeature;
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_LANTERN_WOODS = BCLFeatureBuilder private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_lantern_woods")) .startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_lantern_woods"))
@ -1092,7 +1093,7 @@ public class EndFeatures {
.add(EndBlocks.BOLUX_MUSHROOM, 5) .add(EndBlocks.BOLUX_MUSHROOM, 5)
.add(EndBlocks.LAMELLARIUM, 100) .add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace() .inlinePlace()
.build(); .build().placedFeature;
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_RUTISCUS = BCLFeatureBuilder public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_RUTISCUS = BCLFeatureBuilder
.start( .start(
@ -1104,78 +1105,83 @@ public class EndFeatures {
BONEMEAL_RUTISCUS_LANTERN_WOODS, BONEMEAL_RUTISCUS_LANTERN_WOODS,
BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS
)) ))
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_END_MYCELIUM = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_END_MYCELIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_mycelium")) .startBonemealPatch(BetterEnd.makeID("bonemeal_end_mycelium"))
.add(EndBlocks.CREEPING_MOSS, 100) .add(EndBlocks.CREEPING_MOSS, 100)
.add(EndBlocks.UMBRELLA_MOSS, 100) .add(EndBlocks.UMBRELLA_MOSS, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_JUNGLE_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_JUNGLE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_jungle_moss")) .startBonemealPatch(BetterEnd.makeID("bonemeal_jungle_moss"))
.add(EndBlocks.JUNGLE_GRASS, 100) .add(EndBlocks.JUNGLE_GRASS, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 100) .add(EndBlocks.TWISTED_UMBRELLA_MOSS, 100)
.add(EndBlocks.SMALL_JELLYSHROOM, 10) .add(EndBlocks.SMALL_JELLYSHROOM, 10)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SANGNUM = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SANGNUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_sangnum")) .startBonemealPatch(BetterEnd.makeID("bonemeal_sangnum"))
.add(EndBlocks.CLAWFERN, 100) .add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100) .add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10) .add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_DRAGON_BONE = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_DRAGON_BONE = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_dragon_bone")) .startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_dragon_bone"))
.add(EndBlocks.CLAWFERN, 100) .add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100) .add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10) .add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_OBSIDIAN = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_OBSIDIAN = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_obsidian")) .startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_obsidian"))
.add(EndBlocks.CLAWFERN, 100) .add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100) .add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10) .add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CAVE_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CAVE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_cave_moss")) .startBonemealPatch(BetterEnd.makeID("bonemeal_cave_moss"))
.add(EndBlocks.CAVE_GRASS, 100) .add(EndBlocks.CAVE_GRASS, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CHORUS_NYLIUM = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CHORUS_NYLIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_chorus_nylium")) .startBonemealPatch(BetterEnd.makeID("bonemeal_chorus_nylium"))
.add(EndBlocks.CHORUS_GRASS, 100) .add(EndBlocks.CHORUS_GRASS, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CRYSTAL_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CRYSTAL_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_crystal_moss")) .startBonemealPatch(BetterEnd.makeID("bonemeal_crystal_moss"))
.add(EndBlocks.CRYSTAL_GRASS, 100) .add(EndBlocks.CRYSTAL_GRASS, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SHADOW_GRASS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SHADOW_GRASS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_shadow_grass")) .startBonemealPatch(BetterEnd.makeID("bonemeal_shadow_grass"))
.add(EndBlocks.SHADOW_PLANT, 100) .add(EndBlocks.SHADOW_PLANT, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_PINK_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_PINK_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_pink_moss")) .startBonemealPatch(BetterEnd.makeID("bonemeal_pink_moss"))
.add(EndBlocks.BUSHY_GRASS, 100) .add(EndBlocks.BUSHY_GRASS, 100)
.buildAndRegister(); .build();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_AMBER_MOSS = BCLFeatureBuilder public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_AMBER_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_amber_moss")) .startBonemealPatch(BetterEnd.makeID("bonemeal_amber_moss"))
.add(EndBlocks.AMBER_GRASS, 100) .add(EndBlocks.AMBER_GRASS, 100)
.buildAndRegister(); .build();
public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) { public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) {
ResourceLocation l = BetterEnd.makeID(name); 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); return BCLFeature.register(l, feature);
} }
@ -1212,11 +1218,11 @@ public class EndFeatures {
ResourceLocation id = BetterEnd.makeID(name); ResourceLocation id = BetterEnd.makeID(name);
return BCLFeatureBuilder.start(id, feature) return BCLFeatureBuilder.start(id, feature)
.configuration(config) .configuration(config)
.buildAndRegister() .build()
.place() .place()
.onEveryLayerMax(density) .onEveryLayerMax(density)
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
} }
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerRawGen( private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerRawGen(
@ -1236,13 +1242,13 @@ public class EndFeatures {
return BCLFeatureBuilder return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature) .start(BetterEnd.makeID(name), feature)
.configuration(config) .configuration(config)
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.RAW_GENERATION) .decoration(Decoration.RAW_GENERATION)
.onceEvery(chance) .onceEvery(chance)
.squarePlacement() .squarePlacement()
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
} }
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerLake( private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerLake(
@ -1252,13 +1258,13 @@ public class EndFeatures {
) { ) {
return BCLFeatureBuilder return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature) .start(BetterEnd.makeID(name), feature)
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.LAKES) .decoration(Decoration.LAKES)
.onceEvery(chance) .onceEvery(chance)
.squarePlacement() .squarePlacement()
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
} }
private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerChanced( private static <F extends Feature<NoneFeatureConfiguration>> BCLFeature<F, NoneFeatureConfiguration> registerChanced(
@ -1279,13 +1285,13 @@ public class EndFeatures {
BCLFeatureBuilder BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature) .start(BetterEnd.makeID(name), feature)
.configuration(config) .configuration(config)
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.SURFACE_STRUCTURES) .decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(chance) .onceEvery(chance)
.squarePlacement() .squarePlacement()
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
} }
private static BCLFeature<OreFeature, OreConfiguration> registerOre( private static BCLFeature<OreFeature, OreConfiguration> registerOre(
@ -1299,14 +1305,14 @@ public class EndFeatures {
.add(Blocks.END_STONE, blockOre) .add(Blocks.END_STONE, blockOre)
.veinSize(veinSize) .veinSize(veinSize)
.discardChanceOnAirExposure(0) .discardChanceOnAirExposure(0)
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.UNDERGROUND_ORES) .decoration(Decoration.UNDERGROUND_ORES)
.count(veins) .count(veins)
.randomHeight8FromFloorCeil() .randomHeight8FromFloorCeil()
.squarePlacement() .squarePlacement()
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
} }
private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer( private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer(
@ -1321,11 +1327,11 @@ public class EndFeatures {
return BCLFeatureBuilder return BCLFeatureBuilder
.start(BetterEnd.makeID(name), layer) .start(BetterEnd.makeID(name), layer)
.configuration(new OreLayerFeatureConfig(block.defaultBlockState(), radius, minY, maxY)) .configuration(new OreLayerFeatureConfig(block.defaultBlockState(), radius, minY, maxY))
.buildAndRegister() .build()
.place() .place()
.decoration(GenerationStep.Decoration.UNDERGROUND_ORES) .decoration(GenerationStep.Decoration.UNDERGROUND_ORES)
.count(count) .count(count)
.buildAndRegister(); .build();
} }
private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer( private static BCLFeature<OreLayerFeature, OreLayerFeatureConfig> registerLayer(
@ -1380,9 +1386,13 @@ public class EndFeatures {
private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(String ns, String nm) { private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(String ns, String nm) {
ResourceLocation id = new ResourceLocation(ns, nm + "_structures"); ResourceLocation id = new ResourceLocation(ns, nm + "_structures");
if (BuiltinRegistries.PLACED_FEATURE.containsKey(id)) { 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"); BCLib.LOGGER.info("Feature for " + id + " was already build");
} }
}
String path = "/data/" + ns + "/structures/biome/" + nm + "/"; String path = "/data/" + ns + "/structures/biome/" + nm + "/";
InputStream inputstream = EndFeatures.class.getResourceAsStream(path + "structures.json"); InputStream inputstream = EndFeatures.class.getResourceAsStream(path + "structures.json");
@ -1409,13 +1419,13 @@ public class EndFeatures {
list, list,
Blocks.END_STONE.defaultBlockState() Blocks.END_STONE.defaultBlockState()
)) ))
.buildAndRegister() .build()
.place() .place()
.decoration(Decoration.SURFACE_STRUCTURES) .decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(10) .onceEvery(10)
.squarePlacement() .squarePlacement()
.onlyInBiome() .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.item.tool.EndPickaxe;
import org.betterx.betterend.tab.CreativeTabs; import org.betterx.betterend.tab.CreativeTabs;
import net.minecraft.core.Holder;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects; import net.minecraft.world.effect.MobEffects;
@ -279,7 +280,10 @@ public class EndItems {
"bucket_end_fish", "bucket_end_fish",
new EndBucketItem(EndEntities.END_FISH.type()) 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 SWEET_BERRY_JELLY = registerEndFood("sweet_berry_jelly", 8, 0.7F);
public final static Item SHADOW_BERRY_JELLY = registerEndFood( public final static Item SHADOW_BERRY_JELLY = registerEndFood(
"shadow_berry_jelly", "shadow_berry_jelly",
@ -302,8 +306,8 @@ public class EndItems {
return BaseRegistry.getModItems(BetterEnd.MOD_ID); return BaseRegistry.getModItems(BetterEnd.MOD_ID);
} }
public static Item registerEndDisc(String name, int power, SoundEvent sound, int lengthInSeconds) { public static Item registerEndDisc(String name, int power, Holder<SoundEvent> sound, int lengthInSeconds) {
return getItemRegistry().registerDisc(BetterEnd.makeID(name), power, sound, lengthInSeconds); return getItemRegistry().registerDisc(BetterEnd.makeID(name), power, sound.value(), lengthInSeconds);
} }
public static Item registerEndItem(String name) { 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 org.betterx.betterend.client.gui.EndStoneSmelterMenu;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
@ -23,7 +24,7 @@ public class EndMenuTypes {
BiFunction<Integer, Inventory, T> factory BiFunction<Integer, Inventory, T> factory
) { ) {
MenuType<T> type = new MenuType<>((syncId, inventory) -> factory.apply(syncId, inventory)); 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() { public final static void ensureStaticallyLoaded() {

View file

@ -2,48 +2,54 @@ package org.betterx.betterend.registry;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
public class EndSounds { public class EndSounds {
// Music // Music
public static final SoundEvent MUSIC_FOREST = register("music", "forest"); public static final Holder<SoundEvent> MUSIC_FOREST = register("music", "forest");
public static final SoundEvent MUSIC_WATER = register("music", "water"); public static final Holder<SoundEvent> MUSIC_WATER = register("music", "water");
public static final SoundEvent MUSIC_DARK = register("music", "dark"); public static final Holder<SoundEvent> MUSIC_DARK = register("music", "dark");
public static final SoundEvent MUSIC_OPENSPACE = register("music", "openspace"); public static final Holder<SoundEvent> MUSIC_OPENSPACE = register("music", "openspace");
public static final SoundEvent MUSIC_CAVES = register("music", "caves"); public static final Holder<SoundEvent> MUSIC_CAVES = register("music", "caves");
// Ambient // Ambient
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland"); public static final Holder<SoundEvent> AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
public static final SoundEvent AMBIENT_CHORUS_FOREST = register("ambient", "chorus_forest"); public static final Holder<SoundEvent> AMBIENT_CHORUS_FOREST = register("ambient", "chorus_forest");
public static final SoundEvent AMBIENT_MEGALAKE = register("ambient", "megalake"); public static final Holder<SoundEvent> AMBIENT_MEGALAKE = register("ambient", "megalake");
public static final SoundEvent AMBIENT_DUST_WASTELANDS = register("ambient", "dust_wastelands"); public static final Holder<SoundEvent> AMBIENT_DUST_WASTELANDS = register("ambient", "dust_wastelands");
public static final SoundEvent AMBIENT_MEGALAKE_GROVE = register("ambient", "megalake_grove"); public static final Holder<SoundEvent> AMBIENT_MEGALAKE_GROVE = register("ambient", "megalake_grove");
public static final SoundEvent AMBIENT_BLOSSOMING_SPIRES = register("ambient", "blossoming_spires"); public static final Holder<SoundEvent> AMBIENT_BLOSSOMING_SPIRES = register("ambient", "blossoming_spires");
public static final SoundEvent AMBIENT_SULPHUR_SPRINGS = register("ambient", "sulphur_springs"); public static final Holder<SoundEvent> AMBIENT_SULPHUR_SPRINGS = register("ambient", "sulphur_springs");
public static final SoundEvent AMBIENT_UMBRELLA_JUNGLE = register("ambient", "umbrella_jungle"); public static final Holder<SoundEvent> AMBIENT_UMBRELLA_JUNGLE = register("ambient", "umbrella_jungle");
public static final SoundEvent AMBIENT_GLOWING_GRASSLANDS = register("ambient", "glowing_grasslands"); public static final Holder<SoundEvent> AMBIENT_GLOWING_GRASSLANDS = register("ambient", "glowing_grasslands");
public static final SoundEvent AMBIENT_CAVES = register("ambient", "caves"); public static final Holder<SoundEvent> AMBIENT_CAVES = register("ambient", "caves");
public static final SoundEvent AMBIENT_AMBER_LAND = register("ambient", "amber_land"); public static final Holder<SoundEvent> AMBIENT_AMBER_LAND = register("ambient", "amber_land");
public static final SoundEvent UMBRA_VALLEY = register("ambient", "umbra_valley"); public static final Holder<SoundEvent> UMBRA_VALLEY = register("ambient", "umbra_valley");
// Entity // Entity
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly"); public static final Holder<SoundEvent> ENTITY_DRAGONFLY = register("entity", "dragonfly");
public static final SoundEvent ENTITY_SHADOW_WALKER = register("entity", "shadow_walker"); public static final Holder<SoundEvent> ENTITY_SHADOW_WALKER = register("entity", "shadow_walker");
public static final SoundEvent ENTITY_SHADOW_WALKER_DAMAGE = register("entity", "shadow_walker_damage"); public static final Holder<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_SHADOW_WALKER_DEATH = register("entity", "shadow_walker_death");
// Records // Records
public static final SoundEvent RECORD_STRANGE_AND_ALIEN = register("record", "strange_and_alien"); public static final Holder<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 Holder<SoundEvent> RECORD_GRASPING_AT_STARS = register("record", "grasping_at_stars");
public static final SoundEvent RECORD_ENDSEEKER = register("record", "endseeker"); public static final Holder<SoundEvent> RECORD_ENDSEEKER = register("record", "endseeker");
public static final SoundEvent RECORD_EO_DRACONA = register("record", "eo_dracona"); public static final Holder<SoundEvent> RECORD_EO_DRACONA = register("record", "eo_dracona");
public static void register() { public static void register() {
} }
private static SoundEvent register(String type, String id) { private static Holder<SoundEvent> register(String type, String id) {
id = "betterend." + type + "." + id; ResourceLocation loc = BetterEnd.makeID("betterend." + type + "." + id);
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(BetterEnd.makeID(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.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
@ -68,7 +69,7 @@ public class EndStructures {
} }
private static StructurePieceType register(String id, StructurePieceType pieceType) { 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) { 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.EndFeatures;
import org.betterx.betterend.registry.EndPoiTypes; import org.betterx.betterend.registry.EndPoiTypes;
import org.betterx.betterend.registry.EndPortals; import org.betterx.betterend.registry.EndPortals;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; 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.BlockParticleOption;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; 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.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -189,7 +192,7 @@ public class EternalRitual {
private void activatePortal(Item keyItem) { private void activatePortal(Item keyItem) {
if (active) return; if (active) return;
ResourceLocation itemId = Registry.ITEM.getKey(keyItem); ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(keyItem);
int portalId = EndPortals.getPortalIdByItem(itemId); int portalId = EndPortals.getPortalIdByItem(itemId);
Level targetWorld = getTargetWorld(portalId); Level targetWorld = getTargetWorld(portalId);
ResourceLocation worldId = targetWorld.dimension().location(); ResourceLocation worldId = targetWorld.dimension().location();
@ -404,7 +407,7 @@ public class EternalRitual {
ServerLevel targetWorld = (ServerLevel) getTargetWorld(portalId); ServerLevel targetWorld = (ServerLevel) getTargetWorld(portalId);
Registry<DimensionType> registry = Objects.requireNonNull(server) Registry<DimensionType> registry = Objects.requireNonNull(server)
.registryAccess() .registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); .registryOrThrow(Registries.DIMENSION_TYPE);
double multiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale(); double multiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
BlockPos.MutableBlockPos basePos = center.mutable() BlockPos.MutableBlockPos basePos = center.mutable()
.set( .set(
@ -461,7 +464,10 @@ public class EternalRitual {
} }
} }
if (targetWorld.dimension() == Level.END) { if (targetWorld.dimension() == Level.END) {
net.minecraft.data.worldgen.features.EndFeatures.END_ISLAND.value().place( WorldBootstrap.getLastRegistryAccess()
.registryOrThrow(Registries.CONFIGURED_FEATURE)
.get(net.minecraft.data.worldgen.features.EndFeatures.END_ISLAND)
.place(
targetWorld, targetWorld,
targetWorld.getChunkSource().getGenerator(), targetWorld.getChunkSource().getGenerator(),
new LegacyRandomSource(basePos.asLong()), new LegacyRandomSource(basePos.asLong()),

View file

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

View file

@ -12,6 +12,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@ -30,7 +31,7 @@ public class BlockFixer {
public static void fixBlocks(LevelAccessor level, BlockPos start, BlockPos end) { public static void fixBlocks(LevelAccessor level, BlockPos start, BlockPos end) {
final Registry<DimensionType> registry = level.registryAccess() final Registry<DimensionType> registry = level.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); .registryOrThrow(Registries.DIMENSION_TYPE);
final ResourceLocation dimKey = registry.getKey(level.dimensionType()); final ResourceLocation dimKey = registry.getKey(level.dimensionType());
if (dimKey != null && "world_blender".equals(dimKey.getNamespace())) { if (dimKey != null && "world_blender".equals(dimKey.getNamespace())) {
return; 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.biomes.BiomeAPI;
import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder; import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
import org.betterx.bclib.interfaces.SurfaceMaterialProvider; import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
import org.betterx.bclib.util.WeightedList;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
@ -18,6 +17,7 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder; import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.data.worldgen.placement.EndPlacements; import net.minecraft.data.worldgen.placement.EndPlacements;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.KeyDispatchDataCodec;
@ -59,7 +59,6 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
ResourceLocation biomeID, ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints, Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType, Optional<String> intendedType,
boolean hasCaves, boolean hasCaves,
SurfaceMaterialProvider surface SurfaceMaterialProvider surface
@ -74,7 +73,6 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
biomeID, biomeID,
parameterPoints, parameterPoints,
biomeParent, biomeParent,
subbiomes,
intendedType intendedType
); );
this.hasCaves = hasCaves; this.hasCaves = hasCaves;
@ -171,21 +169,30 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
} }
public EndBiome(ResourceLocation biomeID, Biome biome, BCLBiomeSettings settings) { public EndBiome(ResourceKey<Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, biome, settings); super(biomeID, settings);
} }
public static EndBiome create(Config biomeConfig) { 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 BCLBiomeBuilder builder = BCLBiomeBuilder
.start(biomeConfig.ID) .start(biomeConfig.ID)
.music(SoundEvents.MUSIC_END) .music(SoundEvents.MUSIC_END)
.waterColor(4159204) .waterColor(BCLBiomeBuilder.DEFAULT_END_WATER_COLOR)
.waterFogColor(329011) .waterFogColor(BCLBiomeBuilder.DEFAULT_END_WATER_FOG_COLOR)
.fogColor(0xA080A0) .fogColor(BCLBiomeBuilder.DEFAULT_END_FOG_COLOR)
.skyColor(0) .skyColor(BCLBiomeBuilder.DEFAULT_END_SKY_COLOR)
.mood(EndSounds.AMBIENT_DUST_WASTELANDS) .mood(EndSounds.AMBIENT_DUST_WASTELANDS)
.temperature(0.5f) .temperature(BCLBiomeBuilder.DEFAULT_END_TEMPERATURE)
.wetness(0.5f) .wetness(BCLBiomeBuilder.DEFAULT_END_WETNESS)
.parentBiome(parentBiome)
.precipitation(Biome.Precipitation.NONE) .precipitation(Biome.Precipitation.NONE)
.surface(biomeConfig.surfaceMaterial().surface().build()) .surface(biomeConfig.surfaceMaterial().surface().build())
.endLandBiome(); .endLandBiome();
@ -197,7 +204,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
builder.feature(GenerationStep.Decoration.SURFACE_STRUCTURES, EndPlacements.END_GATEWAY_RETURN); 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.setHasCaves(biomeConfig.hasCaves());
biome.setSurfaceMaterial(biomeConfig.surfaceMaterial()); biome.setSurfaceMaterial(biomeConfig.surfaceMaterial());

View file

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

View file

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

View file

@ -12,6 +12,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate; 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 final KeyDispatchDataCodec<EmptySmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome { public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) { public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, biome, settings); super(biomeID, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1); this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20); this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
@ -50,7 +51,6 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID, ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints, Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType, Optional<String> intendedType,
boolean hasCaves, boolean hasCaves,
SurfaceMaterialProvider surface, SurfaceMaterialProvider surface,
@ -67,7 +67,6 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
biomeID, biomeID,
parameterPoints, parameterPoints,
biomeParent, biomeParent,
subbiomes,
intendedType, intendedType,
hasCaves, hasCaves,
surface, 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.CaveChunkPopulatorFeature;
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeatureConfig; 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.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder; import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
@ -36,7 +37,7 @@ import java.util.Optional;
public class EndCaveBiome extends EndBiome { public class EndCaveBiome extends EndBiome {
public static final Codec<EndCaveBiome> CODEC = simpleCaveBiomeCodec(EndCaveBiome::new); 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 -> return RecordCodecBuilder.create(instance ->
codecWithSettings( codecWithSettings(
instance, instance,
@ -71,7 +72,6 @@ public class EndCaveBiome extends EndBiome {
ResourceLocation biomeID, ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints, Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType, Optional<String> intendedType,
boolean hasCaves, boolean hasCaves,
SurfaceMaterialProvider surface, SurfaceMaterialProvider surface,
@ -88,7 +88,6 @@ public class EndCaveBiome extends EndBiome {
biomeID, biomeID,
parameterPoints, parameterPoints,
biomeParent, biomeParent,
subbiomes,
intendedType, intendedType,
hasCaves, hasCaves,
surface surface
@ -104,19 +103,19 @@ public class EndCaveBiome extends EndBiome {
@Override @Override
protected void addCustomBuildData(BCLBiomeBuilder builder) { protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.type(EndBiomes.END_CAVE);
BCLFeature<CaveChunkPopulatorFeature, CaveChunkPopulatorFeatureConfig> feature = BCLFeatureBuilder BCLFeature<CaveChunkPopulatorFeature, CaveChunkPopulatorFeatureConfig> feature = BCLFeatureBuilder
.start( .start(
BetterEnd.makeID(ID.getPath() + "_cave_populator"), BetterEnd.makeID(ID.getPath() + "_cave_populator"),
EndFeatures.CAVE_CHUNK_POPULATOR EndFeatures.CAVE_CHUNK_POPULATOR
) )
.configuration(new CaveChunkPopulatorFeatureConfig(ID)) .configuration(new CaveChunkPopulatorFeatureConfig(ID))
.buildAndRegister() .build()
.place() .place()
.decoration(GenerationStep.Decoration.UNDERGROUND_DECORATION) .decoration(GenerationStep.Decoration.UNDERGROUND_DECORATION)
.count(1) .count(1)
.onlyInBiome() .onlyInBiome()
.buildAndRegister(); .build();
builder.feature(feature) builder.feature(feature)
.intendedType(EndBiomes.END_CAVE) .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<?, ?>>> floorFeatures = new WeightedList<>();
private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> ceilFeatures = new WeightedList<>(); private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> ceilFeatures = new WeightedList<>();
public EndCaveBiome(ResourceLocation biomeID, Biome biome, BCLBiomeSettings settings) { public EndCaveBiome(ResourceKey<Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, biome, settings); super(biomeID, settings);
} }
public void addFloorFeature(Holder<? extends ConfiguredFeature<?, ?>> feature, float weight) { 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 com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
@ -33,8 +34,8 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
private static final BlockState[] JADE = new BlockState[3]; private static final BlockState[] JADE = new BlockState[3];
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) { public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, biome, settings); super(biomeID, settings);
JADE[0] = EndBlocks.VIRID_JADESTONE.stone.defaultBlockState(); JADE[0] = EndBlocks.VIRID_JADESTONE.stone.defaultBlockState();
JADE[1] = EndBlocks.AZURE_JADESTONE.stone.defaultBlockState(); JADE[1] = EndBlocks.AZURE_JADESTONE.stone.defaultBlockState();
@ -56,7 +57,6 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID, ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints, Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType, Optional<String> intendedType,
boolean hasCaves, boolean hasCaves,
SurfaceMaterialProvider surface, SurfaceMaterialProvider surface,
@ -73,7 +73,6 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
biomeID, biomeID,
parameterPoints, parameterPoints,
biomeParent, biomeParent,
subbiomes,
intendedType, intendedType,
hasCaves, hasCaves,
surface, surface,

View file

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

View file

@ -13,6 +13,7 @@ import org.betterx.betterend.world.biome.EndBiome;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.KeyDispatchDataCodec; import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.biome.Climate; 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 final KeyDispatchDataCodec<LushSmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
public static class Biome extends EndCaveBiome { public static class Biome extends EndCaveBiome {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) { public Biome(ResourceKey<net.minecraft.world.level.biome.Biome> biomeID, BCLBiomeSettings settings) {
super(biomeID, biome, settings); super(biomeID, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1); this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20); this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
@ -52,7 +53,6 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
ResourceLocation biomeID, ResourceLocation biomeID,
Optional<List<Climate.ParameterPoint>> parameterPoints, Optional<List<Climate.ParameterPoint>> parameterPoints,
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<WeightedList<ResourceLocation>> subbiomes,
Optional<String> intendedType, Optional<String> intendedType,
boolean hasCaves, boolean hasCaves,
SurfaceMaterialProvider surface, SurfaceMaterialProvider surface,
@ -69,7 +69,6 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
biomeID, biomeID,
parameterPoints, parameterPoints,
biomeParent, biomeParent,
subbiomes,
intendedType, intendedType,
hasCaves, hasCaves,
surface, 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.api.v2.levelgen.structures.templatesystem.DestructionStructureProcessor;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos; import net.minecraft.core.*;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries;
import net.minecraft.core.Holder;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -20,6 +19,7 @@ import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome; 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.Mirror;
import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState; 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 { private static StructureTemplate readStructureFromStream(InputStream stream) throws IOException {
final HolderLookup<Block> blockLookup = WorldBootstrap.getLastRegistryAccess()
.lookup(Registries.BLOCK)
.orElseThrow();
CompoundTag nbttagcompound = NbtIo.readCompressed(stream); CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
StructureTemplate template = new StructureTemplate(); StructureTemplate template = new StructureTemplate();
template.load(nbttagcompound); template.load(blockLookup, nbttagcompound);
return template; return template;
} }

View file

@ -9,7 +9,6 @@ import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class BigAuroraCrystalFeature extends DefaultFeature { public class BigAuroraCrystalFeature extends DefaultFeature {
@Override @Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) { 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class FallenPillarFeature extends DefaultFeature { public class FallenPillarFeature extends DefaultFeature {
@Override @Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) { 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.betterend.util.BlockFixer;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; 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;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -111,7 +111,7 @@ public class GeyserFeature extends DefaultFeature {
bowl = new SDFSubtraction().setSourceA(bowl).setSourceB(cut); bowl = new SDFSubtraction().setSourceA(bowl).setSourceB(cut);
bowl = new SDFTranslate().setTranslate(radius, py - radius, 0).setSource(bowl); 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 = new SDFUnion().setSourceA(sdf).setSourceB(bowl);
} }
sdf.setReplaceFunction(REPLACE2).fillRecursive(world, pos); 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.bclib.util.MHelper;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; 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.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import org.joml.Vector3f;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,12 +45,12 @@ public class IceStarFeature extends Feature<IceStarFeatureConfig> {
for (Vector3f point : points) { for (Vector3f point : points) {
SDF rotated = spike; SDF rotated = spike;
point = MHelper.normalize(point); 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) { 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); rotated = new SDFRotation().setRotation(axis, angle).setSource(spike);
} else if (angle > 1) { } 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); 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
public class ObsidianPillarBasementFeature extends DefaultFeature { public class ObsidianPillarBasementFeature extends DefaultFeature {
@Override @Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) { 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.betterend.noise.OpenSimplexNoise;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; 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;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
@ -61,7 +61,7 @@ public class ThinArchFeature extends Feature<ThinArchFeatureConfig> {
.setSmallRadius(smallRadius) .setSmallRadius(smallRadius)
.setBlock(block); .setBlock(block);
float angle = (i - count * 0.5F) * 0.3F + random.nextFloat() * 0.05F + (float) Math.PI * 0.5F; 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); 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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 net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.bclib.util.SplineHelper;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.blocks.HelixTreeLeavesBlock;
import org.betterx.betterend.registry.EndBlocks; 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;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.tags.BlockTags; 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.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import org.joml.Vector3f;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
@ -53,7 +55,7 @@ public class HelixTreeFeature extends DefaultFeature {
SDF sdf = SplineHelper.buildSDF(spline, 1.7F, 0.5F, (p) -> { SDF sdf = SplineHelper.buildSDF(spline, 1.7F, 0.5F, (p) -> {
return EndBlocks.HELIX_TREE.getBark().defaultBlockState(); 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); sdf = new SDFUnion().setSourceA(rotated).setSourceB(sdf);
Vector3f lastPoint = spline.get(spline.size() - 1); 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; 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 net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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 net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.noise.OpenSimplexNoise;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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 net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; 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 net.minecraft.world.level.material.Material;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
import java.util.function.Function; 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.generator.config.BCLEndBiomeSourceConfig;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI; 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.Biome;
import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.biome.BiomeSource;
@ -15,7 +15,7 @@ public class EndLandBiomeDecider extends BiomeDecider {
this(null); this(null);
} }
protected EndLandBiomeDecider(Registry<Biome> biomeRegistry) { protected EndLandBiomeDecider(HolderGetter<Biome> biomeRegistry) {
super(biomeRegistry, (biome) -> false); super(biomeRegistry, (biome) -> false);
} }

View file

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

View file

@ -10,7 +10,7 @@ import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndStructures; import org.betterx.betterend.registry.EndStructures;
import org.betterx.betterend.world.structures.piece.VoxelPiece; 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.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.ChunkPos; 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.StructureType;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
import org.joml.Vector3f;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -51,12 +53,12 @@ public class GiantIceStarStructure extends SDFStructureFeature {
for (Vector3f point : points) { for (Vector3f point : points) {
SDF rotated = spike; SDF rotated = spike;
point = MHelper.normalize(point); 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) { 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); rotated = new SDFRotation().setRotation(axis, angle).setSource(spike);
} else if (angle > 1) { } 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); 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.EndBlocks;
import org.betterx.betterend.registry.EndStructures; import org.betterx.betterend.registry.EndStructures;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraft.world.level.levelgen.structure.StructureType;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
public class GiantMossyGlowshroomStructure extends SDFStructureFeature { 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.BlockPos;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.biome.Biome; 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.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
@ -50,6 +53,7 @@ public class PaintedMountainStructure extends FeatureBaseStructure {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
slices[i] = VARIANTS[random.nextInt(VARIANTS.length)]; slices[i] = VARIANTS[random.nextInt(VARIANTS.length)];
} }
HolderLookup<Block> blockHolderLookup = context.registryAccess().lookup(Registries.BLOCK).orElseThrow();
structurePiecesBuilder.addPiece(new PaintedMountainPiece( structurePiecesBuilder.addPiece(new PaintedMountainPiece(
new BlockPos(x, y, z), new BlockPos(x, y, z),
radius, radius,

View file

@ -3,10 +3,13 @@ package org.betterx.betterend.world.structures.piece;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.registry.EndStructures; import org.betterx.betterend.registry.EndStructures;
import org.betterx.betterend.util.GlobalState; import org.betterx.betterend.util.GlobalState;
import org.betterx.worlds.together.world.event.WorldBootstrap;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Holder; 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.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils; 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.StructureManager;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome; 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.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
@ -55,10 +59,14 @@ public class PaintedMountainPiece extends MountainPiece {
@Override @Override
protected void fromNbt(CompoundTag tag) { protected void fromNbt(CompoundTag tag) {
super.fromNbt(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); ListTag slise = tag.getList("slises", 10);
slices = new BlockState[slise.size()]; slices = new BlockState[slise.size()];
for (int i = 0; i < slices.length; i++) { 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.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder; 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.resources.ResourceKey;
import net.minecraft.world.level.levelgen.Noises; import net.minecraft.world.level.levelgen.Noises;
import net.minecraft.world.level.levelgen.synth.NormalNoise; 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 public static final Codec<VerticalBandNoiseCondition> CODEC = RecordCodecBuilder.create(instance -> instance
.group( .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("offset_scale").orElse(4.0).forGetter(o -> o.offsetScale),
Codec.DOUBLE.fieldOf("band_scale").orElse(4.0).forGetter(o -> o.bandScale), Codec.DOUBLE.fieldOf("band_scale").orElse(4.0).forGetter(o -> o.bandScale),
Codec.DOUBLE.fieldOf("xz_scale").orElse(6.0).forGetter(o -> o.xzScale), Codec.DOUBLE.fieldOf("xz_scale").orElse(6.0).forGetter(o -> o.xzScale),

View file

@ -17,7 +17,6 @@
"EntityMixin", "EntityMixin",
"LevelMixin", "LevelMixin",
"LivingEntityMixin", "LivingEntityMixin",
"MappedRegistryMixin",
"MonsterMixin", "MonsterMixin",
"NoiseBasedChunkGeneratorAccessor", "NoiseBasedChunkGeneratorAccessor",
"NoiseChunkAccessor", "NoiseChunkAccessor",