diff --git a/Common/src/main/java/potionstudios/byg/client/gui/HypogealImperiumContainer.java b/Common/src/main/java/potionstudios/byg/client/gui/HypogealImperiumContainer.java index 37dbc42b4c..94f08a2e4a 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/HypogealImperiumContainer.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/HypogealImperiumContainer.java @@ -9,6 +9,7 @@ import net.minecraft.world.inventory.SimpleContainerData; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.container.BYGMenuTypes; public class HypogealImperiumContainer extends AbstractContainerMenu { @@ -51,7 +52,7 @@ public HypogealImperiumContainer(int windowId, Inventory playerInv, Container in } @Override - public ItemStack quickMoveStack(Player playerIn, int index) { + public @NotNull ItemStack quickMoveStack(@NotNull Player playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.slots.get(index); if (slot != null && slot.hasItem()) { @@ -75,7 +76,7 @@ public ItemStack quickMoveStack(Player playerIn, int index) { @Override - public boolean stillValid(Player playerIn) { + public boolean stillValid(@NotNull Player playerIn) { return this.inventory.stillValid(playerIn); } @@ -88,7 +89,7 @@ public CrystalSlot(Container p_i47069_1_, int p_i47069_2_, int p_i47069_3_, int super(p_i47069_1_, p_i47069_2_, p_i47069_3_, p_i47069_4_); } - public boolean mayPlace(ItemStack stack) { + public boolean mayPlace(@NotNull ItemStack stack) { return true; } @@ -102,7 +103,7 @@ public NumberSlot(Container p_i47069_1_, int p_i47069_2_, int p_i47069_3_, int p super(p_i47069_1_, p_i47069_2_, p_i47069_3_, p_i47069_4_); } - public boolean mayPlace(ItemStack stack) { + public boolean mayPlace(@NotNull ItemStack stack) { return false; } @@ -111,7 +112,7 @@ public int getMaxStackSize() { } @Override - public boolean mayPickup(Player p_82869_1_) { + public boolean mayPickup(@NotNull Player p_82869_1_) { return false; } } diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/AbstractBiomepediaScreen.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/AbstractBiomepediaScreen.java index e7c995bbd4..f94927ede0 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/AbstractBiomepediaScreen.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/AbstractBiomepediaScreen.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.NotNull; public class AbstractBiomepediaScreen extends Screen { @@ -39,7 +40,7 @@ protected void init() { @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) { renderBackgroundAndBiomepedia(poseStack); super.render(poseStack, mouseX, mouseY, partialTick); diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen.java index 48b719e1a5..9384d272e1 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen.java @@ -83,9 +83,7 @@ protected void init() { this.toolTipMaxWidth = (IMAGE_WIDTH / 2) - 22; this.textStartHeight = (this.bottomPos + IMAGE_HEIGHT / 2) - 5; - this.addRenderableWidget(new PageButton(pageButtonForwardX, pageButtonY, true, button -> { - this.minecraft.setScreen(new BiomeAboutScreen2(this.biomeKey, this.parent)); - }, true)); + this.addRenderableWidget(new PageButton(pageButtonForwardX, pageButtonY, true, button -> this.minecraft.setScreen(new BiomeAboutScreen2(this.biomeKey, this.parent)), true)); int dimensionTextTop = this.bottomPos + 15; diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen2.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen2.java index d9f6750de4..87cb22bcd8 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen2.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeAboutScreen2.java @@ -40,9 +40,7 @@ protected BiomeAboutScreen2(ResourceKey biomeKey, Screen parent) { Map, ObjectOpenHashSet>>> biomeMobs = levelBiomeTracker.getBiomeMobs(); if (biomeMobs.containsKey(biomeKey)) { - biomeMobs.get(biomeKey).stream().sorted(Comparator.comparing(key -> key.location().toString())).forEach(entityTypeResourceKey -> { - mobSpawnsText.append("\n").append(BuiltInRegistries.ENTITY_TYPE.getOrThrow(entityTypeResourceKey).getDescription()); - }); + biomeMobs.get(biomeKey).stream().sorted(Comparator.comparing(key -> key.location().toString())).forEach(entityTypeResourceKey -> mobSpawnsText.append("\n").append(BuiltInRegistries.ENTITY_TYPE.getOrThrow(entityTypeResourceKey).getDescription())); } else { mobSpawnsText.append("\n").append(Component.translatable("biomepedia.biomeabout.mobspawns.none")); } @@ -85,9 +83,7 @@ protected void init() { int mobSpawnsTextBottom = mobSpawnsTextTop + size; this.toolTipMaxWidth = (IMAGE_WIDTH / 2) - 22; - this.addRenderableWidget(new PageButton(pageBackButtonX, pageButtonY, false, button -> { - this.minecraft.setScreen(new BiomeAboutScreen(this.biomeKey, this.parent)); - }, true)); + this.addRenderableWidget(new PageButton(pageBackButtonX, pageButtonY, false, button -> this.minecraft.setScreen(new BiomeAboutScreen(this.biomeKey, this.parent)), true)); ScrollableText mobSpawns = new ScrollableText(this.mobSpawns, this.toolTipMaxWidth, mobSpawnsTextTop, mobSpawnsTextTop, mobSpawnsTextBottom); mobSpawns.setLeftPos(startXLeftPage); diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeListScreen.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeListScreen.java index c6adf231f1..6c10f016a1 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeListScreen.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomeListScreen.java @@ -196,9 +196,7 @@ private void createMenu(List> biomes, boolean snapToFront) { break; } ResourceKey biome = biomes.get(registryIdx); - page[yPos] = this.addWidget(new BiomeWidget(biome, xOffset + startX, yOffset, (int) (IMAGE_WIDTH / 2.5F), (int) (IMAGE_HEIGHT / 2.7), button -> { - this.minecraft.setScreen(new BiomeAboutScreen(biome, this)); - })); + page[yPos] = this.addWidget(new BiomeWidget(biome, xOffset + startX, yOffset, (int) (IMAGE_WIDTH / 2.5F), (int) (IMAGE_HEIGHT / 2.7), button -> this.minecraft.setScreen(new BiomeAboutScreen(biome, this)))); registryIdx++; yOffset += (IMAGE_HEIGHT / 2.7) + 10; } diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomepediaHomeScreen.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomepediaHomeScreen.java index 7744658bee..6dbd966118 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomepediaHomeScreen.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/screen/BiomepediaHomeScreen.java @@ -106,20 +106,18 @@ protected void init() { @NotNull private Button.OnPress consumeLink(String url) { - return button -> { - this.minecraft.setScreen(new ConfirmLinkScreen(confirmed -> { - if (confirmed) { - try { - ((ScreenAccess) this).byg_invokeOpenLink(new URI(url)); - this.minecraft.setScreen(this); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } else { + return button -> this.minecraft.setScreen(new ConfirmLinkScreen(confirmed -> { + if (confirmed) { + try { + ((ScreenAccess) this).byg_invokeOpenLink(new URI(url)); this.minecraft.setScreen(this); + } catch (URISyntaxException e) { + e.printStackTrace(); } - }, url, false)); - }; + } else { + this.minecraft.setScreen(this); + } + }, url, false)); } @Override diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/BiomeWidget.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/BiomeWidget.java index 57dd137a05..86bbe0080b 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/BiomeWidget.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/BiomeWidget.java @@ -10,6 +10,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FastColor; import net.minecraft.world.level.biome.Biome; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import potionstudios.byg.util.BYGUtil; @@ -47,12 +48,12 @@ public void onClick(double $$0, double $$1) { } @Override - protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { + protected void updateWidgetNarration(@NotNull NarrationElementOutput narrationElementOutput) { } @Override - public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void renderWidget(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) { if (this.visible) { if (previewImageLocation != null) { float scale = 0.09F; diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ItemWidget.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ItemWidget.java index ec76ce3732..87d0a48e6c 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ItemWidget.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ItemWidget.java @@ -6,6 +6,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; public class ItemWidget extends AbstractWidget { public final ItemStack stack; @@ -24,7 +25,7 @@ public ItemWidget(ItemStack stack, ItemRenderer itemRenderer, int pX, int pY, in } @Override - protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { + protected void updateWidgetNarration(@NotNull NarrationElementOutput narrationElementOutput) { } @@ -35,7 +36,7 @@ public void onClick(double $$0, double $$1) { } @Override - public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void renderWidget(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) { this.itemRenderer.renderAndDecorateItem(poseStack, this.stack, this.getX(), this.getY()); } diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ScrollableText.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ScrollableText.java index d1b80c6569..ea0b174463 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ScrollableText.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/ScrollableText.java @@ -10,6 +10,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.util.FastColor; import net.minecraft.util.FormattedCharSequence; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.client.gui.screen.BYGContainerObjectSelectionList; import java.util.List; @@ -33,7 +34,7 @@ public ScrollableText(Component text, int width, int height, int y0, int y1, int } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) { super.render(poseStack, mouseX, mouseY, partialTick); if (DEBUG) { GuiComponent.fill(poseStack, this.x0, this.y0, this.x1, this.y1, FastColor.ARGB32.color(50, 0, 255, 0)); @@ -53,18 +54,18 @@ public ScrollableTextEntry(FormattedCharSequence text, int textMaxWidth, int tex } @Override - public void render(PoseStack pPoseStack, int pIndex, int pTop, int pLeft, int rowWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTick) { + public void render(@NotNull PoseStack pPoseStack, int pIndex, int pTop, int pLeft, int rowWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTick) { float textHeightOffset = (float) (pTop + pHeight - Minecraft.getInstance().font.lineHeight); Minecraft.getInstance().font.draw(pPoseStack, this.text, (pLeft) + rowWidth - this.textMaxWidth, textHeightOffset, this.textColor); } @Override - public List children() { + public @NotNull List children() { return ImmutableList.of(); } @Override - public List narratables() { + public @NotNull List narratables() { return ImmutableList.of(); } } diff --git a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/WidgetList.java b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/WidgetList.java index 2c8a9b9be6..99fa67bed7 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/WidgetList.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/biomepedia/widget/WidgetList.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.components.ContainerObjectSelectionList; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.client.gui.screen.BYGContainerObjectSelectionList; import java.util.List; @@ -26,17 +27,17 @@ public WidgetList(List widgets, int width, int height, int y0, i } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) { super.render(poseStack, mouseX, mouseY, partialTick); super.renderList(poseStack, mouseX, mouseY, partialTick); } @Override - protected void renderList(PoseStack $$0, int $$1, int $$2, float $$3) { + protected void renderList(@NotNull PoseStack $$0, int $$1, int $$2, float $$3) { } @Override - protected int addEntry(Entry $$0) { + protected int addEntry(@NotNull Entry $$0) { return super.addEntry($$0); } @@ -49,19 +50,19 @@ public Entry(AbstractWidget text) { } @Override - public void render(PoseStack pPoseStack, int pIndex, int pTop, int pLeft, int rowWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTick) { + public void render(@NotNull PoseStack pPoseStack, int pIndex, int pTop, int pLeft, int rowWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTick) { this.widget.setX(pLeft); this.widget.setY(pTop); this.widget.render(pPoseStack, pMouseX, pMouseY, pPartialTick); } @Override - public List children() { + public @NotNull List children() { return ImmutableList.of(this.widget); } @Override - public List narratables() { + public @NotNull List narratables() { return ImmutableList.of(this.widget); } } diff --git a/Common/src/main/java/potionstudios/byg/client/gui/screen/HypogealImperiumScreen.java b/Common/src/main/java/potionstudios/byg/client/gui/screen/HypogealImperiumScreen.java index 84a9a0fc05..86c3ea68a9 100644 --- a/Common/src/main/java/potionstudios/byg/client/gui/screen/HypogealImperiumScreen.java +++ b/Common/src/main/java/potionstudios/byg/client/gui/screen/HypogealImperiumScreen.java @@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Inventory; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import potionstudios.byg.client.gui.HypogealImperiumContainer; @@ -29,14 +30,14 @@ protected void init() { } @Override - public void render(PoseStack matrixStack, final int mouseX, final int mouseY, final float partialTicks) { + public void render(@NotNull PoseStack matrixStack, final int mouseX, final int mouseY, final float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.renderTooltip(matrixStack, mouseX, mouseY); } @Override - protected void renderBg(PoseStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) { + protected void renderBg(@NotNull PoseStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE); diff --git a/Common/src/main/java/potionstudios/byg/common/block/AbstractBarrelCactusBlock.java b/Common/src/main/java/potionstudios/byg/common/block/AbstractBarrelCactusBlock.java index 2aa5dbf93a..52cdf72518 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/AbstractBarrelCactusBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/AbstractBarrelCactusBlock.java @@ -41,7 +41,7 @@ public AbstractBarrelCactusBlock(Properties $$0) { } @Override - public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState, boolean b) { + public boolean isValidBonemealTarget(@NotNull LevelReader levelReader, @NotNull BlockPos blockPos, @NotNull BlockState blockState, boolean b) { return true; } @@ -70,15 +70,13 @@ public void performBonemeal(ServerLevel serverLevel, @NotNull RandomSource rando serverLevel.neighborChanged(blockPos, BYGBlocks.FLOWERING_BARREL_CACTUS.get(), blockPos); } - public InteractionResult use(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos $$2, @NotNull Player $$3, @NotNull InteractionHand $$4, @NotNull BlockHitResult $$5) { + public @NotNull InteractionResult use(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos $$2, @NotNull Player $$3, @NotNull InteractionHand $$4, @NotNull BlockHitResult $$5) { ItemStack $$6 = $$3.getItemInHand($$4); if ($$6.is(BYGTags.SHEARS.all(BYGTags.RegistryType.ITEMS))) { if (!world.isClientSide) { world.playSound(null, $$2, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); world.setBlock($$2, BYGBlocks.CARVED_BARREL_CACTUS.defaultBlockState(), 11); - $$6.hurtAndBreak(1, $$3, ($$1x) -> { - $$1x.broadcastBreakEvent($$4); - }); + $$6.hurtAndBreak(1, $$3, ($$1x) -> $$1x.broadcastBreakEvent($$4)); world.gameEvent($$3, GameEvent.SHEAR, $$2); $$3.awardStat(Stats.ITEM_USED.get(Items.SHEARS)); } @@ -94,11 +92,11 @@ protected boolean mayPlaceOn(@NotNull BlockState $$0, BlockGetter $$1, BlockPos return ($$6.is(BlockTags.SAND)) && !$$1.getBlockState($$2.above()).getMaterial().isLiquid(); } - public boolean canSurvive(BlockState $$0, LevelReader $$1, @NotNull BlockPos $$2) { + public boolean canSurvive(@NotNull BlockState $$0, @NotNull LevelReader $$1, @NotNull BlockPos $$2) { return this.mayPlaceOn($$1.getBlockState($$2.above()), $$1, $$2); } - public BlockState updateShape(BlockState $$0, Direction $$1, BlockState $$2, LevelAccessor $$3, BlockPos $$4, BlockPos $$5) { + public @NotNull BlockState updateShape(BlockState $$0, @NotNull Direction $$1, @NotNull BlockState $$2, @NotNull LevelAccessor $$3, @NotNull BlockPos $$4, @NotNull BlockPos $$5) { if (!$$0.canSurvive($$3, $$4)) { return Blocks.AIR.defaultBlockState(); } @@ -109,11 +107,11 @@ public boolean isPathfindable(@NotNull BlockState $$0, @NotNull BlockGetter $$1, return false; } - public VoxelShape getCollisionShape(BlockState $$0, BlockGetter $$1, BlockPos $$2, CollisionContext $$3) { + public @NotNull VoxelShape getCollisionShape(@NotNull BlockState $$0, @NotNull BlockGetter $$1, @NotNull BlockPos $$2, @NotNull CollisionContext $$3) { return COLLISION_SHAPE; } - public VoxelShape getShape(BlockState $$0, BlockGetter $$1, BlockPos $$2, CollisionContext $$3) { + public @NotNull VoxelShape getShape(@NotNull BlockState $$0, @NotNull BlockGetter $$1, @NotNull BlockPos $$2, @NotNull CollisionContext $$3) { return OUTLINE_SHAPE; } diff --git a/Common/src/main/java/potionstudios/byg/common/block/AppleFruitBlock.java b/Common/src/main/java/potionstudios/byg/common/block/AppleFruitBlock.java index 64a7cf4209..8605bf3307 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/AppleFruitBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/AppleFruitBlock.java @@ -25,6 +25,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; public class AppleFruitBlock extends Block implements BonemealableBlock { public static final IntegerProperty AGE = BlockStateProperties.AGE_3; @@ -36,12 +37,12 @@ public AppleFruitBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(Items.APPLE); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -58,7 +59,7 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.above(); BlockState blockstate = worldIn.getBlockState(blockpos); Block block = blockstate.getBlock(); @@ -66,12 +67,12 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!state.canSurvive(worldIn, pos)) { worldIn.destroyBlock(pos.above(), true); } @@ -81,7 +82,7 @@ public boolean isRandomlyTicking(BlockState state) { return state.getValue(AGE) < 3; } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource random) { int i = state.getValue(AGE); if (i < 3 && worldIn.getRawBrightness(pos.above(), 0) >= 9 && random.nextInt(5) == 0) { worldIn.setBlock(pos, state.setValue(AGE, i + 1), 2); @@ -89,15 +90,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, BlockState state, boolean isClient) { return state.getValue(AGE) < 3; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, BlockState state) { int i = Math.min(3, state.getValue(AGE) + 1); worldIn.setBlock(pos, state.setValue(AGE, i), 2); } @@ -106,7 +107,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder mayPlaceOn } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(this.mayPlaceOn); } @Override - public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel level, @NotNull RandomSource random, @NotNull BlockPos pos, @NotNull BlockState state) { this.bonemealAction.perform(level, random, pos, state); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGCraftingTableBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGCraftingTableBlock.java index 5108fee4bb..c265aaa934 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGCraftingTableBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGCraftingTableBlock.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.CraftingTableBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.container.BYGWorkbenchContainer; public class BYGCraftingTableBlock extends CraftingTableBlock { @@ -18,7 +19,7 @@ public BYGCraftingTableBlock(Properties properties) { } @Override - public MenuProvider getMenuProvider(BlockState state, Level worldIn, BlockPos pos) { + public MenuProvider getMenuProvider(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos) { return new SimpleMenuProvider((id, inventory, entity) -> new BYGWorkbenchContainer(id, inventory, ContainerLevelAccess.create(worldIn, pos), this), GUI_TITLE); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGDoublePlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGDoublePlantBlock.java index 97aee42aab..520cd0d74f 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGDoublePlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGDoublePlantBlock.java @@ -6,6 +6,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.DoublePlantBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; public class BYGDoublePlantBlock extends DoublePlantBlock { private final TagKey mayPlaceOn; @@ -16,7 +17,7 @@ public BYGDoublePlantBlock(Properties properties, TagKey mayPlaceOn) { } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(this.mayPlaceOn); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGFlowerBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGFlowerBlock.java index f04c755c0d..8158d5c37d 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGFlowerBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGFlowerBlock.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FlowerBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; public class BYGFlowerBlock extends FlowerBlock { private final TagKey validGround; @@ -17,7 +18,7 @@ public BYGFlowerBlock(Properties properties, TagKey validGround) { } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(validGround); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGFrostMagmaBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGFrostMagmaBlock.java index 1e199f565f..f176ab69ab 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGFrostMagmaBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGFrostMagmaBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; @SuppressWarnings("deprecation") public class BYGFrostMagmaBlock extends Block { @@ -17,7 +18,7 @@ public BYGFrostMagmaBlock(Properties properties) { super(properties); } - public void stepOn(Level block, BlockPos pos, BlockState state, Entity entity) { + public void stepOn(@NotNull Level block, @NotNull BlockPos pos, @NotNull BlockState state, Entity entity) { if (!entity.fireImmune() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) { entity.hurt(entity.damageSources().hotFloor(), 1.0F); } @@ -25,7 +26,7 @@ public void stepOn(Level block, BlockPos pos, BlockState state, Entity entity) { } @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource rand) { + public void randomTick(@NotNull BlockState state, ServerLevel world, BlockPos pos, @NotNull RandomSource rand) { BlockState blockAbove = world.getBlockState(pos.above()); if (blockAbove.getBlock() == Blocks.WATER) { world.setBlock(pos.above(), Blocks.ICE.defaultBlockState(), 2); @@ -42,7 +43,7 @@ public int tickRate() { return 20; } - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState state2, boolean isMoving) { + public void onPlace(@NotNull BlockState state, Level world, @NotNull BlockPos pos, @NotNull BlockState state2, boolean isMoving) { world.scheduleTick(pos, this, this.tickRate()); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGFungusBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGFungusBlock.java index fc718beda6..c7d4350562 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGFungusBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGFungusBlock.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FungusBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.sapling.GrowingPatterns; import potionstudios.byg.util.FeatureGrowerFromBlockPattern; @@ -30,17 +31,17 @@ public BYGFungusBlock(Properties $$0, TagKey groundTag) { } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter blockGetter, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter blockGetter, @NotNull BlockPos pos) { return state.is(this.groundTag); } @Override - public boolean isValidBonemealTarget(LevelReader blockGetter, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader blockGetter, @NotNull BlockPos pos, @NotNull BlockState state, boolean isClient) { return true; } @Override - public void performBonemeal(ServerLevel serverLevel, RandomSource random, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel serverLevel, @NotNull RandomSource random, @NotNull BlockPos pos, @NotNull BlockState state) { this.growFeature(this, serverLevel, pos, random); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGGrassBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGGrassBlock.java index bb75bbc1fe..ee0a1d96b4 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGGrassBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGGrassBlock.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.GrassBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.SpreadableSnowyDirtBlockAccess; public class BYGGrassBlock extends GrassBlock implements BonemealableBlock { @@ -20,7 +21,7 @@ public BYGGrassBlock(Properties properties, Block dirtBlock) { } @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + public void randomTick(@NotNull BlockState state, @NotNull ServerLevel world, @NotNull BlockPos pos, @NotNull RandomSource random) { if (!SpreadableSnowyDirtBlockAccess.byg_invokeCanBeGrass(state, world, pos)) { world.setBlockAndUpdate(pos, this.dirtBlock.defaultBlockState()); return; diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGLeavesBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGLeavesBlock.java index e8275ef3ed..695723eeac 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGLeavesBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGLeavesBlock.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import java.util.function.Supplier; @@ -20,7 +21,7 @@ public BYGLeavesBlock(Properties properties, @Nullable Supplier } @Override - public void animateTick(BlockState blockState, Level level, BlockPos blockPos, RandomSource randomSource) { + public void animateTick(@NotNull BlockState blockState, @NotNull Level level, @NotNull BlockPos blockPos, @NotNull RandomSource randomSource) { super.animateTick(blockState, level, blockPos, randomSource); if (particleType != null) { if (randomSource.nextDouble() < 0.01F) { diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGMushroomBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGMushroomBlock.java index a7585604b3..de84702261 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGMushroomBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGMushroomBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.MushroomBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.sapling.GrowingPatterns; import potionstudios.byg.util.FeatureGrowerFromBlockPattern; @@ -29,12 +30,12 @@ public BYGMushroomBlock(Properties $$0, TagKey groundTag) { } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter blockGetter, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter blockGetter, @NotNull BlockPos pos) { return state.is(this.groundTag); } @Override - public boolean growMushroom(ServerLevel serverLevel, BlockPos pos, BlockState state, RandomSource random) { + public boolean growMushroom(@NotNull ServerLevel serverLevel, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull RandomSource random) { return this.growFeature(this, serverLevel, pos, random); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGNylium.java b/Common/src/main/java/potionstudios/byg/common/block/BYGNylium.java index db6d8da669..1a477e12e4 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGNylium.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGNylium.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.NyliumBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.NyliumBlockAccess; import java.util.function.Supplier; @@ -27,24 +28,24 @@ public BYGNylium(Properties properties, Supplier configuredFeature = world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).get(this.feature.get()); configuredFeature.place(world, world.getChunkSource().getGenerator(), rand, pos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGPollenBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGPollenBlock.java index 97cd65fb7a..4560f176d5 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGPollenBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGPollenBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; public class BYGPollenBlock extends Block { @@ -20,13 +21,13 @@ protected BYGPollenBlock(Properties builder) { } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { if (entityIn instanceof LivingEntity && entityIn.getType() != EntityType.BEE && entityIn.getType() != EntityType.BAT) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); } } - public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) { + public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { VoxelShape lvt_5_1_ = this.getShape(stateIn, worldIn, pos, CollisionContext.empty()); Vec3 lvt_6_1_ = lvt_5_1_.bounds().getCenter(); double lvt_7_1_ = (double) pos.getX() + lvt_6_1_.x; diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGScaffoldingBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGScaffoldingBlock.java index 5da9520163..3e1d49f942 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGScaffoldingBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGScaffoldingBlock.java @@ -22,7 +22,7 @@ public BYGScaffoldingBlock(Properties properties) { } @Override - public boolean canBeReplaced(BlockState state, @NotNull BlockPlaceContext useContext) { + public boolean canBeReplaced(@NotNull BlockState state, @NotNull BlockPlaceContext useContext) { return useContext.getItemInHand().getItem() == this.asItem(); } @@ -31,15 +31,15 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext $$0) { BlockPos $$1 = $$0.getClickedPos(); Level $$2 = $$0.getLevel(); int $$3 = getBlockDistance($$2, $$1); - return (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(WATERLOGGED, $$2.getFluidState($$1).getType() == Fluids.WATER)).setValue(DISTANCE, $$3)).setValue(BOTTOM, this.isBottom($$2, $$1, $$3)); + return this.defaultBlockState().setValue(WATERLOGGED, $$2.getFluidState($$1).getType() == Fluids.WATER).setValue(DISTANCE, $$3).setValue(BOTTOM, this.isBottom($$2, $$1, $$3)); } @Override - public void tick(@NotNull BlockState $$0, ServerLevel $$1, BlockPos $$2, RandomSource $$3) { + public void tick(@NotNull BlockState $$0, @NotNull ServerLevel $$1, @NotNull BlockPos $$2, @NotNull RandomSource $$3) { int $$4 = getBlockDistance($$1, $$2); - BlockState $$5 = (BlockState)((BlockState)$$0.setValue(DISTANCE, $$4)).setValue(BOTTOM, this.isBottom($$1, $$2, $$4)); - if ((Integer)$$5.getValue(DISTANCE) == 7) { - if ((Integer)$$0.getValue(DISTANCE) == 7) { + BlockState $$5 = $$0.setValue(DISTANCE, $$4).setValue(BOTTOM, this.isBottom($$1, $$2, $$4)); + if ($$5.getValue(DISTANCE) == 7) { + if ($$0.getValue(DISTANCE) == 7) { FallingBlockEntity.fall($$1, $$2, $$5); } else { $$1.destroyBlock($$2, true); @@ -51,12 +51,12 @@ public void tick(@NotNull BlockState $$0, ServerLevel $$1, BlockPos $$2, RandomS } @Override - public boolean canSurvive(BlockState $$0, LevelReader $$1, BlockPos $$2) { + public boolean canSurvive(@NotNull BlockState $$0, @NotNull LevelReader $$1, @NotNull BlockPos $$2) { return getBlockDistance($$1, $$2) < 7; } @Override - public void onPlace(BlockState $$0, Level $$1, BlockPos $$2, BlockState $$3, boolean $$4) { + public void onPlace(@NotNull BlockState $$0, Level $$1, @NotNull BlockPos $$2, @NotNull BlockState $$3, boolean $$4) { if (!$$1.isClientSide) { $$1.scheduleTick($$2, this, 1); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGSnowyPlants.java b/Common/src/main/java/potionstudios/byg/common/block/BYGSnowyPlants.java index f1493250ca..8851da8791 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGSnowyPlants.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGSnowyPlants.java @@ -10,6 +10,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; public class BYGSnowyPlants extends BushBlock { protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D); @@ -23,13 +24,13 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { Vec3 vector3d = state.getOffset(worldIn, pos); return SHAPE.move(vector3d.x, vector3d.y, vector3d.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { Block block = state.getBlock(); return block == Blocks.SNOW_BLOCK || state.is(BlockTags.DIRT); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BYGTallFlowerBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BYGTallFlowerBlock.java index 761010a9eb..2f8794f5a7 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BYGTallFlowerBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BYGTallFlowerBlock.java @@ -6,6 +6,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.TallFlowerBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; public class BYGTallFlowerBlock extends TallFlowerBlock { private final TagKey validGround; @@ -16,7 +17,7 @@ public BYGTallFlowerBlock(Properties properties, TagKey validGround) { } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter world, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) { return state.is(validGround); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/BaobabFruitBlock.java b/Common/src/main/java/potionstudios/byg/common/block/BaobabFruitBlock.java index 367c32a533..f1d6ad06d4 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/BaobabFruitBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/BaobabFruitBlock.java @@ -25,6 +25,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.item.BYGItems; public class BaobabFruitBlock extends Block implements BonemealableBlock { @@ -37,12 +38,12 @@ public BaobabFruitBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.BAOBAB_FRUIT.get()); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -59,7 +60,7 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.above(); BlockState blockstate = worldIn.getBlockState(blockpos); Block block = blockstate.getBlock(); @@ -67,12 +68,12 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!state.canSurvive(worldIn, pos)) { worldIn.destroyBlock(pos.above(), true); } @@ -82,7 +83,7 @@ public boolean isRandomlyTicking(BlockState state) { return state.getValue(AGE) < 3; } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource random) { int i = state.getValue(AGE); if (i < 3 && worldIn.getRawBrightness(pos.above(), 0) >= 9 && random.nextInt(5) == 0) { worldIn.setBlock(pos, state.setValue(AGE, i + 1), 2); @@ -90,15 +91,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, BlockState state, boolean isClient) { return state.getValue(AGE) < 3; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, BlockState state) { int i = Math.min(3, state.getValue(AGE) + 1); worldIn.setBlock(pos, state.setValue(AGE, i), 2); } @@ -107,7 +108,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder mayPlaceOn) { } @Override - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { if (entityIn instanceof LivingEntity && entityIn.getType() != EntityType.PIGLIN && entityIn.getType() != EntityType.MAGMA_CUBE && entityIn.getType() != EntityType.ZOMBIFIED_PIGLIN && entityIn.getType() != EntityType.GHAST) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); double d0 = Math.abs(entityIn.getX() - entityIn.xOld); diff --git a/Common/src/main/java/potionstudios/byg/common/block/EtherBulbsBlock.java b/Common/src/main/java/potionstudios/byg/common/block/EtherBulbsBlock.java index 1099ebd1e2..ad1576a2ef 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/EtherBulbsBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/EtherBulbsBlock.java @@ -27,6 +27,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.item.BYGItems; public class EtherBulbsBlock extends Block implements BonemealableBlock { @@ -39,12 +40,12 @@ public EtherBulbsBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.ETHER_BULBS.get()); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -61,7 +62,7 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.above(); BlockState blockstate = worldIn.getBlockState(blockpos); Block block = blockstate.getBlock(); @@ -69,12 +70,12 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!state.canSurvive(worldIn, pos)) { worldIn.destroyBlock(pos.above(), true); } @@ -84,7 +85,7 @@ public boolean isRandomlyTicking(BlockState state) { return state.getValue(AGE) < 3; } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource random) { int i = state.getValue(AGE); if (i < 3 && worldIn.getRawBrightness(pos.above(), 0) >= 9 && random.nextInt(5) == 0) { worldIn.setBlock(pos, state.setValue(AGE, i + 1), 2); @@ -92,15 +93,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, BlockState state, boolean isClient) { return state.getValue(AGE) < 3; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, BlockState state) { int i = Math.min(3, state.getValue(AGE) + 1); worldIn.setBlock(pos, state.setValue(AGE, i), 2); } @@ -109,12 +110,12 @@ protected void createBlockStateDefinition(StateDefinition.Builder blockT this.blockTagKey = blockTagKey; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos blockPos, CollisionContext context) { + public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos blockPos, @NotNull CollisionContext context) { return VOXEL_SHAPE; } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter level, @NotNull BlockPos pos) { return Block.isFaceFull(state.getCollisionShape(level, pos), Direction.UP) || (blockTagKey != null && state.is(this.blockTagKey)); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/FloweringJacarandaBushBlock.java b/Common/src/main/java/potionstudios/byg/common/block/FloweringJacarandaBushBlock.java index 53c4864fd5..741a3016a1 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/FloweringJacarandaBushBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/FloweringJacarandaBushBlock.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.feature.gen.overworld.trees.util.TreeSpawner; public class FloweringJacarandaBushBlock extends JacarandaBushBlock implements BonemealableBlock { @@ -31,18 +32,13 @@ public void grow(ServerLevel world, BlockPos pos, BlockState state, RandomSource } } - @Override - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { - return true; - } - - @Override - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + @Override + public boolean isBonemealSuccess(Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return (double) worldIn.random.nextFloat() < 0.45D; } @Override - public void performBonemeal(ServerLevel world, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel world, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { this.grow(world, pos, state, rand); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/FloweringPaloVerdeLeavesBlock.java b/Common/src/main/java/potionstudios/byg/common/block/FloweringPaloVerdeLeavesBlock.java index 4cb90d8158..5ecfe854e0 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/FloweringPaloVerdeLeavesBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/FloweringPaloVerdeLeavesBlock.java @@ -14,7 +14,7 @@ public FloweringPaloVerdeLeavesBlock(Properties properties) { } @Override - public void animateTick(BlockState $$0, @NotNull Level $$1, @NotNull BlockPos $$2, @NotNull RandomSource $$3) { + public void animateTick(@NotNull BlockState $$0, @NotNull Level $$1, @NotNull BlockPos $$2, @NotNull RandomSource $$3) { int $$4 = $$2.getX(); int $$5 = $$2.getY(); int $$6 = $$2.getZ(); diff --git a/Common/src/main/java/potionstudios/byg/common/block/GreenAppleFruitBlock.java b/Common/src/main/java/potionstudios/byg/common/block/GreenAppleFruitBlock.java index deeb3946c0..58fe666b1c 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/GreenAppleFruitBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/GreenAppleFruitBlock.java @@ -25,6 +25,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.item.BYGItems; public class GreenAppleFruitBlock extends Block implements BonemealableBlock { @@ -37,12 +38,12 @@ public GreenAppleFruitBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.GREEN_APPLE.get()); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -59,7 +60,7 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.above(); BlockState blockstate = worldIn.getBlockState(blockpos); Block block = blockstate.getBlock(); @@ -67,12 +68,12 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!state.canSurvive(worldIn, pos)) { worldIn.destroyBlock(pos.above(), true); } @@ -82,7 +83,7 @@ public boolean isRandomlyTicking(BlockState state) { return state.getValue(AGE) < 3; } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource random) { int i = state.getValue(AGE); if (i < 3 && worldIn.getRawBrightness(pos.above(), 0) >= 9 && random.nextInt(5) == 0) { worldIn.setBlock(pos, state.setValue(AGE, i + 1), 2); @@ -90,15 +91,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, BlockState state, boolean isClient) { return state.getValue(AGE) < 3; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, BlockState state) { int i = Math.min(3, state.getValue(AGE) + 1); worldIn.setBlock(pos, state.setValue(AGE, i), 2); } @@ -107,7 +108,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder validGround; @@ -26,17 +27,17 @@ protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos @Override - public boolean isValidBonemealTarget(LevelReader blockGetter, BlockPos blockPos, BlockState blockState, boolean b) { + public boolean isValidBonemealTarget(@NotNull LevelReader blockGetter, @NotNull BlockPos blockPos, @NotNull BlockState blockState, boolean b) { return true; } @Override - public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos blockPos, BlockState blockState) { + public boolean isBonemealSuccess(@NotNull Level level, @NotNull RandomSource random, @NotNull BlockPos blockPos, @NotNull BlockState blockState) { return true; } @Override - public void performBonemeal(ServerLevel serverLevel, RandomSource random, BlockPos blockPos, BlockState blockState) { + public void performBonemeal(ServerLevel serverLevel, @NotNull RandomSource random, @NotNull BlockPos blockPos, @NotNull BlockState blockState) { serverLevel.setBlockAndUpdate(blockPos, BYGBlocks.HYDRANGEA_HEDGE.defaultBlockState()); serverLevel.neighborChanged(blockPos, BYGBlocks.HYDRANGEA_HEDGE.get(), blockPos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/HydrangeaHedgeBlock.java b/Common/src/main/java/potionstudios/byg/common/block/HydrangeaHedgeBlock.java index f85502fb0e..f0518ca9cb 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/HydrangeaHedgeBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/HydrangeaHedgeBlock.java @@ -21,6 +21,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.BYGTags; public class HydrangeaHedgeBlock extends AzaleaBlock { @@ -34,18 +35,18 @@ protected HydrangeaHedgeBlock(Properties properties, TagKey validGround) } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(validGround); } @Override - public VoxelShape getShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) { + public @NotNull VoxelShape getShape(@NotNull BlockState blockState, @NotNull BlockGetter blockGetter, @NotNull BlockPos blockPos, @NotNull CollisionContext collisionContext) { return SHAPE; } @Override - public InteractionResult use(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) { + public @NotNull InteractionResult use(@NotNull BlockState blockState, Level level, BlockPos blockPos, Player player, @NotNull InteractionHand interactionHand, @NotNull BlockHitResult blockHitResult) { RandomSource random = level.random; BlockPos blockPos2 = blockPos.below(); @@ -63,16 +64,16 @@ public InteractionResult use(BlockState blockState, Level level, BlockPos blockP } @Override - public boolean isValidBonemealTarget(LevelReader $$0, BlockPos $$1, BlockState $$2, boolean $$3) { + public boolean isValidBonemealTarget(@NotNull LevelReader $$0, @NotNull BlockPos $$1, @NotNull BlockState $$2, boolean $$3) { return false; } @Override - public boolean isBonemealSuccess(Level $$0, RandomSource $$1, BlockPos $$2, BlockState $$3) { + public boolean isBonemealSuccess(@NotNull Level $$0, @NotNull RandomSource $$1, @NotNull BlockPos $$2, @NotNull BlockState $$3) { return false; } @Override - public void performBonemeal(ServerLevel $$0, RandomSource $$1, BlockPos $$2, BlockState $$3) { + public void performBonemeal(@NotNull ServerLevel $$0, @NotNull RandomSource $$1, @NotNull BlockPos $$2, @NotNull BlockState $$3) { } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/IndigoJacarandaBushBlock.java b/Common/src/main/java/potionstudios/byg/common/block/IndigoJacarandaBushBlock.java index f34d41034b..4d7aef90d4 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/IndigoJacarandaBushBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/IndigoJacarandaBushBlock.java @@ -5,6 +5,7 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; public class IndigoJacarandaBushBlock extends JacarandaBushBlock implements BonemealableBlock { @@ -13,7 +14,7 @@ public IndigoJacarandaBushBlock(Properties properties) { } @Override - public void performBonemeal(ServerLevel world, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel world, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { JacarandaBushBlock flowering = (JacarandaBushBlock) (this == BYGBlocks.INDIGO_JACARANDA_BUSH.get() ? BYGBlocks.FLOWERING_INDIGO_JACARANDA_BUSH.get() : BYGBlocks.FLOWERING_INDIGO_JACARANDA_BUSH.get()); if (flowering.defaultBlockState().canSurvive(world, pos)) { flowering.placeAt(world, pos, 1); diff --git a/Common/src/main/java/potionstudios/byg/common/block/JacarandaBushBlock.java b/Common/src/main/java/potionstudios/byg/common/block/JacarandaBushBlock.java index a20b14eca6..a5b0cf8d3a 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/JacarandaBushBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/JacarandaBushBlock.java @@ -9,6 +9,7 @@ import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.BushBlock; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; public class JacarandaBushBlock extends BushBlock implements BonemealableBlock { @@ -17,17 +18,17 @@ public JacarandaBushBlock(Properties properties) { } @Override - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, @NotNull BlockState state, boolean isClient) { return true; } @Override - public boolean isBonemealSuccess(Level p_180670_1_, RandomSource p_180670_2_, BlockPos p_180670_3_, BlockState p_180670_4_) { + public boolean isBonemealSuccess(@NotNull Level p_180670_1_, @NotNull RandomSource p_180670_2_, @NotNull BlockPos p_180670_3_, @NotNull BlockState p_180670_4_) { return true; } @Override - public void performBonemeal(ServerLevel world, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel world, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { JacarandaBushBlock flowering = (JacarandaBushBlock) (this == BYGBlocks.JACARANDA_BUSH.get() ? BYGBlocks.FLOWERING_JACARANDA_BUSH.get() : BYGBlocks.FLOWERING_JACARANDA_BUSH.get()); if (flowering.defaultBlockState().canSurvive(world, pos)) { flowering.placeAt(world, pos, 1); diff --git a/Common/src/main/java/potionstudios/byg/common/block/JoshuaFruitBlock.java b/Common/src/main/java/potionstudios/byg/common/block/JoshuaFruitBlock.java index 4748960430..f620bc92d8 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/JoshuaFruitBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/JoshuaFruitBlock.java @@ -25,6 +25,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.item.BYGItems; public class JoshuaFruitBlock extends Block implements BonemealableBlock { @@ -37,12 +38,12 @@ public JoshuaFruitBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.JOSHUA_FRUIT.get()); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -59,7 +60,7 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.above(); BlockState blockstate = worldIn.getBlockState(blockpos); Block block = blockstate.getBlock(); @@ -67,12 +68,12 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!state.canSurvive(worldIn, pos)) { worldIn.destroyBlock(pos.above(), true); } @@ -82,7 +83,7 @@ public boolean isRandomlyTicking(BlockState state) { return state.getValue(AGE) < 3; } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource random) { int i = state.getValue(AGE); if (i < 3 && worldIn.getRawBrightness(pos.above(), 0) >= 9 && random.nextInt(5) == 0) { worldIn.setBlock(pos, state.setValue(AGE, i + 1), 2); @@ -90,15 +91,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, BlockState state, boolean isClient) { return state.getValue(AGE) < 3; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, BlockState state) { int i = Math.min(3, state.getValue(AGE) + 1); worldIn.setBlock(pos, state.setValue(AGE, i), 2); } @@ -107,7 +108,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder 0 && (entityIn.xOld != entityIn.getX() || entityIn.zOld != entityIn.getZ())) { @@ -95,7 +96,7 @@ public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity e } - public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) { + public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { VoxelShape lvt_5_1_ = this.getShape(stateIn, worldIn, pos, CollisionContext.empty()); Vec3 lvt_6_1_ = lvt_5_1_.bounds().getCenter(); double lvt_7_1_ = (double) pos.getX() + lvt_6_1_.x; diff --git a/Common/src/main/java/potionstudios/byg/common/block/end/shattereddesert/OddityCactusBlock.java b/Common/src/main/java/potionstudios/byg/common/block/end/shattereddesert/OddityCactusBlock.java index e5eb5ffb34..7093cb1d69 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/end/shattereddesert/OddityCactusBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/end/shattereddesert/OddityCactusBlock.java @@ -23,6 +23,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class OddityCactusBlock extends Block { @@ -35,7 +36,7 @@ public OddityCactusBlock(Properties properties) { this.registerDefaultState(this.stateDefinition.any().setValue(AGE, 0)); } - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(@NotNull BlockState state, ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!worldIn.isLoaded(pos)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!state.canSurvive(worldIn, pos)) { @@ -44,7 +45,7 @@ public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSour } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(@NotNull BlockState state, ServerLevel worldIn, BlockPos pos, @NotNull RandomSource random) { BlockPos blockpos = pos.above(); if (worldIn.isEmptyBlock(blockpos)) { int i; @@ -65,15 +66,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } } - public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getCollisionShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return COLLISION_SHAPE; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return OUTLINE_SHAPE; } - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { if (!stateIn.canSurvive(worldIn, currentPos)) { worldIn.scheduleTick(currentPos, this, 1); } @@ -82,7 +83,7 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, @NotNull BlockPos pos) { for (Direction direction : Direction.Plane.HORIZONTAL) { BlockState blockstate = worldIn.getBlockState(pos.relative(direction)); Material material = blockstate.getMaterial(); @@ -94,7 +95,7 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { return worldIn.getBlockState(pos.below()).getBlock() == Blocks.END_STONE || worldIn.getBlockState(pos.below()).getBlock() == Blocks.END_STONE_BRICKS || worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.END_SAND.get() || worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.ODDITY_CACTUS.get() && !worldIn.getBlockState(pos.above()).getMaterial().isLiquid(); } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { if (entityIn instanceof LivingEntity && entityIn.getType() != EntityType.ENDERMITE && entityIn.getType() != EntityType.ENDERMAN) entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); entityIn.hurt(entityIn.damageSources().cactus(), 2.0F); @@ -104,7 +105,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(@NotNull Level level, @NotNull BlockState blockState, @NotNull BlockEntityType blockEntityType) { return createTickerHelper(blockEntityType, BYGBlockEntities.HYPOGEAL.get(), HypogealImperiumBlockEntity::tick); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/crimson/CrimsonBerryBushBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/crimson/CrimsonBerryBushBlock.java index fa64b86f9c..acd9dfc108 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/crimson/CrimsonBerryBushBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/crimson/CrimsonBerryBushBlock.java @@ -22,6 +22,7 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.item.BYGItems; import potionstudios.byg.util.MLBlockTags; @@ -34,12 +35,12 @@ public CrimsonBerryBushBlock(Properties properties) { } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.CRIMSON_BERRIES.get()); } @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + public @NotNull InteractionResult use(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) { int i = state.getValue(AGE); boolean flag = i == 3; if (!flag && player.getItemInHand(handIn).getItem() == Items.BONE_MEAL) { @@ -56,19 +57,19 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(BlockTags.NYLIUM) || state.is(MLBlockTags.NETHERRACK) || super.mayPlaceOn(state, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } @Override - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { if (entityIn instanceof LivingEntity && entityIn.getType() != EntityType.PIGLIN && entityIn.getType() != EntityType.HOGLIN) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); if (!worldIn.isClientSide && state.getValue(AGE) > 0 && (entityIn.xOld != entityIn.getX() || entityIn.zOld != entityIn.getZ())) { diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/BlueNetherrackBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/BlueNetherrackBlock.java index 0e1f67875c..7df09c63d7 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/BlueNetherrackBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/BlueNetherrackBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class BlueNetherrackBlock extends Block implements BonemealableBlock { @@ -23,7 +24,7 @@ protected BlueNetherrackBlock(Properties builder) { /** * Whether this IGrowable can grow */ - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, @NotNull BlockState state, boolean isClient) { if (worldIn.getBlockState(pos.above()).propagatesSkylightDown(worldIn, pos)) { for (BlockPos blockpos : BlockPos.betweenClosed(pos.offset(-1, -1, -1), pos.offset(1, 1, 1))) { if (worldIn.getBlockState(blockpos).is(BlockTags.NYLIUM)) { @@ -35,11 +36,11 @@ public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockSta return false; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel worldIn, @NotNull RandomSource rand, BlockPos pos, @NotNull BlockState state) { boolean flag = false; boolean flag1 = false; diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburPlantBlock.java index 3a50399a06..057315335f 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburPlantBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class EmburPlantBlock extends BushBlock implements BonemealableBlock { @@ -25,16 +26,16 @@ protected EmburPlantBlock(Properties builder) { /** * Whether this IGrowable can grow */ - public boolean isValidBonemealTarget(LevelReader worldIn, BlockPos pos, BlockState state, boolean isClient) { + public boolean isValidBonemealTarget(@NotNull LevelReader worldIn, @NotNull BlockPos pos, @NotNull BlockState state, boolean isClient) { return true; } - public boolean isBonemealSuccess(Level worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(@NotNull Level worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { return true; } - public void performBonemeal(ServerLevel worldIn, RandomSource rand, BlockPos pos, BlockState state) { + public void performBonemeal(@NotNull ServerLevel worldIn, @NotNull RandomSource rand, @NotNull BlockPos pos, @NotNull BlockState state) { DoublePlantBlock doubleplantblock = BYGBlocks.TALL_EMBUR_ROOTS.get(); if (doubleplantblock.defaultBlockState().canSurvive(worldIn, pos) && worldIn.isEmptyBlock(pos.above())) { DoublePlantBlock.placeAt(worldIn, doubleplantblock.defaultBlockState(), pos, Block.UPDATE_CLIENTS); @@ -46,18 +47,18 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos pos, CollisionContext ctx) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter reader, @NotNull BlockPos pos, @NotNull CollisionContext ctx) { Vec3 vector = state.getOffset(reader, pos); return SHAPE.move(vector.x, vector.y, vector.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(BlockTags.NYLIUM) || state.is(Blocks.MYCELIUM) || state.is(Blocks.SOUL_SOIL) || super.mayPlaceOn(state, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVineBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVineBlock.java index d5120dc6b1..71cd8ba3e9 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVineBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVineBlock.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.block.NetherVines; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class EmburVineBlock extends GrowingPlantHeadBlock { @@ -22,15 +23,15 @@ public EmburVineBlock(Properties properties) { * Used to determine how much to grow the plant when using bonemeal. Kelp always returns 1, where as the nether vines * return a RandomSource value at least 1. */ - protected int getBlocksToGrowWhenBonemealed(RandomSource rand) { + protected int getBlocksToGrowWhenBonemealed(@NotNull RandomSource rand) { return NetherVines.getBlocksToGrowWhenBonemealed(rand); } - protected Block getBodyBlock() { + protected @NotNull Block getBodyBlock() { return BYGBlocks.EMBUR_GEL_VINES_PLANT.get(); } - protected boolean canGrowInto(BlockState state) { + protected boolean canGrowInto(@NotNull BlockState state) { return NetherVines.isValidGrowthState(state); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVinePlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVinePlantBlock.java index 72a14178d1..8df70ca73e 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVinePlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/embur/EmburVinePlantBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class EmburVinePlantBlock extends GrowingPlantBodyBlock { @@ -19,11 +20,11 @@ public EmburVinePlantBlock(Properties properties) { super(properties, Direction.DOWN, SHAPE, true); } - protected GrowingPlantHeadBlock getHeadBlock() { + protected @NotNull GrowingPlantHeadBlock getHeadBlock() { return (GrowingPlantHeadBlock) BYGBlocks.EMBUR_GEL_VINES.get(); } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, Entity entityIn) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesBlock.java index b3f8c559f3..23d3ec9e2f 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class HangingVinesBlock extends GrowingPlantHeadBlock { @@ -25,20 +26,20 @@ protected HangingVinesBlock(Properties properties) { * Used to determine how much to grow the plant when using bonemeal. Kelp always returns 1, where as the nether vines * return a RandomSource value at least 1. */ - protected int getBlocksToGrowWhenBonemealed(RandomSource rand) { + protected int getBlocksToGrowWhenBonemealed(@NotNull RandomSource rand) { return NetherVines.getBlocksToGrowWhenBonemealed(rand); } - protected Block getBodyBlock() { + protected @NotNull Block getBodyBlock() { return BYGBlocks.WEEPING_ROOTS_PLANT.get(); } - protected boolean canGrowInto(BlockState state) { + protected boolean canGrowInto(@NotNull BlockState state) { return NetherVines.isValidGrowthState(state); } - public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) { + public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { VoxelShape lvt_5_1_ = this.getShape(stateIn, worldIn, pos, CollisionContext.empty()); Vec3 lvt_6_1_ = lvt_5_1_.bounds().getCenter(); double lvt_7_1_ = (double) pos.getX() + lvt_6_1_.x; diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesPlantBlock.java index 3beecf84d3..86c2679135 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/HangingVinesPlantBlock.java @@ -5,6 +5,7 @@ import net.minecraft.world.level.block.GrowingPlantBodyBlock; import net.minecraft.world.level.block.GrowingPlantHeadBlock; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class HangingVinesPlantBlock extends GrowingPlantBodyBlock { @@ -14,7 +15,7 @@ protected HangingVinesPlantBlock(Properties properties) { super(properties, Direction.DOWN, SHAPE, false); } - protected GrowingPlantHeadBlock getHeadBlock() { + protected @NotNull GrowingPlantHeadBlock getHeadBlock() { return (GrowingPlantHeadBlock) BYGBlocks.WEEPING_ROOTS.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeBlock.java index 88f49d87cf..2a3d4e90b1 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeBlock.java @@ -5,6 +5,7 @@ import net.minecraft.world.level.block.GrowingPlantBodyBlock; import net.minecraft.world.level.block.GrowingPlantHeadBlock; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class SoulShroomSporeBlock extends GrowingPlantBodyBlock { @@ -14,7 +15,7 @@ protected SoulShroomSporeBlock(Properties properties) { super(properties, Direction.DOWN, SHAPE, false); } - protected GrowingPlantHeadBlock getHeadBlock() { + protected @NotNull GrowingPlantHeadBlock getHeadBlock() { return (GrowingPlantHeadBlock) BYGBlocks.SOUL_SHROOM_SPORE_END.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeEndBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeEndBlock.java index d55ef22d72..5e7061f9d2 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeEndBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/glowstonegardens/SoulShroomSporeEndBlock.java @@ -12,6 +12,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class SoulShroomSporeEndBlock extends GrowingPlantHeadBlock { @@ -25,20 +26,20 @@ protected SoulShroomSporeEndBlock(Properties properties) { * Used to determine how much to grow the plant when using bonemeal. Kelp always returns 1, where as the nether vines * return a RandomSource value at least 1. */ - protected int getBlocksToGrowWhenBonemealed(RandomSource rand) { + protected int getBlocksToGrowWhenBonemealed(@NotNull RandomSource rand) { return NetherVines.getBlocksToGrowWhenBonemealed(rand); } - protected Block getBodyBlock() { + protected @NotNull Block getBodyBlock() { return BYGBlocks.SOUL_SHROOM_SPORE.get(); } - protected boolean canGrowInto(BlockState state) { + protected boolean canGrowInto(@NotNull BlockState state) { return NetherVines.isValidGrowthState(state); } - public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) { + public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { VoxelShape lvt_5_1_ = this.getShape(stateIn, worldIn, pos, CollisionContext.empty()); Vec3 lvt_6_1_ = lvt_5_1_.bounds().getCenter(); double lvt_7_1_ = (double) pos.getX() + lvt_6_1_.x; diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/scorched/ScorchedPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/scorched/ScorchedPlantBlock.java index 3ef21b068a..5cb3df9f05 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/scorched/ScorchedPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/scorched/ScorchedPlantBlock.java @@ -11,6 +11,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.util.MLBlockTags; public class ScorchedPlantBlock extends BushBlock { @@ -25,18 +26,18 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { Vec3 lvt_5_1_ = state.getOffset(worldIn, pos); return SHAPE.move(lvt_5_1_.x, lvt_5_1_.y, lvt_5_1_.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(BlockTags.NYLIUM) || state.is(Blocks.MYCELIUM) || state.is(Blocks.SOUL_SOIL) || state.is(BlockTags.BASE_STONE_NETHER) || state.is(MLBlockTags.END_STONES)|| super.mayPlaceOn(state, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/BuddingSubzeroCrystalBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/BuddingSubzeroCrystalBlock.java index 9b158ee690..e15cb30b84 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/BuddingSubzeroCrystalBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/BuddingSubzeroCrystalBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.PushReaction; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class BuddingSubzeroCrystalBlock extends Block { @@ -19,11 +20,11 @@ public BuddingSubzeroCrystalBlock(Properties builder) { super(builder); } - public PushReaction getPistonPushReaction(BlockState state) { + public @NotNull PushReaction getPistonPushReaction(@NotNull BlockState state) { return PushReaction.DESTROY; } - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + public void randomTick(@NotNull BlockState state, @NotNull ServerLevel world, @NotNull BlockPos pos, RandomSource random) { if (random.nextInt(5) == 0) { Direction direction = DIRECTIONS[random.nextInt(DIRECTIONS.length)]; BlockPos blockPos = pos.relative(direction); diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/SubzeroAshBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/SubzeroAshBlock.java index 1f4aff690a..6a8da47360 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/SubzeroAshBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/subzerohypogeal/SubzeroAshBlock.java @@ -16,6 +16,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -28,40 +29,36 @@ protected SubzeroAshBlock(Properties properties) { this.registerDefaultState(this.stateDefinition.any().setValue(LAYERS, 1)); } - public boolean isPathfindable(BlockState state, BlockGetter worldIn, BlockPos pos, PathComputationType type) { - switch (type) { - case LAND: - return state.getValue(LAYERS) < 5; - case WATER: - return false; - case AIR: - return false; - default: - return false; - } + public boolean isPathfindable(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, PathComputationType type) { + return switch (type) { + case LAND -> state.getValue(LAYERS) < 5; + case WATER -> false; + case AIR -> false; + default -> false; + }; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return SHAPES[state.getValue(LAYERS)]; } - public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getCollisionShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return SHAPES[state.getValue(LAYERS) - 1]; } - public VoxelShape getBlockSupportShape(BlockState state, BlockGetter reader, BlockPos pos) { + public @NotNull VoxelShape getBlockSupportShape(BlockState state, @NotNull BlockGetter reader, @NotNull BlockPos pos) { return SHAPES[state.getValue(LAYERS)]; } - public VoxelShape getVisualShape(BlockState state, BlockGetter reader, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getVisualShape(BlockState state, @NotNull BlockGetter reader, @NotNull BlockPos pos, @NotNull CollisionContext context) { return SHAPES[state.getValue(LAYERS)]; } - public boolean useShapeForLightOcclusion(BlockState state) { + public boolean useShapeForLightOcclusion(@NotNull BlockState state) { return true; } - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockState blockstate = worldIn.getBlockState(pos.below()); if (!blockstate.is(Blocks.ICE) && !blockstate.is(Blocks.PACKED_ICE) && !blockstate.is(Blocks.BARRIER)) { if (!blockstate.is(Blocks.HONEY_BLOCK) && !blockstate.is(Blocks.SOUL_SAND)) { @@ -74,7 +71,7 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { } } - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { return !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/BYGSythianPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/BYGSythianPlantBlock.java index 9e36a267aa..fd5b54fd9e 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/BYGSythianPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/BYGSythianPlantBlock.java @@ -11,6 +11,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; public class BYGSythianPlantBlock extends BushBlock { protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D); @@ -24,18 +25,18 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { Vec3 lvt_5_1_ = state.getOffset(worldIn, pos); return SHAPE.move(lvt_5_1_.x, lvt_5_1_.y, lvt_5_1_.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(BlockTags.NYLIUM) || state.is(Blocks.MYCELIUM) || state.is(Blocks.SOUL_SOIL) || super.mayPlaceOn(state, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsBlock.java index 3f2ebbd399..058a0d5e75 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsBlock.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class HangingSythanRootsBlock extends GrowingPlantHeadBlock { @@ -24,15 +25,15 @@ protected HangingSythanRootsBlock(Properties properties) { * Used to determine how much to grow the plant when using bonemeal. Kelp always returns 1, where as the nether vines * return a RandomSource value at least 1. */ - protected int getBlocksToGrowWhenBonemealed(RandomSource rand) { + protected int getBlocksToGrowWhenBonemealed(@NotNull RandomSource rand) { return NetherVines.getBlocksToGrowWhenBonemealed(rand); } - protected Block getBodyBlock() { + protected @NotNull Block getBodyBlock() { return BYGBlocks.HANGING_SYTHIAN_ROOTS_PLANT.get(); } - protected boolean canGrowInto(BlockState state) { + protected boolean canGrowInto(@NotNull BlockState state) { return NetherVines.isValidGrowthState(state); } @@ -51,7 +52,7 @@ protected boolean canGrowInto(BlockState state) { // // } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, Entity entityIn) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsPlantBlock.java index 51b5a2f722..f9cc199e75 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/HangingSythanRootsPlantBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class HangingSythanRootsPlantBlock extends GrowingPlantBodyBlock { @@ -19,11 +20,11 @@ protected HangingSythanRootsPlantBlock(Properties properties) { super(properties, Direction.DOWN, SHAPE, false); } - protected GrowingPlantHeadBlock getHeadBlock() { + protected @NotNull GrowingPlantHeadBlock getHeadBlock() { return (GrowingPlantHeadBlock) BYGBlocks.HANGING_SYTHIAN_ROOTS.get(); } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, Entity entityIn) { entityIn.makeStuckInBlock(state, new Vec3(0.8F, 0.75D, 0.8F)); } } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/SythianSaplingBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/SythianSaplingBlock.java index 0db3e6b55a..2abe1e4a36 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/SythianSaplingBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/sythian/SythianSaplingBlock.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BambooLeaves; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; import potionstudios.byg.common.item.BYGItems; @@ -23,12 +24,12 @@ public SythianSaplingBlock(Properties properties) { } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { return worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.SYTHIAN_NYLIUM.get(); } @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { if (!stateIn.canSurvive(worldIn, currentPos)) { return Blocks.AIR.defaultBlockState(); } else { @@ -41,7 +42,7 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f } @Override - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(@NotNull BlockState state, @NotNull ServerLevel worldIn, @NotNull BlockPos pos, RandomSource rand) { if (rand.nextInt(3) == 0 && worldIn.isEmptyBlock(pos.above()) && worldIn.getRawBrightness(pos.above(), 0) <= 12) { this.growBamboo(worldIn, pos); } @@ -49,7 +50,7 @@ public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSour } @Override - public ItemStack getCloneItemStack(BlockGetter worldIn, BlockPos pos, BlockState state) { + public @NotNull ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { return new ItemStack(BYGItems.SYTHIAN_STALK_BLOCK.get()); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/HangingBonesBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/HangingBonesBlock.java index b3373f4b5f..1d8942837d 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/HangingBonesBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/HangingBonesBlock.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; import javax.annotation.Nullable; @@ -25,7 +26,7 @@ protected HangingBonesBlock(Properties properties) { super(properties); } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return SHAPE; } @@ -54,7 +55,7 @@ public BlockState getStateForPlacement(BlockPlaceContext ctx) { @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { if (!stateIn.canSurvive(worldIn, currentPos)) { return Blocks.AIR.defaultBlockState(); } else { @@ -67,12 +68,12 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f } - public float getDestroyProgress(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { + public float getDestroyProgress(@NotNull BlockState state, Player player, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return player.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(state, player, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { if (worldIn.getBlockState(pos.above()).isAir()) return false; return worldIn.getBlockState(pos.above()).getBlock() == this || worldIn.getBlockState(pos.above()).getBlock() == Blocks.BONE_BLOCK; diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingBulbBlossomBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingBulbBlossomBlock.java index 04bff137ab..a30ccff6f7 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingBulbBlossomBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingBulbBlossomBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; public class WailingBulbBlossomBlock extends Block { public WailingBulbBlossomBlock(Properties builder) { @@ -17,7 +18,7 @@ public WailingBulbBlossomBlock(Properties builder) { } - public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) { + public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { VoxelShape lvt_5_1_ = this.getShape(stateIn, worldIn, pos, CollisionContext.empty()); Vec3 lvt_6_1_ = lvt_5_1_.bounds().getCenter(); double lvt_7_1_ = (double) pos.getX() + lvt_6_1_.x; diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingPlantBlock.java index 69030346a7..059c8c3a00 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/wailing/WailingPlantBlock.java @@ -10,6 +10,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class WailingPlantBlock extends BushBlock { @@ -23,18 +24,18 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos map, CollisionContext ctx) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter reader, @NotNull BlockPos map, @NotNull CollisionContext ctx) { Vec3 Vector3d = state.getOffset(reader, map); return SHAPE.move(Vector3d.x, Vector3d.y, Vector3d.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { return state.is(BYGBlocks.WAILING_NYLIUM.get()) || state.is(BlockTags.SOUL_FIRE_BASE_BLOCKS) || super.mayPlaceOn(state, worldIn, pos); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedBushBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedBushBlock.java index 32833abece..7a3ed13654 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedBushBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedBushBlock.java @@ -9,6 +9,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class BYGWarpedBushBlock extends BushBlock { @@ -23,20 +24,20 @@ public OffsetType getOffsetType() { return OffsetType.XZ; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { Vec3 lvt_5_1_ = state.getOffset(worldIn, pos); return SHAPE.move(lvt_5_1_.x, lvt_5_1_.y, lvt_5_1_.z); } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + protected boolean mayPlaceOn(BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos) { Block block = state.getBlock(); return block == BYGBlocks.WARPED_SOUL_SAND.get() || block == BYGBlocks.WARPED_SOUL_SOIL.get(); } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, BlockPos pos) { BlockPos blockpos = pos.below(); return this.mayPlaceOn(worldIn.getBlockState(blockpos), worldIn, blockpos); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedCoralPlantBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedCoralPlantBlock.java index 7eae50ab50..880d771022 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedCoralPlantBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/BYGWarpedCoralPlantBlock.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class BYGWarpedCoralPlantBlock extends BaseCoralPlantTypeBlock { @@ -18,7 +19,7 @@ protected BYGWarpedCoralPlantBlock(Properties properties) { this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false)); } - public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos blockPos, CollisionContext context) { + public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter reader, @NotNull BlockPos blockPos, @NotNull CollisionContext context) { return SHAPE; } @@ -27,7 +28,7 @@ protected boolean isValidGround(BlockState state) { } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, LevelReader worldIn, BlockPos pos) { BlockPos posDown = pos.below(); return this.isValidGround(worldIn.getBlockState(posDown)); } diff --git a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/WarpedCactusBlock.java b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/WarpedCactusBlock.java index a684b35849..2e118946eb 100644 --- a/Common/src/main/java/potionstudios/byg/common/block/nether/warped/WarpedCactusBlock.java +++ b/Common/src/main/java/potionstudios/byg/common/block/nether/warped/WarpedCactusBlock.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class WarpedCactusBlock extends Block { @@ -31,7 +32,7 @@ public WarpedCactusBlock(Properties properties) { this.registerDefaultState(this.stateDefinition.any().setValue(AGE, 0)); } - public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource rand) { + public void tick(@NotNull BlockState state, ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) { if (!worldIn.isLoaded(pos)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!state.canSurvive(worldIn, pos)) { @@ -40,7 +41,7 @@ public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSour } - public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) { + public void randomTick(@NotNull BlockState state, ServerLevel worldIn, BlockPos pos, @NotNull RandomSource random) { BlockPos blockpos = pos.above(); if (worldIn.isEmptyBlock(blockpos)) { int i; @@ -61,15 +62,15 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand } } - public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getCollisionShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return COLLISION_SHAPE; } - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { return OUTLINE_SHAPE; } - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + public @NotNull BlockState updateShape(BlockState stateIn, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor worldIn, @NotNull BlockPos currentPos, @NotNull BlockPos facingPos) { if (!stateIn.canSurvive(worldIn, currentPos)) { worldIn.scheduleTick(currentPos, this, 1); } @@ -78,7 +79,7 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f } @Override - public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader worldIn, @NotNull BlockPos pos) { for (Direction direction : Direction.Plane.HORIZONTAL) { BlockState blockstate = worldIn.getBlockState(pos.relative(direction)); Material material = blockstate.getMaterial(); @@ -90,7 +91,7 @@ public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { return worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.WARPED_SOUL_SOIL.get() || worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.WARPED_SOUL_SAND.get() || worldIn.getBlockState(pos.below()).getBlock() == BYGBlocks.WARPED_CACTUS.get() && !worldIn.getBlockState(pos.above()).getMaterial().isLiquid(); } - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { + public void entityInside(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, Entity entityIn) { entityIn.hurt(entityIn.damageSources().cactus(), 2.0F); } @@ -98,7 +99,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder> getPatterns(Block key) { return Optional.empty(); } - public static final Supplier DEFAULT = Suppliers.memoize(() -> { - return new GrowingPatterns(false, Suppliers.memoize(() -> { - Map> map = new TreeMap<>(Comparator.comparing(BuiltInRegistries.BLOCK::getKey)); - - map.put(BYGBlocks.ARAUCARIA_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), - SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ARAUCARIA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ARAUCARIA_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.ASPEN.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "x x", - " x ", - "x x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE5), 1) - .build()) - )); - map.put(BYGWoodTypes.BAOBAB.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BAOBAB_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BAOBAB_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.BLUE_ENCHANTED.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE1), 2) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE3), 1) - .build()) - )); - map.put(BYGBlocks.BLUE_SPRUCE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_LARGE1))) - )); - map.put(BYGBlocks.BROWN_BIRCH_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE4), 1) - .build()) - )); - map.put(BYGBlocks.BROWN_OAK_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE3), 1) - .build()) - )); - map.put(BYGBlocks.BROWN_ZELKOVA_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE3), 1) - .build()) - )); - map.put(BYGWoodTypes.CIKA.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE3), 1) - .build()) - )); - map.put(BYGWoodTypes.CYPRESS.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - " x ", - "xxxxx", - " x ", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE3), 1) - .build()) - )); - map.put(BYGWoodTypes.EBONY.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_BUSH1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.FIR.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE4), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE5), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE6), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE7), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE8), 1) - .build()) - - )); - map.put(BYGWoodTypes.GREEN_ENCHANTED.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE1), 2) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE3), 1).build()) - )); - map.put(BYGWoodTypes.HOLLY.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE3), 1) - .build()) - )); - map.put(BYGWoodTypes.JACARANDA.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.JACARANDA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.JACARANDA_TREE2), 1) - .build()) - )); - map.put(BYGBlocks.INDIGO_JACARANDA_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.INDIGO_JACARANDA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.INDIGO_JACARANDA_TREE2), 1) - .build()) - )); - map.put(BYGBlocks.JOSHUA_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.JOSHUA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.JOSHUA_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.MAHOGANY.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE4), 1) - .build()) - )); - map.put(BYGWoodTypes.WHITE_MANGROVE.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "x x", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE4), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE5), 1) - .build()) - )); - - map.put(BYGWoodTypes.MAPLE.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.MAPLE_TREE1))) - )); - map.put(BYGBlocks.ORANGE_BIRCH_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE4), 1) - .build()) - )); - map.put(BYGBlocks.ORANGE_OAK_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE3), 1) - .build()) - )); - map.put(BYGBlocks.ORANGE_SPRUCE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_LARGE1))) - )); - map.put(BYGBlocks.ORCHARD_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE2))) - )); - map.put(BYGBlocks.PALO_VERDE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE2), 1) - .build()) - )); - map.put(BYGBlocks.PALO_VERDE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.PINE.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PINE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PINE_TREE2), 1) - .build()) - )); - map.put(BYGBlocks.PINK_CHERRY_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_PINK_TREE2))), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_PINK_TREE1))) - )); - map.put(BYGWoodTypes.RAINBOW_EUCALYPTUS.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.RAINBOW_EUCALYPTUS_TREE1))), - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.RAINBOW_EUCALYPTUS_TREE1))) - )); - map.put(BYGBlocks.RED_BIRCH_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE4), 1) - .build()) - )); - map.put(BYGBlocks.RED_MAPLE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_MAPLE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_MAPLE_TREE2), 1) - .build()) - )); - map.put(BYGBlocks.RED_OAK_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE3), 1) - .build()) - )); - map.put(BYGBlocks.RED_SPRUCE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_LARGE1))) - )); - map.put(BYGWoodTypes.REDWOOD.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE3))), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx" - ), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE1))), - new GrowingPatternEntry(List.of( - " x ", - " xxx ", - "xxxxx", - " xxx ", - " x " - ), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE2))) - )); - map.put(BYGBlocks.SILVER_MAPLE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SILVER_MAPLE_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SILVER_MAPLE_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.SKYRIS.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE4), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE5), 1) - .build()) - )); - map.put(BYGBlocks.WHITE_CHERRY_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_WHITE_TREE2))), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_WHITE_TREE1))) - )); - map.put(BYGWoodTypes.WILLOW.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - " ", - "x x", - " ", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE4), 1) - .build()) - )); - map.put(BYGWoodTypes.WITCH_HAZEL.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL1), 2) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL2), 2) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL4), 3) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL5), 1) - .build()) - )); - map.put(BYGBlocks.YELLOW_BIRCH_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE4), 1) - .build()) - )); - map.put(BYGBlocks.YELLOW_SPRUCE_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xx", - "xx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM4), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_LARGE1))) - )); - map.put(BYGWoodTypes.ZELKOVA.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE3), 1) - .build()) - )); - map.put(BYGWoodTypes.PALM.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE1), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE2), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE3), 1) - .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE4), 1) - .build()) - )); - map.put(BYGWoodTypes.LAMENT.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE3), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE3), 1) - .build()) - )); - map.put(BYGBlocks.WITHERING_OAK_SAPLING.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE3), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE4), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE5), 1) - .build()) - )); - map.put(BYGWoodTypes.ETHER.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE3), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE5), 1) - .build()) - )); - map.put(BYGWoodTypes.NIGHTSHADE.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE3), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE4), 1) - .build()) - )); - map.put(BYGWoodTypes.EMBUR.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM3), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM4), 1) - .build()) - )); - - map.put(BYGBlocks.WEEPING_MILKCAP.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldVegetationFeatures.WEEPING_MILKCAP_HUGE), 1) - .build()) - )); - - map.put(BYGBlocks.WOOD_BLEWIT.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldVegetationFeatures.WOOD_BLEWIT_HUGE), 1) - .build()) - )); - - map.put(BYGBlocks.GREEN_MUSHROOM.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGOverworldVegetationFeatures.GREEN_MUSHROOM_HUGE), 1) - .build()) - )); - - map.put(BYGWoodTypes.SYTHIAN.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE3), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE4), 1) - .build()) - )); - - map.put(BYGBlocks.SOUL_SHROOM.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE3), 1) - .build()) - )); - - map.put(BYGBlocks.DEATH_CAP.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE1), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE2), 1) - .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE3), 1) - .build()) - )); - - map.put(BYGWoodTypes.BULBIS.growerItem().get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE5), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE6, new Vec3i(-1, 0, -1)), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - " xxx ", - "xxxxx", - " xxx ", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE7), 1) - .build()) - )); - - map.put(BYGBlocks.PURPLE_BULBIS_ODDITY.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE3), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - "xxx", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE5), 1) - .build()), - new GrowingPatternEntry(List.of( - "xxx", - "xxx", - "xxx"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE6, new Vec3i(-1, 0, -1)), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - " xxx ", - "xxxxx", - " xxx ", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE7), 1) - .build()) - )); - - map.put(BYGBlocks.SHULKREN_FUNGUS.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.SHULKREN_TREE1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.SHULKREN_TREE2), 1) - .build()) - )); - map.put(BYGWoodTypes.IMPARIUS.growerItem().get(), List.of( - new GrowingPatternEntry(List.of( - " x ", - "x x", - " x " - ), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM1, Vec3i.ZERO.offset(0, 0, 1)), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - "x x", - " x " - ), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM3), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM5), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM6), 1) - .build()) - )); - map.put(BYGBlocks.FUNGAL_IMPARIUS.get(), List.of( - new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS3), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS5), 1) - .build()), - new GrowingPatternEntry(List.of( - " x ", - "x x", - " x "), SimpleWeightedRandomList.builder() - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS1), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS2), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS3), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS4), 1) - .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS5), 1) - .build()) - )); - return map; - })); - }); + public static final Supplier DEFAULT = Suppliers.memoize(() -> new GrowingPatterns(false, Suppliers.memoize(() -> { + Map> map = new TreeMap<>(Comparator.comparing(BuiltInRegistries.BLOCK::getKey)); + + map.put(BYGBlocks.ARAUCARIA_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), + SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ARAUCARIA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ARAUCARIA_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.ASPEN.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "x x", + " x ", + "x x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ASPEN_TREE5), 1) + .build()) + )); + map.put(BYGWoodTypes.BAOBAB.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BAOBAB_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BAOBAB_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.BLUE_ENCHANTED.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE1), 2) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BLUE_ENCHANTED_TREE3), 1) + .build()) + )); + map.put(BYGBlocks.BLUE_SPRUCE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_MEDIUM4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_BLUE_TREE_LARGE1))) + )); + map.put(BYGBlocks.BROWN_BIRCH_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_BIRCH_TREE4), 1) + .build()) + )); + map.put(BYGBlocks.BROWN_OAK_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BROWN_OAK_TREE_LARGE3), 1) + .build()) + )); + map.put(BYGBlocks.BROWN_ZELKOVA_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE3), 1) + .build()) + )); + map.put(BYGWoodTypes.CIKA.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CIKA_TREE3), 1) + .build()) + )); + map.put(BYGWoodTypes.CYPRESS.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + " x ", + "xxxxx", + " x ", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CYPRESS_TREE3), 1) + .build()) + )); + map.put(BYGWoodTypes.EBONY.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_BUSH1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.EBONY_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.FIR.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE4), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE5), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE6), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE7), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.CONIFER_TREE8), 1) + .build()) + + )); + map.put(BYGWoodTypes.GREEN_ENCHANTED.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE1), 2) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.GREEN_ENCHANTED_TREE3), 1).build()) + )); + map.put(BYGWoodTypes.HOLLY.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.HOLLY_TREE3), 1) + .build()) + )); + map.put(BYGWoodTypes.JACARANDA.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.JACARANDA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.JACARANDA_TREE2), 1) + .build()) + )); + map.put(BYGBlocks.INDIGO_JACARANDA_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.INDIGO_JACARANDA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.INDIGO_JACARANDA_TREE2), 1) + .build()) + )); + map.put(BYGBlocks.JOSHUA_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.JOSHUA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.JOSHUA_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.MAHOGANY.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.MAHOGANY_TREE4), 1) + .build()) + )); + map.put(BYGWoodTypes.WHITE_MANGROVE.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "x x", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE4), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WHITE_MANGROVE_TREE5), 1) + .build()) + )); + + map.put(BYGWoodTypes.MAPLE.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.MAPLE_TREE1))) + )); + map.put(BYGBlocks.ORANGE_BIRCH_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_ORANGE_TREE4), 1) + .build()) + )); + map.put(BYGBlocks.ORANGE_OAK_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORANGE_OAK_TREE_LARGE3), 1) + .build()) + )); + map.put(BYGBlocks.ORANGE_SPRUCE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_MEDIUM4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_ORANGE_TREE_LARGE1))) + )); + map.put(BYGBlocks.ORCHARD_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.ORCHARD_TREE2))) + )); + map.put(BYGBlocks.PALO_VERDE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE2), 1) + .build()) + )); + map.put(BYGBlocks.PALO_VERDE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALO_VERDE_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.PINE.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PINE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PINE_TREE2), 1) + .build()) + )); + map.put(BYGBlocks.PINK_CHERRY_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_PINK_TREE2))), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_PINK_TREE1))) + )); + map.put(BYGWoodTypes.RAINBOW_EUCALYPTUS.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.RAINBOW_EUCALYPTUS_TREE1))), + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.RAINBOW_EUCALYPTUS_TREE1))) + )); + map.put(BYGBlocks.RED_BIRCH_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_RED_TREE4), 1) + .build()) + )); + map.put(BYGBlocks.RED_MAPLE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_MAPLE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_MAPLE_TREE2), 1) + .build()) + )); + map.put(BYGBlocks.RED_OAK_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.RED_OAK_TREE_LARGE3), 1) + .build()) + )); + map.put(BYGBlocks.RED_SPRUCE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_MEDIUM4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_RED_TREE_LARGE1))) + )); + map.put(BYGWoodTypes.REDWOOD.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE3))), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx" + ), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE1))), + new GrowingPatternEntry(List.of( + " x ", + " xxx ", + "xxxxx", + " xxx ", + " x " + ), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.REDWOOD_TREE2))) + )); + map.put(BYGBlocks.SILVER_MAPLE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SILVER_MAPLE_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SILVER_MAPLE_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.SKYRIS.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE4), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SKYRIS_TREE5), 1) + .build()) + )); + map.put(BYGBlocks.WHITE_CHERRY_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_WHITE_TREE2))), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.CHERRY_WHITE_TREE1))) + )); + map.put(BYGWoodTypes.WILLOW.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + " ", + "x x", + " ", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WILLOW_TREE4), 1) + .build()) + )); + map.put(BYGWoodTypes.WITCH_HAZEL.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL1), 2) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL2), 2) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL4), 3) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.WITCH_HAZEL5), 1) + .build()) + )); + map.put(BYGBlocks.YELLOW_BIRCH_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.BIRCH_YELLOW_TREE4), 1) + .build()) + )); + map.put(BYGBlocks.YELLOW_SPRUCE_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xx", + "xx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_MEDIUM4), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.single(new FeatureSpawner(BYGOverworldTreeFeatures.SPRUCE_YELLOW_TREE_LARGE1))) + )); + map.put(BYGWoodTypes.ZELKOVA.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.ZELKOVA_BROWN_TREE3), 1) + .build()) + )); + map.put(BYGWoodTypes.PALM.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE1), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE2), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE3), 1) + .add(new FeatureSpawner(BYGOverworldTreeFeatures.PALM_TREE4), 1) + .build()) + )); + map.put(BYGWoodTypes.LAMENT.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_TWISTY_TREE3), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.LAMENT_WEEPING_TREE3), 1) + .build()) + )); + map.put(BYGBlocks.WITHERING_OAK_SAPLING.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE3), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE4), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.WITHERING_OAK_TREE5), 1) + .build()) + )); + map.put(BYGWoodTypes.ETHER.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE3), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.ETHER_TREE5), 1) + .build()) + )); + map.put(BYGWoodTypes.NIGHTSHADE.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE3), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.NIGHTSHADE_TREE4), 1) + .build()) + )); + map.put(BYGWoodTypes.EMBUR.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM3), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.EMBUR_MUSHROOM4), 1) + .build()) + )); + + map.put(BYGBlocks.WEEPING_MILKCAP.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldVegetationFeatures.WEEPING_MILKCAP_HUGE), 1) + .build()) + )); + + map.put(BYGBlocks.WOOD_BLEWIT.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldVegetationFeatures.WOOD_BLEWIT_HUGE), 1) + .build()) + )); + + map.put(BYGBlocks.GREEN_MUSHROOM.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGOverworldVegetationFeatures.GREEN_MUSHROOM_HUGE), 1) + .build()) + )); + + map.put(BYGWoodTypes.SYTHIAN.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE3), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SYTHIAN_FUNGUS_TREE4), 1) + .build()) + )); + + map.put(BYGBlocks.SOUL_SHROOM.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.SOUL_SHROOM_TREE3), 1) + .build()) + )); + + map.put(BYGBlocks.DEATH_CAP.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE1), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE2), 1) + .add(new FeatureSpawner(BYGNetherVegetationFeatures.DEATH_CAP_TREE3), 1) + .build()) + )); + + map.put(BYGWoodTypes.BULBIS.growerItem().get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE5), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE6, new Vec3i(-1, 0, -1)), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + " xxx ", + "xxxxx", + " xxx ", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE7), 1) + .build()) + )); + + map.put(BYGBlocks.PURPLE_BULBIS_ODDITY.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE3), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + "xxx", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE5), 1) + .build()), + new GrowingPatternEntry(List.of( + "xxx", + "xxx", + "xxx"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.PURPLE_BULBIS_TREE6, new Vec3i(-1, 0, -1)), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + " xxx ", + "xxxxx", + " xxx ", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.BULBIS_TREE7), 1) + .build()) + )); + + map.put(BYGBlocks.SHULKREN_FUNGUS.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.SHULKREN_TREE1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.SHULKREN_TREE2), 1) + .build()) + )); + map.put(BYGWoodTypes.IMPARIUS.growerItem().get(), List.of( + new GrowingPatternEntry(List.of( + " x ", + "x x", + " x " + ), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM1, Vec3i.ZERO.offset(0, 0, 1)), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + "x x", + " x " + ), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM3), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM5), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.IMPARIUS_MUSHROOM6), 1) + .build()) + )); + map.put(BYGBlocks.FUNGAL_IMPARIUS.get(), List.of( + new GrowingPatternEntry(List.of("x"), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS3), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS5), 1) + .build()), + new GrowingPatternEntry(List.of( + " x ", + "x x", + " x "), SimpleWeightedRandomList.builder() + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS1), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS2), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS3), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS4), 1) + .add(new FeatureSpawner(BYGEndVegetationFeatures.FUNGAL_IMPARIUS5), 1) + .build()) + )); + return map; + }))); public static GrowingPatterns INSTANCE = null; diff --git a/Common/src/main/java/potionstudios/byg/common/blockentity/HypogealImperiumBlockEntity.java b/Common/src/main/java/potionstudios/byg/common/blockentity/HypogealImperiumBlockEntity.java index 6e2284129c..59a56190f1 100644 --- a/Common/src/main/java/potionstudios/byg/common/blockentity/HypogealImperiumBlockEntity.java +++ b/Common/src/main/java/potionstudios/byg/common/blockentity/HypogealImperiumBlockEntity.java @@ -170,7 +170,7 @@ public static void addParticles(Level level, BlockPos blockPos, BlockState block Random rand = new Random(); int i = rand.nextInt(7); if (i >= 4) { - level.addParticle(ParticleTypes.WHITE_ASH, (double) x1, (double) y1, (double) z1, 0D, 5.0E-4D, 0D); + level.addParticle(ParticleTypes.WHITE_ASH, x1, y1, z1, 0D, 5.0E-4D, 0D); } } } @@ -287,12 +287,12 @@ public int getMaxStackSize() { } @Override - public NonNullList getItems() { + public @NotNull NonNullList getItems() { return this.contents; } @Override - protected void setItems(NonNullList itemsIn) { + protected void setItems(@NotNull NonNullList itemsIn) { this.contents = itemsIn; } diff --git a/Common/src/main/java/potionstudios/byg/common/container/BYGWorkbenchContainer.java b/Common/src/main/java/potionstudios/byg/common/container/BYGWorkbenchContainer.java index d103d53dfc..377dce7f4f 100644 --- a/Common/src/main/java/potionstudios/byg/common/container/BYGWorkbenchContainer.java +++ b/Common/src/main/java/potionstudios/byg/common/container/BYGWorkbenchContainer.java @@ -5,6 +5,7 @@ import net.minecraft.world.inventory.ContainerLevelAccess; import net.minecraft.world.inventory.CraftingMenu; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; public class BYGWorkbenchContainer extends CraftingMenu { private final Block workbench; @@ -18,13 +19,11 @@ public BYGWorkbenchContainer(int id, Inventory playerInv, ContainerLevelAccess w protected static boolean isWithinUsableDistance(ContainerLevelAccess worldPos, Player playerIn, Block targetBlock) { return worldPos.evaluate((world, pos) -> - { - return world.getBlockState(pos).getBlock() == targetBlock && playerIn.distanceToSqr((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D) <= 64.0D; - }, true); + world.getBlockState(pos).getBlock() == targetBlock && playerIn.distanceToSqr((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D) <= 64.0D, true); } @Override - public boolean stillValid(Player playerIn) { + public boolean stillValid(@NotNull Player playerIn) { return isWithinUsableDistance(this.worldPos, playerIn, this.workbench); } } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGBoatRenderer.java b/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGBoatRenderer.java index 11eb145d3e..c00f3f637a 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGBoatRenderer.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGBoatRenderer.java @@ -15,6 +15,7 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import org.jetbrains.annotations.NotNull; import org.joml.Quaternionf; import potionstudios.byg.BYG; import potionstudios.byg.util.ModPlatform; @@ -31,11 +32,7 @@ public BYGBoatRenderer(EntityRendererProvider.Context context, boolean hasChest) super(context); this.shadowRadius = 0.8F; this.boatResources = ModPlatform.INSTANCE.hasLoadErrors() ? new HashMap<>() : - Stream.of(BYGBoat.BYGType.values()).collect(ImmutableMap.toImmutableMap((bygType) -> { - return bygType; - }, (bygType) -> { - return Pair.of(BYG.createLocation(getTextureLocation(bygType, hasChest)), this.createBoatModel(context, bygType, hasChest)); - })); + Stream.of(BYGBoat.BYGType.values()).collect(ImmutableMap.toImmutableMap((bygType) -> bygType, (bygType) -> Pair.of(BYG.createLocation(getTextureLocation(bygType, hasChest)), this.createBoatModel(context, bygType, hasChest)))); } private BoatModel createBoatModel(EntityRendererProvider.Context context, BYGBoat.BYGType bygType, boolean hasChest) { @@ -56,7 +53,7 @@ private static String getTextureLocation(BYGBoat.BYGType bygType, boolean hasChe } @Override - public void render(BYGBoat boat, float entityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource multiBufferSource, int packedLightIn) { + public void render(BYGBoat boat, float entityYaw, float partialTicks, PoseStack matrixStackIn, @NotNull MultiBufferSource multiBufferSource, int packedLightIn) { matrixStackIn.pushPose(); matrixStackIn.translate(0.0D, 0.375D, 0.0D); matrixStackIn.mulPose(Axis.YP.rotationDegrees(180.0F - entityYaw)); @@ -74,8 +71,8 @@ public void render(BYGBoat boat, float entityYaw, float partialTicks, PoseStack matrixStackIn.mulPose(new Quaternionf().setAngleAxis(boat.getBubbleAngle(partialTicks) * ((float)Math.PI / 180F), 1.0F, 0.0F, 1.0F)); } Pair pair = this.boatResources.get(boat.getBYGBoatType()); - ResourceLocation resourceLocation = (ResourceLocation) pair.getFirst(); - BoatModel boatModel = (BoatModel) pair.getSecond(); + ResourceLocation resourceLocation = pair.getFirst(); + BoatModel boatModel = pair.getSecond(); matrixStackIn.scale(-1.0F, -1.0F, 1.0F); matrixStackIn.mulPose(Axis.YP.rotationDegrees(90.0F)); boatModel.setupAnim(boat, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); @@ -92,7 +89,7 @@ public void render(BYGBoat boat, float entityYaw, float partialTicks, PoseStack /** * Returns the location of an entity's texture. */ - public ResourceLocation getTextureLocation(BYGBoat boat) { + public @NotNull ResourceLocation getTextureLocation(BYGBoat boat) { return this.boatResources.get(boat.getBYGBoatType()).getFirst(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGChestBoat.java b/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGChestBoat.java index 24f8a8c754..0cc1e5cb3c 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGChestBoat.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/boat/BYGChestBoat.java @@ -21,6 +21,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.entity.BYGEntities; import javax.annotation.Nullable; @@ -64,12 +65,12 @@ protected void readAdditionalSaveData(CompoundTag p_219901_) { this.readChestVehicleSaveData(p_219901_); } - public void destroy(DamageSource p_219892_) { + public void destroy(@NotNull DamageSource p_219892_) { super.destroy(p_219892_); this.chestVehicleDestroyed(p_219892_, this.level, this); } - public void remove(Entity.RemovalReason p_219894_) { + public void remove(Entity.@NotNull RemovalReason p_219894_) { if (!this.level.isClientSide && p_219894_.shouldDestroy()) { Containers.dropContents(this.level, this, this); } @@ -77,7 +78,7 @@ public void remove(Entity.RemovalReason p_219894_) { super.remove(p_219894_); } - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(@NotNull Player player, @NotNull InteractionHand hand) { if (this.canAddPassenger(player) && !player.isSecondaryUseActive()) { return super.interact(player, hand); } else { @@ -101,7 +102,7 @@ public void openCustomInventoryScreen(Player p_219906_) { } @Override - public Item getDropItem() { + public @NotNull Item getDropItem() { return this.getBYGBoatType().chestBoatItem().get(); } @@ -119,32 +120,32 @@ public int getContainerSize() { /** * Returns the stack in the given slot. */ - public ItemStack getItem(int p_219880_) { + public @NotNull ItemStack getItem(int p_219880_) { return this.getChestVehicleItem(p_219880_); } /** * Removes up to a specified number of items from an inventory slot and returns them in a new stack. */ - public ItemStack removeItem(int p_219882_, int p_219883_) { + public @NotNull ItemStack removeItem(int p_219882_, int p_219883_) { return this.removeChestVehicleItem(p_219882_, p_219883_); } /** * Removes a stack from the given slot and returns it. */ - public ItemStack removeItemNoUpdate(int p_219904_) { + public @NotNull ItemStack removeItemNoUpdate(int p_219904_) { return this.removeChestVehicleItemNoUpdate(p_219904_); } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ - public void setItem(int p_219885_, ItemStack p_219886_) { + public void setItem(int p_219885_, @NotNull ItemStack p_219886_) { this.setChestVehicleItem(p_219885_, p_219886_); } - public SlotAccess getSlot(int p_219918_) { + public @NotNull SlotAccess getSlot(int p_219918_) { return this.getChestVehicleSlot(p_219918_); } @@ -158,12 +159,12 @@ public void setChanged() { /** * Don't rename this method to canInteractWith due to conflicts with Container */ - public boolean stillValid(Player p_219896_) { + public boolean stillValid(@NotNull Player p_219896_) { return this.isChestVehicleStillValid(p_219896_); } @Nullable - public AbstractContainerMenu createMenu(int p_219910_, Inventory p_219911_, Player p_219912_) { + public AbstractContainerMenu createMenu(int p_219910_, @NotNull Inventory p_219911_, @NotNull Player p_219912_) { if (this.lootTable != null && p_219912_.isSpectator()) { return null; } else { @@ -193,7 +194,7 @@ public void setLootTableSeed(long p_219888_) { this.lootTableSeed = p_219888_; } - public NonNullList getItemStacks() { + public @NotNull NonNullList getItemStacks() { return this.itemStacks; } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWar.java b/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWar.java index 830d798ccf..b40cf9d412 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWar.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWar.java @@ -32,6 +32,7 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.entity.BYGEntities; import potionstudios.byg.common.item.BYGItems; import software.bernie.geckolib.animatable.GeoEntity; @@ -80,7 +81,7 @@ public boolean canBreatheUnderwater() { return true; } - public MobType getMobType() { + public @NotNull MobType getMobType() { return MobType.WATER; } @@ -123,7 +124,7 @@ public boolean isPushedByFluid() { return false; } - public boolean canBeLeashed(Player $$0) { + public boolean canBeLeashed(@NotNull Player $$0) { return false; } @@ -143,7 +144,7 @@ public static AttributeSupplier.Builder createAttributes() { } @Override - public InteractionResult mobInteract(Player $$0, InteractionHand $$1) { + public @NotNull InteractionResult mobInteract(@NotNull Player $$0, @NotNull InteractionHand $$1) { if (this.isBaby()) { return Bucketable.bucketMobPickup($$0, $$1, this).orElse(super.mobInteract($$0, $$1)); } @@ -151,7 +152,7 @@ public InteractionResult mobInteract(Player $$0, InteractionHand $$1) { } @Override - public void playerTouch(Player player) { + public void playerTouch(@NotNull Player player) { if (player instanceof ServerPlayer && player.hurt(player.damageSources().mobAttack(this), (float) (1))) { RandomSource rand = player.getRandom(); int i = rand.nextInt(4); @@ -166,11 +167,11 @@ public void playerTouch(Player player) { } } - protected Entity.MovementEmission getMovementEmission() { + protected Entity.@NotNull MovementEmission getMovementEmission() { return Entity.MovementEmission.EVENTS; } - public void travel(Vec3 vec3) { + public void travel(@NotNull Vec3 vec3) { this.move(MoverType.SELF, this.getDeltaMovement()); } @@ -204,7 +205,7 @@ public boolean hasMovementVector() { @Nullable @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverLevelAccessor, DifficultyInstance difficultyInstance, MobSpawnType mobSpawnType, @Nullable SpawnGroupData spawnGroupData, @Nullable CompoundTag compoundTag) { + public SpawnGroupData finalizeSpawn(@NotNull ServerLevelAccessor serverLevelAccessor, @NotNull DifficultyInstance difficultyInstance, @NotNull MobSpawnType mobSpawnType, @Nullable SpawnGroupData spawnGroupData, @Nullable CompoundTag compoundTag) { spawnGroupData = super.finalizeSpawn(serverLevelAccessor, difficultyInstance, mobSpawnType, spawnGroupData, compoundTag); if (mobSpawnType == MobSpawnType.BUCKET && compoundTag != null && compoundTag.contains("BucketVariantTag", 3)) { this.setRawFlag(compoundTag.getInt("BucketVariantTag")); @@ -218,7 +219,7 @@ public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverLevelAccessor, Dif @org.jetbrains.annotations.Nullable @Override - public AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) { + public AgeableMob getBreedOffspring(@NotNull ServerLevel serverLevel, @NotNull AgeableMob ageableMob) { ManOWar manOWar = BYGEntities.MAN_O_WAR.get().create(serverLevel); manOWar.setColor(getRandColor(serverLevel.getRandom())); return manOWar; @@ -232,14 +233,14 @@ protected void defineSynchedData() { } @Override - public void addAdditionalSaveData(CompoundTag compoundTag) { + public void addAdditionalSaveData(@NotNull CompoundTag compoundTag) { super.addAdditionalSaveData(compoundTag); compoundTag.putInt("Flag", this.getRawFlag()); compoundTag.putBoolean("FromBucket", this.fromBucket()); } @Override - public void readAdditionalSaveData(CompoundTag compoundTag) { + public void readAdditionalSaveData(@NotNull CompoundTag compoundTag) { super.readAdditionalSaveData(compoundTag); this.setRawFlag(compoundTag.getInt("Flag")); this.setFromBucket(compoundTag.getBoolean("FromBucket")); @@ -248,7 +249,7 @@ public void readAdditionalSaveData(CompoundTag compoundTag) { public void aiStep() { if (!this.isInWater() && this.onGround && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double) ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4000000059604645D, (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4000000059604645D, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); this.onGround = false; this.hasImpulse = true; this.playSound(SoundEvents.SALMON_FLOP, this.getSoundVolume(), this.getVoicePitch()); @@ -290,7 +291,7 @@ public void aiStep() { } if (!this.level.isClientSide) { - this.setDeltaMovement(this.tx * this.speed, (double) (this.ty * this.speed), (double) (this.tz * this.speed)); + this.setDeltaMovement(this.tx * this.speed, this.ty * this.speed, this.tz * this.speed); } Vec3 vec3 = this.getDeltaMovement(); double d = vec3.horizontalDistance(); @@ -378,7 +379,7 @@ private PlayState predicate(AnimationState event) { @Override - public void spawnChildFromBreeding(ServerLevel level, Animal animal) { + public void spawnChildFromBreeding(ServerLevel level, @NotNull Animal animal) { RandomSource rand = level.getRandom(); int i = rand.nextIntBetweenInclusive(1, 3); for (int j = 0; j < i; j++) { @@ -403,26 +404,26 @@ public void setFromBucket(boolean pFromBucket) { } @Override - public void saveToBucketTag(ItemStack var1) { + public void saveToBucketTag(@NotNull ItemStack var1) { Bucketable.saveDefaultDataToBucketTag(this, var1); CompoundTag compoundtag = var1.getOrCreateTag(); compoundtag.putInt("BucketVariantTag", this.getRawFlag()); } @Override - public void loadFromBucketTag(CompoundTag pTag) { + public void loadFromBucketTag(@NotNull CompoundTag pTag) { Bucketable.loadDefaultDataFromBucketTag(this, pTag); pTag.putInt("BucketVariantTag", this.getRawFlag()); } @Override - public ItemStack getBucketItemStack() { + public @NotNull ItemStack getBucketItemStack() { return BYGItems.MAN_O_WAR_BUCKET.get().getDefaultInstance(); } @Override - public SoundEvent getPickupSound() { + public @NotNull SoundEvent getPickupSound() { return SoundEvents.BUCKET_FILL_AXOLOTL; } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWarRenderer.java b/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWarRenderer.java index b82680a1b2..d8e407078f 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWarRenderer.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/manowar/ManOWarRenderer.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import software.bernie.geckolib.renderer.GeoEntityRenderer; import software.bernie.geckolib.renderer.layer.AutoGlowingGeoLayer; @@ -26,12 +27,12 @@ public class ManOWarRenderer extends GeoEntityRenderer { public ManOWarRenderer(EntityRendererProvider.Context context) { - super(context, new ManOWarModel()); + super(context, new ManOWarModel<>()); this.addRenderLayer(new AutoGlowingGeoLayer<>(this)); } @Override - public void render(T entity, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource bufferIn, int packedLightIn) { + public void render(T entity, float entityYaw, float partialTicks, @NotNull PoseStack stack, @NotNull MultiBufferSource bufferIn, int packedLightIn) { if (entity.isBaby()) { stack.scale(0.5f, 0.5f, 0.5f); shadowRadius = 0.5f; @@ -45,7 +46,7 @@ public void render(T entity, float entityYaw, float partialTicks, PoseStack stac * Returns the location of an entity's texture. */ @Override - public ResourceLocation getTextureLocation(T entity) { + public @NotNull ResourceLocation getTextureLocation(T entity) { return TEXTURES.get(entity.getColor()); } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWarden.java b/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWarden.java index 16e98cc22a..e394dd1a1b 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWarden.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWarden.java @@ -31,6 +31,7 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.core.animatable.GeoAnimatable; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; @@ -165,7 +166,7 @@ private PlayState predicate(AnimationState event) { @Override - public void setRecordPlayingNearby(BlockPos pPos, boolean pIsPartying) { + public void setRecordPlayingNearby(@NotNull BlockPos pPos, boolean pIsPartying) { this.jukebox = pPos; this.party = pIsPartying; } @@ -210,7 +211,7 @@ public void aiStep() { } @Override - public boolean canBeLeashed(Player $$0) { + public boolean canBeLeashed(@NotNull Player $$0) { return true; } @@ -222,7 +223,7 @@ protected SoundEvent getAmbientSound() { @org.jetbrains.annotations.Nullable @Override - protected SoundEvent getHurtSound(DamageSource $$0) { + protected SoundEvent getHurtSound(@NotNull DamageSource $$0) { return SoundEvents.VILLAGER_HURT; } @@ -318,7 +319,7 @@ public double acceptedDistance() { } @Override - protected int nextStartTick(PathfinderMob $$0) { + protected int nextStartTick(@NotNull PathfinderMob $$0) { return 0; } @@ -336,7 +337,7 @@ public void tick() { } @Override - protected boolean isValidTarget(LevelReader level, BlockPos pos) { + protected boolean isValidTarget(LevelReader level, @NotNull BlockPos pos) { BlockState positionState = level.getBlockState(pos); if (positionState.is(Blocks.PUMPKIN)) { return level.getBlockState(pos.relative(Direction.Axis.X, 1)).getBlock() instanceof AttachedStemBlock || level.getBlockState(pos.relative(Direction.Axis.Z, 1)).getBlock() instanceof AttachedStemBlock; @@ -373,7 +374,7 @@ public double acceptedDistance() { } @Override - protected int nextStartTick(PathfinderMob $$0) { + protected int nextStartTick(@NotNull PathfinderMob $$0) { return 0; } @@ -421,7 +422,7 @@ public void tick() { } @Override - protected boolean isValidTarget(LevelReader var1, BlockPos var2) { + protected boolean isValidTarget(LevelReader var1, @NotNull BlockPos var2) { BlockState pos = var1.getBlockState(var2); return (pos.is(Blocks.CARVED_PUMPKIN)); } @@ -436,7 +437,7 @@ public StayByBellGoal(PumpkinWarden warden, double $$1, int $$2) { } @Override - protected boolean isValidTarget(LevelReader world, BlockPos var2) { + protected boolean isValidTarget(LevelReader world, @NotNull BlockPos var2) { List blockStates = world.getBlockStates(new AABB(warden.blockPosition()).inflate(30)).toList(); return !blockStates.get(warden.random.nextInt(blockStates.size())).isAir(); } diff --git a/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWardenRenderer.java b/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWardenRenderer.java index a168e742e4..14346c1c4b 100644 --- a/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWardenRenderer.java +++ b/Common/src/main/java/potionstudios/byg/common/entity/pumpkinwarden/PumpkinWardenRenderer.java @@ -10,6 +10,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemDisplayContext; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import software.bernie.geckolib.cache.object.GeoBone; import software.bernie.geckolib.renderer.GeoEntityRenderer; @@ -20,11 +21,11 @@ public class PumpkinWardenRenderer extends GeoEntityRen public static final ModelLayerLocation MODEL_LAYER = new ModelLayerLocation(BYG.createLocation("pumpkinwarden"), "main"); public PumpkinWardenRenderer(EntityRendererProvider.Context context) { - super(context, new PumpkinWardenModel()); + super(context, new PumpkinWardenModel<>()); } @Override - public void render(T entity, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource bufferIn, int packedLightIn) { + public void render(@NotNull T entity, float entityYaw, float partialTicks, PoseStack stack, @NotNull MultiBufferSource bufferIn, int packedLightIn) { stack.scale(0.5f, 0.5f, 0.5f); shadowRadius = 0.8f; super.render(entity, entityYaw, partialTicks, stack, bufferIn, packedLightIn); diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGArmorMaterial.java b/Common/src/main/java/potionstudios/byg/common/item/BYGArmorMaterial.java index 73a0ae341e..8ef6c3c3c6 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGArmorMaterial.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGArmorMaterial.java @@ -6,16 +6,13 @@ import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.NotNull; import java.util.function.Supplier; public class BYGArmorMaterial implements ArmorMaterial { - public static final BYGArmorMaterial AMETRINE = new BYGArmorMaterial("ametrine", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, () -> { - return Ingredient.of(BYGItems.AMETRINE_GEMS.get()); - }); - public static final BYGArmorMaterial PENDORITE = new BYGArmorMaterial("pendorite", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, () -> { - return Ingredient.of(BYGItems.PENDORITE_SCRAPS.get()); - }); + public static final BYGArmorMaterial AMETRINE = new BYGArmorMaterial("ametrine", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, () -> Ingredient.of(BYGItems.AMETRINE_GEMS.get())); + public static final BYGArmorMaterial PENDORITE = new BYGArmorMaterial("pendorite", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.0F, () -> Ingredient.of(BYGItems.PENDORITE_SCRAPS.get())); private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; private final String name; @@ -50,15 +47,15 @@ public int getEnchantmentValue() { return this.enchantability; } - public SoundEvent getEquipSound() { + public @NotNull SoundEvent getEquipSound() { return this.soundEvent; } - public Ingredient getRepairIngredient() { + public @NotNull Ingredient getRepairIngredient() { return this.repairMaterial.get(); } - public String getName() { + public @NotNull String getName() { return this.name; } diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGBoatItem.java b/Common/src/main/java/potionstudios/byg/common/item/BYGBoatItem.java index 3c13579495..47a92caf82 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGBoatItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGBoatItem.java @@ -15,6 +15,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.entity.boat.BYGBoat; import potionstudios.byg.common.entity.boat.BYGChestBoat; @@ -34,7 +35,7 @@ public BYGBoatItem(boolean hasChest, BYGBoat.BYGType typeIn, Properties properti } @Override - public InteractionResultHolder use(Level pLevel, Player pPlayer, InteractionHand pHand) { + public @NotNull InteractionResultHolder use(@NotNull Level pLevel, Player pPlayer, @NotNull InteractionHand pHand) { ItemStack itemstack = pPlayer.getItemInHand(pHand); HitResult hitresult = getPlayerPOVHitResult(pLevel, pPlayer, ClipContext.Fluid.ANY); if (hitresult.getType() == HitResult.Type.MISS) { diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGHorseArmor.java b/Common/src/main/java/potionstudios/byg/common/item/BYGHorseArmor.java index 75d062b415..af4c3dfd3a 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGHorseArmor.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGHorseArmor.java @@ -2,6 +2,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.HorseArmorItem; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; public class BYGHorseArmor extends HorseArmorItem { @@ -9,7 +10,7 @@ public BYGHorseArmor(int bonus, String armorMaterial, Properties properties) { super(bonus, armorMaterial, properties); } - public ResourceLocation getTexture() { + public @NotNull ResourceLocation getTexture() { return BYG.createLocation(super.getTexture().getPath()); } } \ No newline at end of file diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGItems.java b/Common/src/main/java/potionstudios/byg/common/item/BYGItems.java index c7e4b88f7b..7d997e005d 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGItems.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGItems.java @@ -5,7 +5,6 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.flag.FeatureFlag; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.*; diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGLilyItem.java b/Common/src/main/java/potionstudios/byg/common/item/BYGLilyItem.java index a1f5f69cc1..c47b6ca26f 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGLilyItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGLilyItem.java @@ -24,6 +24,7 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import org.jetbrains.annotations.NotNull; public class BYGLilyItem extends BlockItem { Block block; @@ -32,11 +33,11 @@ public BYGLilyItem(Block blockIn, Properties builder) { this.block = blockIn; } - public InteractionResult useOn(UseOnContext context) { + public @NotNull InteractionResult useOn(@NotNull UseOnContext context) { return InteractionResult.PASS; } - public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { + public @NotNull InteractionResultHolder use(@NotNull Level worldIn, Player playerIn, @NotNull InteractionHand handIn) { ItemStack itemstack = playerIn.getItemInHand(handIn); HitResult raytraceresult = getPlayerPOVHitResult(worldIn, playerIn, ClipContext.Fluid.SOURCE_ONLY); if (raytraceresult.getType() == HitResult.Type.MISS) { diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGTier.java b/Common/src/main/java/potionstudios/byg/common/item/BYGTier.java index 8aad1ecc98..d8ad2fa3d4 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGTier.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGTier.java @@ -3,16 +3,13 @@ import net.minecraft.util.LazyLoadedValue; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.NotNull; import java.util.function.Supplier; public class BYGTier implements Tier { - public static final BYGTier AMETRINE = new BYGTier("ametrine", 4, 64, 16.0F, 0.8F, 25, () -> { - return Ingredient.of(BYGItems.AMETRINE_GEMS.get()); - }); - public static final BYGTier PENDORITE = new BYGTier("pendorite", 5, 2500, 10.0F, 4.0F, 15, () -> { - return Ingredient.of(BYGItems.PENDORITE_SCRAPS.get()); - }); + public static final BYGTier AMETRINE = new BYGTier("ametrine", 4, 64, 16.0F, 0.8F, 25, () -> Ingredient.of(BYGItems.AMETRINE_GEMS.get())); + public static final BYGTier PENDORITE = new BYGTier("pendorite", 5, 2500, 10.0F, 4.0F, 15, () -> Ingredient.of(BYGItems.PENDORITE_SCRAPS.get())); private final String id; private final int harvestLevel; @@ -52,7 +49,7 @@ public int getEnchantmentValue() { return this.enchantability; } - public Ingredient getRepairIngredient() { + public @NotNull Ingredient getRepairIngredient() { return this.repairMaterial.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/item/BYGWaterSilkItem.java b/Common/src/main/java/potionstudios/byg/common/item/BYGWaterSilkItem.java index 8cdc064648..07be2197f2 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BYGWaterSilkItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BYGWaterSilkItem.java @@ -24,6 +24,7 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; public class BYGWaterSilkItem extends BlockItem { @@ -31,11 +32,11 @@ public BYGWaterSilkItem(Block blockIn, Properties builder) { super(blockIn, builder); } - public InteractionResult useOn(UseOnContext context) { + public @NotNull InteractionResult useOn(@NotNull UseOnContext context) { return InteractionResult.PASS; } - public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { + public @NotNull InteractionResultHolder use(@NotNull Level worldIn, Player playerIn, @NotNull InteractionHand handIn) { ItemStack itemstack = playerIn.getItemInHand(handIn); HitResult raytraceresult = getPlayerPOVHitResult(worldIn, playerIn, ClipContext.Fluid.SOURCE_ONLY); if (raytraceresult.getType() == HitResult.Type.MISS) { diff --git a/Common/src/main/java/potionstudios/byg/common/item/BaobabFruitItem.java b/Common/src/main/java/potionstudios/byg/common/item/BaobabFruitItem.java index dcee3e96ed..086441940f 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BaobabFruitItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BaobabFruitItem.java @@ -5,21 +5,22 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.UseAnim; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; public class BaobabFruitItem extends BlockItem { public BaobabFruitItem(Block blockIn, Properties builder) { super(blockIn, builder); } - public int getUseDuration(ItemStack stack) { + public int getUseDuration(@NotNull ItemStack stack) { return 32; } - public UseAnim getUseAnimation(ItemStack stack) { + public @NotNull UseAnim getUseAnimation(@NotNull ItemStack stack) { return UseAnim.EAT; } - public String getDescriptionId() { + public @NotNull String getDescriptionId() { return this.getOrCreateDescriptionId(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/item/BiomepediaItem.java b/Common/src/main/java/potionstudios/byg/common/item/BiomepediaItem.java index 188e127283..cdea75ce70 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/BiomepediaItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/BiomepediaItem.java @@ -8,6 +8,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.client.gui.biomepedia.screen.BiomepediaHomeScreen; public class BiomepediaItem extends Item { @@ -16,7 +17,7 @@ public BiomepediaItem(Properties properties) { } @Override - public InteractionResultHolder use(Level level, Player player, InteractionHand interactionHand) { + public @NotNull InteractionResultHolder use(Level level, @NotNull Player player, @NotNull InteractionHand interactionHand) { if (level.isClientSide) { Client.openScreen(); diff --git a/Common/src/main/java/potionstudios/byg/common/item/CampfireExplodingBlockItem.java b/Common/src/main/java/potionstudios/byg/common/item/CampfireExplodingBlockItem.java index dbcbdc8ea3..27fd22ea34 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/CampfireExplodingBlockItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/CampfireExplodingBlockItem.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.CampfireBlockEntity; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.BYGDamageTypes; public class CampfireExplodingBlockItem extends BlockItem { @@ -19,7 +20,7 @@ public CampfireExplodingBlockItem(Block block, Properties $$0) { } @Override - public InteractionResult useOn(UseOnContext context) { + public @NotNull InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); BlockPos clickedPos = context.getClickedPos(); if (!level.isClientSide) { diff --git a/Common/src/main/java/potionstudios/byg/common/item/GrowerItem.java b/Common/src/main/java/potionstudios/byg/common/item/GrowerItem.java index ea8d204888..dd7f017451 100644 --- a/Common/src/main/java/potionstudios/byg/common/item/GrowerItem.java +++ b/Common/src/main/java/potionstudios/byg/common/item/GrowerItem.java @@ -9,6 +9,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import potionstudios.byg.client.util.BYGClientUtil; import potionstudios.byg.common.block.sapling.GrowingPatterns; @@ -30,7 +31,7 @@ public GrowerItem(Block block, Properties properties) { } @Override - public void appendHoverText(ItemStack $$0, @Nullable Level $$1, List components, TooltipFlag $$3) { + public void appendHoverText(@NotNull ItemStack $$0, @Nullable Level $$1, @NotNull List components, @NotNull TooltipFlag $$3) { super.appendHoverText($$0, $$1, components, $$3); GrowingPatterns.getConfig().getPatterns(this.getBlock()).ifPresent(patternEntries -> { diff --git a/Common/src/main/java/potionstudios/byg/common/particles/FallingLeafParticle.java b/Common/src/main/java/potionstudios/byg/common/particles/FallingLeafParticle.java index 69f93e8683..234bbf10d1 100644 --- a/Common/src/main/java/potionstudios/byg/common/particles/FallingLeafParticle.java +++ b/Common/src/main/java/potionstudios/byg/common/particles/FallingLeafParticle.java @@ -4,6 +4,7 @@ import net.minecraft.client.particle.*; import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.util.Mth; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class FallingLeafParticle extends TextureSheetParticle { @@ -19,7 +20,7 @@ protected FallingLeafParticle(ClientLevel world, double x, double y, double z, d } @Override - public ParticleRenderType getRenderType() { + public @NotNull ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @@ -47,7 +48,7 @@ public Provider(SpriteSet sprite) { @Nullable @Override - public Particle createParticle(SimpleParticleType var1, ClientLevel world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public Particle createParticle(@NotNull SimpleParticleType var1, @NotNull ClientLevel world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { FallingLeafParticle leaf = new FallingLeafParticle(world, x, y, z, xSpeed, ySpeed, zSpeed); leaf.lifetime = Mth.randomBetweenInclusive(world.random, 500, 1000); leaf.setColor(1.0f, 1.0f, 1.0f); diff --git a/Common/src/main/java/potionstudios/byg/common/particles/TheriumGlint.java b/Common/src/main/java/potionstudios/byg/common/particles/TheriumGlint.java index d99e206b68..691841fea7 100644 --- a/Common/src/main/java/potionstudios/byg/common/particles/TheriumGlint.java +++ b/Common/src/main/java/potionstudios/byg/common/particles/TheriumGlint.java @@ -3,6 +3,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.*; import net.minecraft.core.particles.SimpleParticleType; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class TheriumGlint extends TextureSheetParticle { @@ -22,7 +23,7 @@ protected TheriumGlint(ClientLevel world, double x, double y, double z, double x } @Override - public ParticleRenderType getRenderType() { + public @NotNull ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @@ -57,7 +58,7 @@ public Provider(SpriteSet sprite) { @Nullable @Override - public Particle createParticle(SimpleParticleType var1, ClientLevel world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public Particle createParticle(@NotNull SimpleParticleType var1, @NotNull ClientLevel world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { TheriumGlint glint = new TheriumGlint(world, x, y, z, xSpeed, ySpeed, zSpeed); glint.setColor(1.0f, 1.0f, 1.0f); glint.setSpriteFromAge(this.sprite); diff --git a/Common/src/main/java/potionstudios/byg/common/world/LevelBiomeTracker.java b/Common/src/main/java/potionstudios/byg/common/world/LevelBiomeTracker.java index 116c26418e..a45b3b0dfc 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/LevelBiomeTracker.java +++ b/Common/src/main/java/potionstudios/byg/common/world/LevelBiomeTracker.java @@ -59,9 +59,7 @@ public static LevelBiomeTracker fromServer(MinecraftServer server) { for (MobCategory category : MobCategory.values()) { WeightedRandomList mobs = possibleBiome.value().getMobSettings().getMobs(category); - ((WeightedListAccess) mobs).byg_getItems().stream().map(spawnerData -> spawnerData.type).map(entityType -> BuiltInRegistries.ENTITY_TYPE.getResourceKey(entityType).orElseThrow()).forEach(entityTypeResourceKey -> { - entitySpawns.computeIfAbsent(biomeResourceKey, key -> new ObjectOpenHashSet<>()).add(entityTypeResourceKey); - }); + ((WeightedListAccess) mobs).byg_getItems().stream().map(spawnerData -> spawnerData.type).map(entityType -> BuiltInRegistries.ENTITY_TYPE.getResourceKey(entityType).orElseThrow()).forEach(entityTypeResourceKey -> entitySpawns.computeIfAbsent(biomeResourceKey, key -> new ObjectOpenHashSet<>()).add(entityTypeResourceKey)); } }); diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/BYGDebugBiomeSource.java b/Common/src/main/java/potionstudios/byg/common/world/biome/BYGDebugBiomeSource.java index cbd455bd14..b0b2f18e9c 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/BYGDebugBiomeSource.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/BYGDebugBiomeSource.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.biome.Climate; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import potionstudios.byg.mixin.access.BiomeSourceAccess; @@ -51,18 +52,18 @@ public BYGDebugBiomeSource(Stream> holderStream, TagKey bio } @Override - protected Codec codec() { + protected @NotNull Codec codec() { return CODEC; } @Override - protected Stream> collectPossibleBiomes() { + protected @NotNull Stream> collectPossibleBiomes() { return Stream.empty(); } @Override - public Holder getNoiseBiome(int x, int y, int z, Climate.Sampler sampler) { + public @NotNull Holder getNoiseBiome(int x, int y, int z, Climate.@NotNull Sampler sampler) { if (this.possibleBiomesSorted == null) { this.possibleBiomesSorted = this.possibleBiomes().stream().filter(biomeHolder -> biomeHolder.is(biomeTagKey)).sorted(Comparator.comparing(biomeHolder -> biomeHolder.unwrapKey().orElseThrow().location())).toList(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/LayersBiomeData.java b/Common/src/main/java/potionstudios/byg/common/world/biome/LayersBiomeData.java index 2c18efc7d8..6b9ab6320d 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/LayersBiomeData.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/LayersBiomeData.java @@ -15,12 +15,10 @@ import static potionstudios.byg.common.world.biome.BYGBiomes.*; public record LayersBiomeData(SimpleWeightedRandomList> biomeWeights, int biomeSize) { - public static final Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - SimpleWeightedRandomList.wrappedCodec(CodecUtil.BIOME_CODEC).fieldOf("biomeWeights").forGetter(layersBiomeData -> layersBiomeData.biomeWeights), - Codec.INT.fieldOf("biomeSize").forGetter(layersBiomeData -> layersBiomeData.biomeSize) - ).apply(builder, LayersBiomeData::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + SimpleWeightedRandomList.wrappedCodec(CodecUtil.BIOME_CODEC).fieldOf("biomeWeights").forGetter(layersBiomeData -> layersBiomeData.biomeWeights), + Codec.INT.fieldOf("biomeSize").forGetter(layersBiomeData -> layersBiomeData.biomeSize) + ).apply(builder, LayersBiomeData::new)); public LayersBiomeData filter(BiPredicate>, ResourceKey> filter) { return new LayersBiomeData(BYGUtil.combineWeightedRandomLists(filter, biomeWeights), biomeSize); diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/end/BYGEndBiomeSource.java b/Common/src/main/java/potionstudios/byg/common/world/biome/end/BYGEndBiomeSource.java index e67fd54c1e..740f875bf7 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/end/BYGEndBiomeSource.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/end/BYGEndBiomeSource.java @@ -49,7 +49,7 @@ public BYGEndBiomeSource() { @Override - public Holder getNoiseBiome(int x, int y, int z, Climate.Sampler sampler) { + public @NotNull Holder getNoiseBiome(int x, int y, int z, Climate.@NotNull Sampler sampler) { int quartX = QuartPos.toBlock(x); int quartY = QuartPos.toBlock(y); int quartZ = QuartPos.toBlock(z); @@ -76,12 +76,12 @@ public Holder getNoiseBiome(int x, int y, int z, Climate.Sampler sampler) } @Override - protected Codec codec() { + protected @NotNull Codec codec() { return CODEC; } @Override - protected Stream> collectPossibleBiomes() { + protected @NotNull Stream> collectPossibleBiomes() { return Stream.empty(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/end/EndBiomesConfig.java b/Common/src/main/java/potionstudios/byg/common/world/biome/end/EndBiomesConfig.java index bc08a12a6c..1cd54be728 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/end/EndBiomesConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/end/EndBiomesConfig.java @@ -35,27 +35,23 @@ public record EndBiomesConfig(boolean forceBYGEndBiomeSource, boolean addAllEndB public static final Supplier LEGACY_CONFIG_PATH = () -> ModPlatform.INSTANCE.configPath().resolve(BYG.MOD_ID + "-end-biomes.json"); public static final Supplier CONFIG_PATH = () -> ModPlatform.INSTANCE.configPath().resolve("end-biomes.json5"); - public static final Codec LEGACY_CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.BOOL.fieldOf("useBYGNetherBiomeSourceInNewWorlds").forGetter(overworldBiomeConfig -> overworldBiomeConfig.forceBYGEndBiomeSource), - Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(overworldBiomeConfig -> overworldBiomeConfig.addAllEndBiomeCategoryEntries), - Codec.INT.fieldOf("skyLayerStartY").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayerStartY), - LayersBiomeData.CODEC.fieldOf("islandLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.islandLayers), - LayersBiomeData.CODEC.fieldOf("voidLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.voidLayers), - LayersBiomeData.CODEC.fieldOf("skyLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayers) - ).apply(builder, EndBiomesConfig::new); - }); - - public static final Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.BOOL.fieldOf("forceBYGEndBiomeSource").forGetter(overworldBiomeConfig -> overworldBiomeConfig.forceBYGEndBiomeSource), - Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(overworldBiomeConfig -> overworldBiomeConfig.addAllEndBiomeCategoryEntries), - Codec.INT.fieldOf("skyLayerStartY").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayerStartY), - LayersBiomeData.CODEC.fieldOf("islandLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.islandLayers), - LayersBiomeData.CODEC.fieldOf("voidLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.voidLayers), - LayersBiomeData.CODEC.fieldOf("skyLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayers) - ).apply(builder, EndBiomesConfig::new); - }); + public static final Codec LEGACY_CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.BOOL.fieldOf("useBYGNetherBiomeSourceInNewWorlds").forGetter(overworldBiomeConfig -> overworldBiomeConfig.forceBYGEndBiomeSource), + Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(overworldBiomeConfig -> overworldBiomeConfig.addAllEndBiomeCategoryEntries), + Codec.INT.fieldOf("skyLayerStartY").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayerStartY), + LayersBiomeData.CODEC.fieldOf("islandLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.islandLayers), + LayersBiomeData.CODEC.fieldOf("voidLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.voidLayers), + LayersBiomeData.CODEC.fieldOf("skyLayerData").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayers) + ).apply(builder, EndBiomesConfig::new)); + + public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.BOOL.fieldOf("forceBYGEndBiomeSource").forGetter(overworldBiomeConfig -> overworldBiomeConfig.forceBYGEndBiomeSource), + Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(overworldBiomeConfig -> overworldBiomeConfig.addAllEndBiomeCategoryEntries), + Codec.INT.fieldOf("skyLayerStartY").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayerStartY), + LayersBiomeData.CODEC.fieldOf("islandLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.islandLayers), + LayersBiomeData.CODEC.fieldOf("voidLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.voidLayers), + LayersBiomeData.CODEC.fieldOf("skyLayer").forGetter(overworldBiomeConfig -> overworldBiomeConfig.skyLayers) + ).apply(builder, EndBiomesConfig::new)); public static EndBiomesConfig INSTANCE = null; @@ -76,9 +72,7 @@ public static EndBiomesConfig getConfig(boolean serialize, boolean recreate, @Nu } if (additional != null && INSTANCE.addAllEndBiomeCategoryEntries()) { - SimpleWeightedRandomList> registryDefaults = Util.make((SimpleWeightedRandomList.>builder()), builder -> { - additional.stream().map(additional::getResourceKey).map(Optional::get).map(additional::getHolderOrThrow).filter(biomeHolder -> biomeHolder.is(BiomeTags.IS_END)).map(biomeHolder -> biomeHolder.unwrapKey().orElseThrow()).forEach(biomeResourceKey -> builder.add(biomeResourceKey, 2)); - }).build(); + SimpleWeightedRandomList> registryDefaults = Util.make((SimpleWeightedRandomList.>builder()), builder -> additional.stream().map(additional::getResourceKey).map(Optional::get).map(additional::getHolderOrThrow).filter(biomeHolder -> biomeHolder.is(BiomeTags.IS_END)).map(biomeHolder -> biomeHolder.unwrapKey().orElseThrow()).forEach(biomeResourceKey -> builder.add(biomeResourceKey, 2))).build(); BiPredicate>, ResourceKey> filter = (existing, added) -> !existing.contains(added); diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/nether/BYGNetherBiomeSource.java b/Common/src/main/java/potionstudios/byg/common/world/biome/nether/BYGNetherBiomeSource.java index 58050b6dd5..fa36b8260c 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/nether/BYGNetherBiomeSource.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/nether/BYGNetherBiomeSource.java @@ -51,7 +51,7 @@ public BYGNetherBiomeSource() { } @Override - public Holder getNoiseBiome(int x, int y, int z, Climate.Sampler sampler) { + public @NotNull Holder getNoiseBiome(int x, int y, int z, Climate.@NotNull Sampler sampler) { if (y < bottomTopY + this.lowerLayerRoughnessNoise.GetNoise(x, z) * 5) { return this.bottomResolver.getNoiseBiome(x, y, z, sampler); } else if (y > bottomTopY + bottomTopY + this.upperLayerRoughnessNoise.GetNoise(x, z) * 5) { @@ -62,12 +62,12 @@ public Holder getNoiseBiome(int x, int y, int z, Climate.Sampler sampler) } @Override - protected Codec codec() { + protected @NotNull Codec codec() { return CODEC; } @Override - protected Stream> collectPossibleBiomes() { + protected @NotNull Stream> collectPossibleBiomes() { return Stream.empty(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/nether/NetherBiomesConfig.java b/Common/src/main/java/potionstudios/byg/common/world/biome/nether/NetherBiomesConfig.java index 64cb65a27e..51cb14ef82 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/nether/NetherBiomesConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/nether/NetherBiomesConfig.java @@ -36,27 +36,23 @@ public record NetherBiomesConfig(boolean forceBYGNetherBiomeSource, boolean addA public static final Supplier LEGACY_CONFIG_PATH = () -> ModPlatform.INSTANCE.configPath().resolve(BYG.MOD_ID + "-nether-biomes.json"); public static final Supplier CONFIG_PATH = () -> ModPlatform.INSTANCE.configPath().resolve("nether-biomes.json5"); - public static final Codec LEGACY_CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.BOOL.fieldOf("useBYGNetherBiomeSourceInNewWorlds").forGetter(netherBiomesConfig -> netherBiomesConfig.forceBYGNetherBiomeSource), - Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(netherBiomesConfig -> netherBiomesConfig.addAllNetherBiomeTagEntries), - Codec.INT.fieldOf("layerSizeInBlocks").forGetter(netherBiomesConfig -> netherBiomesConfig.layerSize), - LayersBiomeData.CODEC.fieldOf("upperLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.upperLayer), - LayersBiomeData.CODEC.fieldOf("middleLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.middleLayer), - LayersBiomeData.CODEC.fieldOf("bottomLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.bottomLayer) - ).apply(builder, NetherBiomesConfig::new); - }); - - public static final Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.BOOL.fieldOf("forceBYGNetherBiomeSource").forGetter(netherBiomesConfig -> netherBiomesConfig.forceBYGNetherBiomeSource), - Codec.BOOL.fieldOf("addAllNetherBiomeTagEntries").forGetter(netherBiomesConfig -> netherBiomesConfig.addAllNetherBiomeTagEntries), - Codec.INT.fieldOf("layerSizeInBlocks").forGetter(netherBiomesConfig -> netherBiomesConfig.layerSize), - LayersBiomeData.CODEC.fieldOf("upperLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.upperLayer), - LayersBiomeData.CODEC.fieldOf("middleLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.middleLayer), - LayersBiomeData.CODEC.fieldOf("bottomLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.bottomLayer) - ).apply(builder, NetherBiomesConfig::new); - }); + public static final Codec LEGACY_CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.BOOL.fieldOf("useBYGNetherBiomeSourceInNewWorlds").forGetter(netherBiomesConfig -> netherBiomesConfig.forceBYGNetherBiomeSource), + Codec.BOOL.fieldOf("addAllEndBiomeCategoryEntries").forGetter(netherBiomesConfig -> netherBiomesConfig.addAllNetherBiomeTagEntries), + Codec.INT.fieldOf("layerSizeInBlocks").forGetter(netherBiomesConfig -> netherBiomesConfig.layerSize), + LayersBiomeData.CODEC.fieldOf("upperLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.upperLayer), + LayersBiomeData.CODEC.fieldOf("middleLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.middleLayer), + LayersBiomeData.CODEC.fieldOf("bottomLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.bottomLayer) + ).apply(builder, NetherBiomesConfig::new)); + + public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.BOOL.fieldOf("forceBYGNetherBiomeSource").forGetter(netherBiomesConfig -> netherBiomesConfig.forceBYGNetherBiomeSource), + Codec.BOOL.fieldOf("addAllNetherBiomeTagEntries").forGetter(netherBiomesConfig -> netherBiomesConfig.addAllNetherBiomeTagEntries), + Codec.INT.fieldOf("layerSizeInBlocks").forGetter(netherBiomesConfig -> netherBiomesConfig.layerSize), + LayersBiomeData.CODEC.fieldOf("upperLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.upperLayer), + LayersBiomeData.CODEC.fieldOf("middleLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.middleLayer), + LayersBiomeData.CODEC.fieldOf("bottomLayer").forGetter(netherBiomesConfig -> netherBiomesConfig.bottomLayer) + ).apply(builder, NetherBiomesConfig::new)); public static NetherBiomesConfig INSTANCE = null; public static final NetherBiomesConfig DEFAULT = new NetherBiomesConfig(true, true, 40, LayersBiomeData.DEFAULT_NETHER_UPPER, LayersBiomeData.DEFAULT_NETHER_MIDDLE, LayersBiomeData.DEFAULT_NETHER_LOWER); @@ -75,9 +71,7 @@ public static NetherBiomesConfig getConfig(boolean serialize, boolean recreate, } if (additional != null && INSTANCE.addAllNetherBiomeTagEntries()) { - SimpleWeightedRandomList> registryDefaults = Util.make((SimpleWeightedRandomList.>builder()), builder -> { - additional.stream().map(additional::getResourceKey).map(Optional::get).map(additional::getHolderOrThrow).filter(biomeHolder -> biomeHolder.is(BiomeTags.IS_NETHER)).map(biomeHolder -> biomeHolder.unwrapKey().orElseThrow()).forEach(biomeResourceKey -> builder.add(biomeResourceKey, 2)); - }).build(); + SimpleWeightedRandomList> registryDefaults = Util.make((SimpleWeightedRandomList.>builder()), builder -> additional.stream().map(additional::getResourceKey).map(Optional::get).map(additional::getHolderOrThrow).filter(biomeHolder -> biomeHolder.is(BiomeTags.IS_NETHER)).map(biomeHolder -> biomeHolder.unwrapKey().orElseThrow()).forEach(biomeResourceKey -> builder.add(biomeResourceKey, 2))).build(); BiPredicate>, ResourceKey> filter = (existing, added) -> !existing.contains(added); diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/BYGOverworldBiomeBuilder.java b/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/BYGOverworldBiomeBuilder.java index 4fe5665da9..3a8f0b0bc7 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/BYGOverworldBiomeBuilder.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/BYGOverworldBiomeBuilder.java @@ -4,6 +4,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Climate; import net.minecraft.world.level.biome.OverworldBiomeBuilder; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.OverworldBiomeBuilderAccess; public class BYGOverworldBiomeBuilder extends OverworldBiomeBuilder { @@ -35,12 +36,12 @@ public BYGOverworldBiomeBuilder(ResourceKey[][] oceans, ResourceKey pickBeachBiome(int temp, int humidity) { + public @NotNull ResourceKey pickBeachBiome(int temp, int humidity) { return beachBiomes[temp][humidity]; } @Override - public ResourceKey pickPeakBiome(int temp, int humidity, Climate.Parameter weirdness) { + public @NotNull ResourceKey pickPeakBiome(int temp, int humidity, Climate.Parameter weirdness) { ResourceKey peakBiome = this.peakBiomes[temp][humidity]; if (weirdness.max() < 0L) { return peakBiome; @@ -51,7 +52,7 @@ public ResourceKey pickPeakBiome(int temp, int humidity, Climate.Paramete } @Override - public ResourceKey pickSlopeBiome(int temp, int humidity, Climate.Parameter weirdness) { + public @NotNull ResourceKey pickSlopeBiome(int temp, int humidity, Climate.Parameter weirdness) { ResourceKey slopeBiome = this.slopeBiomes[temp][humidity]; if (weirdness.max() < 0L) { return slopeBiome; diff --git a/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/OverworldRegion.java b/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/OverworldRegion.java index 9594cf5039..b2ebf2da8e 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/OverworldRegion.java +++ b/Common/src/main/java/potionstudios/byg/common/world/biome/overworld/OverworldRegion.java @@ -35,51 +35,47 @@ public record OverworldRegion(int overworldWeight, Wrapped>>> slopeBiomes, Wrapped>>> slopeBiomesVariant, Map, ResourceKey> swapper) { - public static final Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group(Codec.INT.fieldOf("weight").forGetter(overworldRegion -> overworldRegion.overworldWeight), - BIOME_LAYOUT_CODEC.fieldOf("ocean_biomes").forGetter(overworldRegion -> overworldRegion.oceans), - BIOME_LAYOUT_CODEC.fieldOf("middle_biomes").forGetter(overworldRegion -> overworldRegion.middleBiomes), - BIOME_LAYOUT_CODEC.fieldOf("middle_biomes_variant").forGetter(overworldRegion -> overworldRegion.middleBiomesVariant), - BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes").forGetter(overworldRegion -> overworldRegion.plateauBiomes), - BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes_variant").forGetter(overworldRegion -> overworldRegion.plateauBiomesVariant), - BIOME_LAYOUT_CODEC.fieldOf("shattered_biomes").forGetter(overworldRegion -> overworldRegion.extremeHills), - BIOME_LAYOUT_CODEC.fieldOf("beach_biomes").orElse(BEACH_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.beachBiomes), - BIOME_LAYOUT_CODEC.fieldOf("peak_biomes").orElse(PEAK_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.peakBiomes), - BIOME_LAYOUT_CODEC.fieldOf("peak_biomes_variant").orElse(PEAK_BIOMES_VARIANT_VANILLA).forGetter(overworldRegion -> overworldRegion.peakBiomesVariant), - BIOME_LAYOUT_CODEC.fieldOf("slope_biomes").orElse(SLOPE_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.slopeBiomes), - BIOME_LAYOUT_CODEC.fieldOf("slope_biomes_variant").orElse(SLOPE_BIOMES_VARIANT_VANILLA).forGetter(overworldRegion -> overworldRegion.slopeBiomesVariant), - Codec.unboundedMap(ResourceLocation.CODEC.comapFlatMap(resourceLocation -> { - if (!resourceLocation.getNamespace().equals("minecraft")) { - throw new IllegalArgumentException("Only biomes from MC can be used as the swapper's key!!! You put: \"" + resourceLocation + "\""); - } - return DataResult.success(ResourceKey.create(Registries.BIOME, resourceLocation)); - }, ResourceKey::location), CodecUtil.BIOME_CODEC).fieldOf("swapper").forGetter(overworldRegion -> overworldRegion.swapper) - ).apply(builder, OverworldRegion::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group(Codec.INT.fieldOf("weight").forGetter(overworldRegion -> overworldRegion.overworldWeight), + BIOME_LAYOUT_CODEC.fieldOf("ocean_biomes").forGetter(overworldRegion -> overworldRegion.oceans), + BIOME_LAYOUT_CODEC.fieldOf("middle_biomes").forGetter(overworldRegion -> overworldRegion.middleBiomes), + BIOME_LAYOUT_CODEC.fieldOf("middle_biomes_variant").forGetter(overworldRegion -> overworldRegion.middleBiomesVariant), + BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes").forGetter(overworldRegion -> overworldRegion.plateauBiomes), + BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes_variant").forGetter(overworldRegion -> overworldRegion.plateauBiomesVariant), + BIOME_LAYOUT_CODEC.fieldOf("shattered_biomes").forGetter(overworldRegion -> overworldRegion.extremeHills), + BIOME_LAYOUT_CODEC.fieldOf("beach_biomes").orElse(BEACH_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.beachBiomes), + BIOME_LAYOUT_CODEC.fieldOf("peak_biomes").orElse(PEAK_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.peakBiomes), + BIOME_LAYOUT_CODEC.fieldOf("peak_biomes_variant").orElse(PEAK_BIOMES_VARIANT_VANILLA).forGetter(overworldRegion -> overworldRegion.peakBiomesVariant), + BIOME_LAYOUT_CODEC.fieldOf("slope_biomes").orElse(SLOPE_BIOMES_VANILLA).forGetter(overworldRegion -> overworldRegion.slopeBiomes), + BIOME_LAYOUT_CODEC.fieldOf("slope_biomes_variant").orElse(SLOPE_BIOMES_VARIANT_VANILLA).forGetter(overworldRegion -> overworldRegion.slopeBiomesVariant), + Codec.unboundedMap(ResourceLocation.CODEC.comapFlatMap(resourceLocation -> { + if (!resourceLocation.getNamespace().equals("minecraft")) { + throw new IllegalArgumentException("Only biomes from MC can be used as the swapper's key!!! You put: \"" + resourceLocation + "\""); + } + return DataResult.success(ResourceKey.create(Registries.BIOME, resourceLocation)); + }, ResourceKey::location), CodecUtil.BIOME_CODEC).fieldOf("swapper").forGetter(overworldRegion -> overworldRegion.swapper) + ).apply(builder, OverworldRegion::new)); public static final Codec VERIFYING_CODEC = CODEC.flatXmap(verifyRegion(), verifyRegion()); - public static final Codec OLD_CODEC = RecordCodecBuilder.create(builder -> { - return builder.group(Codec.INT.fieldOf("weight").forGetter(overworldRegion -> overworldRegion.overworldWeight), - OLD_BIOME_LAYOUT_CODEC.fieldOf("oceans").forGetter(overworldRegion -> overworldRegion.oceans.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("middle_biomes").forGetter(overworldRegion -> overworldRegion.middleBiomes.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("middle_biomes_variant").forGetter(overworldRegion -> overworldRegion.middleBiomesVariant.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes").forGetter(overworldRegion -> overworldRegion.plateauBiomes.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes_variant").forGetter(overworldRegion -> overworldRegion.plateauBiomesVariant.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("shattered_biomes").forGetter(overworldRegion -> overworldRegion.extremeHills.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("beach_biomes").orElse(BEACH_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.beachBiomes.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("peak_biomes").orElse(PEAK_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.peakBiomes.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("peak_biomes_variant").orElse(PEAK_BIOMES_VARIANT_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.peakBiomesVariant.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("slope_biomes").orElse(SLOPE_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.slopeBiomes.value()), - OLD_BIOME_LAYOUT_CODEC.fieldOf("slope_biomes_variant").orElse(SLOPE_BIOMES_VARIANT_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.slopeBiomesVariant.value()), - Codec.unboundedMap(ResourceLocation.CODEC.comapFlatMap(resourceLocation -> { - if (!resourceLocation.getNamespace().equals("minecraft")) { - throw new IllegalArgumentException("Only biomes from MC can be used as the swapper's key!!! You put: \"" + resourceLocation + "\""); - } - return DataResult.success(ResourceKey.create(Registries.BIOME, resourceLocation)); - }, ResourceKey::location), CodecUtil.BIOME_CODEC).fieldOf("swapper").forGetter(overworldRegion -> overworldRegion.swapper) - ).apply(builder, OverworldRegion::fromOldCodec); - }); + public static final Codec OLD_CODEC = RecordCodecBuilder.create(builder -> builder.group(Codec.INT.fieldOf("weight").forGetter(overworldRegion -> overworldRegion.overworldWeight), + OLD_BIOME_LAYOUT_CODEC.fieldOf("oceans").forGetter(overworldRegion -> overworldRegion.oceans.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("middle_biomes").forGetter(overworldRegion -> overworldRegion.middleBiomes.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("middle_biomes_variant").forGetter(overworldRegion -> overworldRegion.middleBiomesVariant.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes").forGetter(overworldRegion -> overworldRegion.plateauBiomes.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("plateau_biomes_variant").forGetter(overworldRegion -> overworldRegion.plateauBiomesVariant.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("shattered_biomes").forGetter(overworldRegion -> overworldRegion.extremeHills.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("beach_biomes").orElse(BEACH_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.beachBiomes.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("peak_biomes").orElse(PEAK_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.peakBiomes.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("peak_biomes_variant").orElse(PEAK_BIOMES_VARIANT_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.peakBiomesVariant.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("slope_biomes").orElse(SLOPE_BIOMES_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.slopeBiomes.value()), + OLD_BIOME_LAYOUT_CODEC.fieldOf("slope_biomes_variant").orElse(SLOPE_BIOMES_VARIANT_VANILLA.value()).forGetter(overworldRegion -> overworldRegion.slopeBiomesVariant.value()), + Codec.unboundedMap(ResourceLocation.CODEC.comapFlatMap(resourceLocation -> { + if (!resourceLocation.getNamespace().equals("minecraft")) { + throw new IllegalArgumentException("Only biomes from MC can be used as the swapper's key!!! You put: \"" + resourceLocation + "\""); + } + return DataResult.success(ResourceKey.create(Registries.BIOME, resourceLocation)); + }, ResourceKey::location), CodecUtil.BIOME_CODEC).fieldOf("swapper").forGetter(overworldRegion -> overworldRegion.swapper) + ).apply(builder, OverworldRegion::fromOldCodec)); private static OverworldRegion fromOldCodec(int overworldWeight, List>> oceans, List>> middleBiomes, diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/BYGPlacedFeatures.java b/Common/src/main/java/potionstudios/byg/common/world/feature/BYGPlacedFeatures.java index e94d6c8de1..f893e50a33 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/BYGPlacedFeatures.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/BYGPlacedFeatures.java @@ -191,9 +191,7 @@ public class BYGPlacedFeatures { public static final ResourceKey PALO_VERDE_TREES = createPlacedFeature("palo_verde_trees", BYGOverworldTreeFeatures.PALO_VERDE_TREES, () -> clearingTreePlacement(PlacementUtils.countExtra(0, 0.2F, 1))); public static final ResourceKey MIXED_COLOR_BULBIS_TREES = createPlacedFeature("mixed_color_bulbis_trees", BYGEndVegetationFeatures.MIXED_COLOR_BULBIS_TREES, () -> treePlacement(PlacementUtils.countExtra(1, 0.2F, 1))); public static final ResourceKey SPARSE_PURPLE_BULBIS_TREES = createPlacedFeature("sparse_purple_bulbis_trees", BYGEndVegetationFeatures.PURPLE_BULBIS_TREES, () -> treePlacement(PlacementUtils.countExtra(0, 0.1F, 1))); - public static final ResourceKey PALM_TREES = createPlacedFeature("palm_trees", BYGOverworldTreeFeatures.PALM_TREES, () -> Util.make(new ArrayList<>(clearingTreePlacement(PlacementUtils.countExtra(4, 0.2F, 1), BYGWoodTypes.PALM.growerItem().get())), (list) -> { - list.add(new NearWaterPlacementFilter(4)); - })); + public static final ResourceKey PALM_TREES = createPlacedFeature("palm_trees", BYGOverworldTreeFeatures.PALM_TREES, () -> Util.make(new ArrayList<>(clearingTreePlacement(PlacementUtils.countExtra(4, 0.2F, 1), BYGWoodTypes.PALM.growerItem().get())), (list) -> list.add(new NearWaterPlacementFilter(4)))); public static final ResourceKey RED_OAK_TREES = createPlacedFeature("red_oak_trees", BYGOverworldTreeFeatures.RED_OAK_TREES, () -> clearingTreePlacement(PlacementUtils.countExtra(1, 0.2F, 1))); public static final ResourceKey ORANGE_OAK_TREES = createPlacedFeature("orange_oak_trees", BYGOverworldTreeFeatures.ORANGE_OAK_TREES, () -> clearingTreePlacement(PlacementUtils.countExtra(1, 0.2F, 1))); public static final ResourceKey BROWN_OAK_TREES = createPlacedFeature("brown_oak_trees", BYGOverworldTreeFeatures.BROWN_OAK_TREES, () -> clearingTreePlacement(PlacementUtils.countExtra(1, 0.2F, 1))); diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGMushroomConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGMushroomConfig.java index 64bd7523cc..f481bc6c56 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGMushroomConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGMushroomConfig.java @@ -14,23 +14,7 @@ public class BYGMushroomConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> { - return config.stemProvider; - }), BlockStateProvider.CODEC.fieldOf("mushroom_provider").forGetter((config) -> { - return config.mushroomProvider; - }), BlockStateProvider.CODEC.fieldOf("mushroom2_provider").forGetter((config) -> { - return config.mushroomProvider; - }), BlockStateProvider.CODEC.fieldOf("mushroom3_provider").forGetter((config) -> { - return config.mushroomProvider; - }), BlockStateProvider.CODEC.fieldOf("pollen_provider").forGetter((config) -> { - return config.pollenProvider; - }), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> { - return config.minHeight; - }), Codec.INT.fieldOf("max_height").orElse(1).forGetter((config) -> { - return config.maxPossibleHeight; - })).apply(codecRecorder, BYGMushroomConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> config.stemProvider), BlockStateProvider.CODEC.fieldOf("mushroom_provider").forGetter((config) -> config.mushroomProvider), BlockStateProvider.CODEC.fieldOf("mushroom2_provider").forGetter((config) -> config.mushroomProvider), BlockStateProvider.CODEC.fieldOf("mushroom3_provider").forGetter((config) -> config.mushroomProvider), BlockStateProvider.CODEC.fieldOf("pollen_provider").forGetter((config) -> config.pollenProvider), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> config.minHeight), Codec.INT.fieldOf("max_height").orElse(1).forGetter((config) -> config.maxPossibleHeight)).apply(codecRecorder, BYGMushroomConfig::new)); private final BlockStateProvider stemProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGTreeConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGTreeConfig.java index 0218565e4a..7dcc3bbb33 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGTreeConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BYGTreeConfig.java @@ -21,23 +21,7 @@ public class BYGTreeConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("trunk_provider").orElse(SimpleStateProvider.simple(Blocks.OAK_LOG.defaultBlockState())).forGetter((config) -> { - return config.trunkProvider; - }), BlockStateProvider.CODEC.fieldOf("leaves_provider").orElse(SimpleStateProvider.simple(Blocks.OAK_LEAVES.defaultBlockState())).forGetter((config) -> { - return config.leavesProvider; - }), BlockStateProvider.CODEC.fieldOf("disk_provider").orElse(SimpleStateProvider.simple(Blocks.PODZOL.defaultBlockState())).forGetter((config) -> { - return config.diskProvider; - }), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> { - return config.minHeight; - }), Codec.INT.fieldOf("max_height").orElse(15).forGetter((config) -> { - return config.maxHeight; - }), Codec.INT.fieldOf("disk_radius").orElse(0).forGetter((config) -> { - return config.diskRadius; - }), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> { - return config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()); - })).apply(codecRecorder, BYGTreeConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("trunk_provider").orElse(SimpleStateProvider.simple(Blocks.OAK_LOG.defaultBlockState())).forGetter((config) -> config.trunkProvider), BlockStateProvider.CODEC.fieldOf("leaves_provider").orElse(SimpleStateProvider.simple(Blocks.OAK_LEAVES.defaultBlockState())).forGetter((config) -> config.leavesProvider), BlockStateProvider.CODEC.fieldOf("disk_provider").orElse(SimpleStateProvider.simple(Blocks.PODZOL.defaultBlockState())).forGetter((config) -> config.diskProvider), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> config.minHeight), Codec.INT.fieldOf("max_height").orElse(15).forGetter((config) -> config.maxHeight), Codec.INT.fieldOf("disk_radius").orElse(0).forGetter((config) -> config.diskRadius), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()))).apply(codecRecorder, BYGTreeConfig::new)); private final BlockStateProvider trunkProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BrimstoneVentsConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BrimstoneVentsConfig.java index 6cfea1ab78..722af48f02 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/BrimstoneVentsConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/BrimstoneVentsConfig.java @@ -12,13 +12,7 @@ public class BrimstoneVentsConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), BlockStateProvider.CODEC.fieldOf("lava_provider").forGetter((config) -> { - return config.lavaProvider; - })).apply(codecRecorder, BrimstoneVentsConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), BlockStateProvider.CODEC.fieldOf("lava_provider").forGetter((config) -> config.lavaProvider)).apply(codecRecorder, BrimstoneVentsConfig::new)); private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/ChainConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/ChainConfig.java index 27c34cdf77..a12161a421 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/ChainConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/ChainConfig.java @@ -17,19 +17,7 @@ public class ChainConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("x_axis_block_provider").forGetter((config) -> { - return config.xAxisBlockProvider; - }), BlockStateProvider.CODEC.fieldOf("z_axis_block_provider").forGetter((config) -> { - return config.zAxisBlockProvider; - }), Codec.INT.fieldOf("min_length").forGetter((config) -> { - return config.minLength; - }), Codec.INT.fieldOf("max_length").forGetter((config) -> { - return config.maxLength; - }), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> { - return config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()); - })).apply(codecRecorder, ChainConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("x_axis_block_provider").forGetter((config) -> config.xAxisBlockProvider), BlockStateProvider.CODEC.fieldOf("z_axis_block_provider").forGetter((config) -> config.zAxisBlockProvider), Codec.INT.fieldOf("min_length").forGetter((config) -> config.minLength), Codec.INT.fieldOf("max_length").forGetter((config) -> config.maxLength), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()))).apply(codecRecorder, ChainConfig::new)); private final BlockStateProvider xAxisBlockProvider; private final BlockStateProvider zAxisBlockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/FloatingIslandConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/FloatingIslandConfig.java index 5c2dc30075..45dba26775 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/FloatingIslandConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/FloatingIslandConfig.java @@ -18,19 +18,7 @@ public class FloatingIslandConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("top_block_provider").forGetter((config) -> { - return config.topBlockProvider; - }), BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), Codec.INT.fieldOf("min_radius").orElse(13).forGetter((config) -> { - return config.minRadius; - }), Codec.INT.fieldOf("max_radius").orElse(15).forGetter((config) -> { - return config.maxRadius; - }), PlacedFeature.LIST_CODEC.fieldOf("island_features").forGetter(floatingIslandConfig -> { - return floatingIslandConfig.features; - })).apply(codecRecorder, FloatingIslandConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("top_block_provider").forGetter((config) -> config.topBlockProvider), BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), Codec.INT.fieldOf("min_radius").orElse(13).forGetter((config) -> config.minRadius), Codec.INT.fieldOf("max_radius").orElse(15).forGetter((config) -> config.maxRadius), PlacedFeature.LIST_CODEC.fieldOf("island_features").forGetter(floatingIslandConfig -> floatingIslandConfig.features)).apply(codecRecorder, FloatingIslandConfig::new)); private final BlockStateProvider topBlockProvider; private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/GiantFlowerConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/GiantFlowerConfig.java index 16b44ce23e..79e6378e54 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/GiantFlowerConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/GiantFlowerConfig.java @@ -13,23 +13,7 @@ public class GiantFlowerConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> { - return config.stemProvider; - }), BlockStateProvider.CODEC.fieldOf("petal_provider").forGetter((config) -> { - return config.petalProvider; - }), BlockStateProvider.CODEC.fieldOf("petal2_provider").forGetter((config) -> { - return config.petalProvider; - }), BlockStateProvider.CODEC.fieldOf("petal3_provider").forGetter((config) -> { - return config.petalProvider; - }), BlockStateProvider.CODEC.fieldOf("pollen_provider").forGetter((config) -> { - return config.pollenProvider; - }), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> { - return config.minHeight; - }), Codec.INT.fieldOf("max_height").orElse(1).forGetter((config) -> { - return config.maxPossibleHeight; - })).apply(codecRecorder, GiantFlowerConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> config.stemProvider), BlockStateProvider.CODEC.fieldOf("petal_provider").forGetter((config) -> config.petalProvider), BlockStateProvider.CODEC.fieldOf("petal2_provider").forGetter((config) -> config.petalProvider), BlockStateProvider.CODEC.fieldOf("petal3_provider").forGetter((config) -> config.petalProvider), BlockStateProvider.CODEC.fieldOf("pollen_provider").forGetter((config) -> config.pollenProvider), Codec.INT.fieldOf("min_height").orElse(15).forGetter((config) -> config.minHeight), Codec.INT.fieldOf("max_height").orElse(1).forGetter((config) -> config.maxPossibleHeight)).apply(codecRecorder, GiantFlowerConfig::new)); private final BlockStateProvider stemProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnConfig.java index 3509ce995b..756bee73c3 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnConfig.java @@ -17,17 +17,7 @@ public class HangingColumnConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), Codec.INT.fieldOf("min_length").forGetter((config) -> { - return config.minLength; - }), Codec.INT.fieldOf("max_length").forGetter((config) -> { - return config.maxLength; - }), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> { - return config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()); - })).apply(codecRecorder, HangingColumnConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), Codec.INT.fieldOf("min_length").forGetter((config) -> config.minLength), Codec.INT.fieldOf("max_length").forGetter((config) -> config.maxLength), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()))).apply(codecRecorder, HangingColumnConfig::new)); private final BlockStateProvider blockProvider; private final int minLength; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnWithBaseConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnWithBaseConfig.java index 7a74034ed0..87fad0599f 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnWithBaseConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/HangingColumnWithBaseConfig.java @@ -13,19 +13,7 @@ public class HangingColumnWithBaseConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("base_block_provider").forGetter((config) -> { - return config.baseBlockProvider; - }), BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), BlockStateProvider.CODEC.fieldOf("end_block_provider").forGetter((config) -> { - return config.endBlockProvider; - }), Codec.INT.fieldOf("min_length").forGetter((config) -> { - return config.minLength; - }), Codec.INT.fieldOf("max_length").forGetter((config) -> { - return config.maxLength; - }), BlockPredicate.CODEC.fieldOf("placement_filter").forGetter(HangingColumnWithBaseConfig::getPlacementFilter)).apply(codecRecorder, HangingColumnWithBaseConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("base_block_provider").forGetter((config) -> config.baseBlockProvider), BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), BlockStateProvider.CODEC.fieldOf("end_block_provider").forGetter((config) -> config.endBlockProvider), Codec.INT.fieldOf("min_length").forGetter((config) -> config.minLength), Codec.INT.fieldOf("max_length").forGetter((config) -> config.maxLength), BlockPredicate.CODEC.fieldOf("placement_filter").forGetter(HangingColumnWithBaseConfig::getPlacementFilter)).apply(codecRecorder, HangingColumnWithBaseConfig::new)); private final BlockStateProvider baseBlockProvider; private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/LargeLakeFeatureConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/LargeLakeFeatureConfig.java index 79d09b083b..ed08556d58 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/LargeLakeFeatureConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/LargeLakeFeatureConfig.java @@ -26,19 +26,17 @@ public record LargeLakeFeatureConfig(int minRadius, int maxRadius, int minDepth, BlockStateProvider lakeFloorStateProvider, BlockStateProvider borderStateProvider, HolderSet lakeSurfaceFeatures, HolderSet lakeEdgeFeatures, List modifiers) implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.INT.fieldOf("minRadius").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.minRadius), - Codec.INT.fieldOf("maxRadius").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.maxRadius), - Codec.INT.fieldOf("minDepth").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.minDepth), - Codec.INT.fieldOf("maxDepth").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.maxDepth), - BlockStateProvider.CODEC.fieldOf("floorStateProvider").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeFloorStateProvider), - BlockStateProvider.CODEC.fieldOf("edgeStateProvider").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.borderStateProvider), - PlacedFeature.LIST_CODEC.fieldOf("surface_features").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeSurfaceFeatures), - PlacedFeature.LIST_CODEC.fieldOf("edge_features").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeEdgeFeatures), - PlacementModifier.CODEC.listOf().fieldOf("edgeStateProvider_placement").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.modifiers) - ).apply(builder, LargeLakeFeatureConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.INT.fieldOf("minRadius").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.minRadius), + Codec.INT.fieldOf("maxRadius").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.maxRadius), + Codec.INT.fieldOf("minDepth").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.minDepth), + Codec.INT.fieldOf("maxDepth").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.maxDepth), + BlockStateProvider.CODEC.fieldOf("floorStateProvider").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeFloorStateProvider), + BlockStateProvider.CODEC.fieldOf("edgeStateProvider").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.borderStateProvider), + PlacedFeature.LIST_CODEC.fieldOf("surface_features").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeSurfaceFeatures), + PlacedFeature.LIST_CODEC.fieldOf("edge_features").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.lakeEdgeFeatures), + PlacementModifier.CODEC.listOf().fieldOf("edgeStateProvider_placement").forGetter(largeLakeFeatureConfig -> largeLakeFeatureConfig.modifiers) + ).apply(builder, LargeLakeFeatureConfig::new)); public int getRandomRadius(RandomSource random) { return random.nextInt(Math.max(1, this.maxRadius - this.minRadius)) + this.minRadius; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/PointyRockConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/PointyRockConfig.java index 664c327d36..a04647b536 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/PointyRockConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/PointyRockConfig.java @@ -14,17 +14,7 @@ public class PointyRockConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), Codec.INT.fieldOf("seed").orElse(0).forGetter((config) -> { - return config.seed; - }), Codec.DOUBLE.fieldOf("height_multiplier").orElse(1.0).forGetter((config) -> { - return config.heightMultiplier; - }), PlacedFeature.LIST_CODEC.fieldOf("post_features").forGetter((config) -> { - return config.placedFeatureHolderSet; - })).apply(codecRecorder, PointyRockConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), Codec.INT.fieldOf("seed").orElse(0).forGetter((config) -> config.seed), Codec.DOUBLE.fieldOf("height_multiplier").orElse(1.0).forGetter((config) -> config.heightMultiplier), PlacedFeature.LIST_CODEC.fieldOf("post_features").forGetter((config) -> config.placedFeatureHolderSet)).apply(codecRecorder, PointyRockConfig::new)); private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/PumpkinConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/PumpkinConfig.java index b7cccc393f..dc6d58efee 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/PumpkinConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/PumpkinConfig.java @@ -11,15 +11,7 @@ public class PumpkinConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("pumpkin_provider").forGetter((config) -> { - return config.pumpkinProvider; - }), BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> { - return config.stemProvider; - }), BlockStateProvider.CODEC.fieldOf("leaves_provider").forGetter((config) -> { - return config.leavesProvider; - })).apply(codecRecorder, PumpkinConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("pumpkin_provider").forGetter((config) -> config.pumpkinProvider), BlockStateProvider.CODEC.fieldOf("stem_provider").forGetter((config) -> config.stemProvider), BlockStateProvider.CODEC.fieldOf("leaves_provider").forGetter((config) -> config.leavesProvider)).apply(codecRecorder, PumpkinConfig::new)); private final BlockStateProvider pumpkinProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/QuartzSpikeConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/QuartzSpikeConfig.java index 83f5a19947..46b7759884 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/QuartzSpikeConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/QuartzSpikeConfig.java @@ -11,11 +11,7 @@ public class QuartzSpikeConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - })).apply(codecRecorder, QuartzSpikeConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider)).apply(codecRecorder, QuartzSpikeConfig::new)); private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/Simple2BlockProviderConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/Simple2BlockProviderConfig.java index 6c5d2b75cd..1156ba6e46 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/Simple2BlockProviderConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/Simple2BlockProviderConfig.java @@ -7,13 +7,7 @@ public class Simple2BlockProviderConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), BlockStateProvider.CODEC.fieldOf("block_provider2").forGetter((config) -> { - return config.blockProvider; - })).apply(codecRecorder, Simple2BlockProviderConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), BlockStateProvider.CODEC.fieldOf("block_provider2").forGetter((config) -> config.blockProvider)).apply(codecRecorder, Simple2BlockProviderConfig::new)); private final BlockStateProvider blockProvider; private final BlockStateProvider blockProvider2; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/SimpleBlockProviderConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/SimpleBlockProviderConfig.java index f6050bc6ef..c74691a8e2 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/SimpleBlockProviderConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/SimpleBlockProviderConfig.java @@ -7,11 +7,7 @@ public class SimpleBlockProviderConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - })).apply(codecRecorder, SimpleBlockProviderConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider)).apply(codecRecorder, SimpleBlockProviderConfig::new)); private final BlockStateProvider blockProvider; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/config/WhitelistedSimpleBlockProviderConfig.java b/Common/src/main/java/potionstudios/byg/common/world/feature/config/WhitelistedSimpleBlockProviderConfig.java index 0952fe2cfe..94495f618a 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/config/WhitelistedSimpleBlockProviderConfig.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/config/WhitelistedSimpleBlockProviderConfig.java @@ -14,13 +14,7 @@ public class WhitelistedSimpleBlockProviderConfig implements FeatureConfiguration { - public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> { - return codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> { - return config.blockProvider; - }), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> { - return config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()); - })).apply(codecRecorder, WhitelistedSimpleBlockProviderConfig::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((codecRecorder) -> codecRecorder.group(BlockStateProvider.CODEC.fieldOf("block_provider").forGetter((config) -> config.blockProvider), BlockState.CODEC.listOf().fieldOf("whitelist").forGetter((config) -> config.whitelist.stream().map(Block::defaultBlockState).collect(Collectors.toList()))).apply(codecRecorder, WhitelistedSimpleBlockProviderConfig::new)); private final BlockStateProvider blockProvider; private final Set whitelist; diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/Spike.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/Spike.java index 6534eab7f8..aa046dbd5b 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/Spike.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/Spike.java @@ -132,7 +132,7 @@ public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, RandomS if (verifiedHeight) { // xRadius = Math.max(xRadius / config.radiusDivisorPerStack(), 1); // yRadius = Math.max(yRadius * 0.1F, 1); - mutable.setY((int) (mutable.getY() + yRadius)); + mutable.setY(mutable.getY() + yRadius); // zRadius = Math.max(zRadius / config.radiusDivisorPerStack(), 1); stackIDX++; } diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/end/EndLakeFeature.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/end/EndLakeFeature.java index 1171418a40..bbdd7a3ac1 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/end/EndLakeFeature.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/end/EndLakeFeature.java @@ -144,7 +144,7 @@ else if (y > waterLevel) } } - double aspect = ((double) radius / (double) depth); + double aspect = (radius / depth); for (int x = blockPos.getX() - dist; x <= blockPos.getX() + dist; x++) { POS.setX(x); diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/LargeLakeFeatureOld.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/LargeLakeFeatureOld.java index b557b790fc..eda4e155f5 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/LargeLakeFeatureOld.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/LargeLakeFeatureOld.java @@ -146,7 +146,7 @@ else if (y > waterLevel) } } - double aspect = ((double) radius / (double) depth); + double aspect = (radius / depth); for (int x = blockPos.getX() - dist; x <= blockPos.getX() + dist; x++) { POS.setX(x); diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/mushrooms/util/BYGAbstractMushroomFeature.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/mushrooms/util/BYGAbstractMushroomFeature.java index 0579b75a8c..734f3b1c02 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/mushrooms/util/BYGAbstractMushroomFeature.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/mushrooms/util/BYGAbstractMushroomFeature.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.material.Material; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.feature.config.BYGMushroomConfig; import potionstudios.byg.common.world.feature.gen.FeatureGenUtil; import potionstudios.byg.util.MLBlockTags; @@ -30,9 +31,7 @@ public static boolean canStemPlaceHere(LevelSimulatedReader worldReader, BlockPo } public boolean isAnotherMushroomHere(LevelSimulatedReader worldReader, BlockPos blockPos) { - return worldReader.isStateAtPosition(blockPos, (state) -> { - return state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES); - }); + return worldReader.isStateAtPosition(blockPos, (state) -> state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES)); } public boolean isAnotherMushroomLikeThisHere(LevelSimulatedReader worldReader, BlockPos blockPos, Block logBlock, Block leafBlock) { @@ -69,9 +68,7 @@ public void placeMushroom(BlockState mushroomBlockState, WorldGenLevel reader, B * @return Determine whether or not the pos can support a sapling's tree. */ public boolean canGiantMushroomGrowHere(LevelSimulatedReader reader, BlockPos pos) { - return reader.isStateAtPosition(pos, (state) -> { - return state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES) || state.isAir() || state.getMaterial() == Material.PLANT || state.getMaterial() == Material.REPLACEABLE_PLANT || state.getMaterial() == Material.WATER_PLANT || state.getMaterial() == Material.LEAVES || state.getMaterial() == Material.DIRT; - }); + return reader.isStateAtPosition(pos, (state) -> state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES) || state.isAir() || state.getMaterial() == Material.PLANT || state.getMaterial() == Material.REPLACEABLE_PLANT || state.getMaterial() == Material.WATER_PLANT || state.getMaterial() == Material.LEAVES || state.getMaterial() == Material.DIRT); } /** @@ -216,7 +213,7 @@ public void setBlockStateWithoutUpdates(LevelWriter worldWriter, BlockPos blockP } @Override - protected void setBlock(LevelWriter worldIn, BlockPos pos, BlockState state) { + protected void setBlock(@NotNull LevelWriter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) { this.setBlockStateWithoutUpdates(worldIn, pos, state); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/AttachedToLogsDecorator.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/AttachedToLogsDecorator.java index 7c7c6b5bca..6563db46d9 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/AttachedToLogsDecorator.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/AttachedToLogsDecorator.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.List; @@ -82,7 +83,7 @@ private boolean hasRequiredEmptyBlocks(TreeDecorator.Context pContext, BlockPos return true; } - protected TreeDecoratorType type() { + protected @NotNull TreeDecoratorType type() { return BYGTreeDecoratorTypes.ATTACHED_TO_LOGS.get(); } } \ No newline at end of file diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGLeavesVineDecorator.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGLeavesVineDecorator.java index 18283feb83..8899161977 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGLeavesVineDecorator.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGLeavesVineDecorator.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import org.jetbrains.annotations.NotNull; import java.util.function.Function; @@ -36,7 +37,7 @@ public BYGLeavesVineDecorator(VineBlock vineBlock, float probability) { this.probability = probability; } - protected TreeDecoratorType type() { + protected @NotNull TreeDecoratorType type() { return BYGTreeDecoratorTypes.LEAVE_VINE.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGTrunkVineDecorator.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGTrunkVineDecorator.java index 7d9f404d58..7f0802552c 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGTrunkVineDecorator.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/decorators/BYGTrunkVineDecorator.java @@ -9,6 +9,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import org.jetbrains.annotations.NotNull; public class BYGTrunkVineDecorator extends TreeDecorator { @@ -28,7 +29,7 @@ public BYGTrunkVineDecorator(VineBlock vineBlock, float probability) { this.probability = probability; } - protected TreeDecoratorType type() { + protected @NotNull TreeDecoratorType type() { return BYGTreeDecoratorTypes.TRUNK_VINE.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/util/BYGAbstractTreeFeature.java b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/util/BYGAbstractTreeFeature.java index e3bec13b35..7d695e3ce6 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/util/BYGAbstractTreeFeature.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/gen/overworld/trees/util/BYGAbstractTreeFeature.java @@ -29,6 +29,7 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.shapes.BitSetDiscreteVoxelShape; import net.minecraft.world.phys.shapes.DiscreteVoxelShape; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYGConstants; import potionstudios.byg.common.block.BYGBlocks; import potionstudios.byg.common.block.BYGWoodTypes; @@ -65,9 +66,7 @@ public boolean canLogPlaceHereNether(LevelSimulatedReader worldReader, BlockPos } public boolean isAnotherTreeHere(LevelSimulatedReader worldReader, BlockPos blockPos) { - return worldReader.isStateAtPosition(blockPos, (state) -> { - return state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES); - }); + return worldReader.isStateAtPosition(blockPos, (state) -> state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES)); } public boolean isAnotherTreeLikeThisHere(LevelSimulatedReader worldReader, BlockPos blockPos, Block logBlock, Block leafBlock) { @@ -158,9 +157,7 @@ public void placeNetherBranch(BlockPos startPos, BYGTreeConfig config, RandomSou * @return Determine whether or not the pos can support a sapling's tree. */ public boolean canSaplingGrowHere(LevelSimulatedReader reader, BlockPos pos) { - return reader.isStateAtPosition(pos, (state) -> { - return state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES) || state.isAir() || state.getMaterial() == Material.PLANT || state.getMaterial() == Material.REPLACEABLE_PLANT || state.getMaterial() == Material.WATER_PLANT || state.getMaterial() == Material.LEAVES || state.getMaterial() == Material.DIRT; - }); + return reader.isStateAtPosition(pos, (state) -> state.is(BlockTags.LOGS) || state.is(BlockTags.LEAVES) || state.isAir() || state.getMaterial() == Material.PLANT || state.getMaterial() == Material.REPLACEABLE_PLANT || state.getMaterial() == Material.WATER_PLANT || state.getMaterial() == Material.LEAVES || state.getMaterial() == Material.DIRT); } /** @@ -642,15 +639,15 @@ public static PooledMutable get(int x, int y, int z) { return new PooledMutable(x, y, z); } - public PooledMutable set(int i, int j, int k) { + public @NotNull PooledMutable set(int i, int j, int k) { return (PooledMutable) super.set(i, j, k); } - public PooledMutable set(double d, double e, double f) { + public @NotNull PooledMutable set(double d, double e, double f) { return (PooledMutable) super.set(d, e, f); } - public PooledMutable set(Vec3i vec3i) { + public @NotNull PooledMutable set(@NotNull Vec3i vec3i) { return (PooledMutable) super.set(vec3i); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/feature/stateproviders/BetweenNoiseThresholdProvider.java b/Common/src/main/java/potionstudios/byg/common/world/feature/stateproviders/BetweenNoiseThresholdProvider.java index 7fe66350cb..9d2d034324 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/feature/stateproviders/BetweenNoiseThresholdProvider.java +++ b/Common/src/main/java/potionstudios/byg/common/world/feature/stateproviders/BetweenNoiseThresholdProvider.java @@ -11,22 +11,21 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType; import net.minecraft.world.level.levelgen.feature.stateproviders.NoiseBasedStateProvider; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; public class BetweenNoiseThresholdProvider extends NoiseBasedStateProvider { - public static final Codec CODEC = RecordCodecBuilder.create((builder) -> { - return noiseCodec(builder).and( - builder.group( - FloatProvider.CODEC.listOf().fieldOf("thresholds").forGetter((stateProvider) -> stateProvider.thresholds), - BlockStateProvider.CODEC.fieldOf("within_noise_state_provider").forGetter((stateProvider) -> stateProvider.withinNoiseStateProvider), - BlockStateProvider.CODEC.fieldOf("outside_noise_state_provider").forGetter((stateProvider) -> stateProvider.outsideNoiseStateProvider), - Codec.BOOL.fieldOf("use_3d_noise").forGetter(stateprovider -> stateprovider.use3D) - ) - ).apply(builder, BetweenNoiseThresholdProvider::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create((builder) -> noiseCodec(builder).and( + builder.group( + FloatProvider.CODEC.listOf().fieldOf("thresholds").forGetter((stateProvider) -> stateProvider.thresholds), + BlockStateProvider.CODEC.fieldOf("within_noise_state_provider").forGetter((stateProvider) -> stateProvider.withinNoiseStateProvider), + BlockStateProvider.CODEC.fieldOf("outside_noise_state_provider").forGetter((stateProvider) -> stateProvider.outsideNoiseStateProvider), + Codec.BOOL.fieldOf("use_3d_noise").forGetter(stateprovider -> stateprovider.use3D) + ) + ).apply(builder, BetweenNoiseThresholdProvider::new)); private final List thresholds; private final BlockStateProvider withinNoiseStateProvider; @@ -43,7 +42,7 @@ public BetweenNoiseThresholdProvider(long seed, NormalNoise.NoiseParameters nois @Override - public BlockState getState(RandomSource random, BlockPos pos) { + public @NotNull BlockState getState(@NotNull RandomSource random, @NotNull BlockPos pos) { double noiseValue = this.use3D ? getNoiseValue2D(pos, 4) : this.getNoiseValue(pos, this.scale); // BYG.logInfo(noiseValue); @@ -60,7 +59,7 @@ protected double getNoiseValue2D(BlockPos $$0, double $$1) { } @Override - protected BlockStateProviderType type() { + protected @NotNull BlockStateProviderType type() { return BYGStateProviders.BETWEEN_NOISE_THRESHOLD_PROVIDER.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/math/OpenSimplexNoiseEnd.java b/Common/src/main/java/potionstudios/byg/common/world/math/OpenSimplexNoiseEnd.java index ff243fe28a..af615b9597 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/math/OpenSimplexNoiseEnd.java +++ b/Common/src/main/java/potionstudios/byg/common/world/math/OpenSimplexNoiseEnd.java @@ -120,7 +120,7 @@ public double eval(double x, double y) double attn1 = 2 - dx1 * dx1 - dy1 * dy1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, dx1, dy1); + value += attn1 * attn1 * extrapolate(xsb + 1, ysb, dx1, dy1); } // Contribution (0,1) @@ -129,7 +129,7 @@ public double eval(double x, double y) double attn2 = 2 - dx2 * dx2 - dy2 * dy2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, dx2, dy2); + value += attn2 * attn2 * extrapolate(xsb, ysb + 1, dx2, dy2); } if (inSum <= 1) { // We're inside the triangle (2-Simplex) at (0,0) @@ -159,11 +159,11 @@ public double eval(double x, double y) // triangular vertices if (xins > yins) { xsv_ext = xsb + 2; - ysv_ext = ysb + 0; + ysv_ext = ysb; dx_ext = dx0 - 2 - 2 * SQUISH_CONSTANT_2D; dy_ext = dy0 + 0 - 2 * SQUISH_CONSTANT_2D; } else { - xsv_ext = xsb + 0; + xsv_ext = xsb; ysv_ext = ysb + 2; dx_ext = dx0 + 0 - 2 * SQUISH_CONSTANT_2D; dy_ext = dy0 - 2 - 2 * SQUISH_CONSTANT_2D; @@ -349,7 +349,7 @@ public double eval(double x, double y, double z) double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0; if (attn0 > 0) { attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, dx0, dy0, dz0); + value += attn0 * attn0 * extrapolate(xsb, ysb, zsb, dx0, dy0, dz0); } // Contribution (1,0,0) @@ -359,7 +359,7 @@ public double eval(double x, double y, double z) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1); + value += attn1 * attn1 * extrapolate(xsb + 1, ysb, zsb, dx1, dy1, dz1); } // Contribution (0,1,0) @@ -369,7 +369,7 @@ public double eval(double x, double y, double z) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2); + value += attn2 * attn2 * extrapolate(xsb, ysb + 1, zsb, dx2, dy2, dz2); } // Contribution (0,0,1) @@ -379,7 +379,7 @@ public double eval(double x, double y, double z) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3); + value += attn3 * attn3 * extrapolate(xsb, ysb, zsb + 1, dx3, dy3, dz3); } } else if (inSum >= 2) { // We're inside the tetrahedron (3-Simplex) at // (1,1,1) @@ -493,7 +493,7 @@ public double eval(double x, double y, double z) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx3, dy3, dz3); + value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb, dx3, dy3, dz3); } // Contribution (1,0,1) @@ -503,7 +503,7 @@ public double eval(double x, double y, double z) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx2, dy2, dz2); + value += attn2 * attn2 * extrapolate(xsb + 1, ysb, zsb + 1, dx2, dy2, dz2); } // Contribution (0,1,1) @@ -513,7 +513,7 @@ public double eval(double x, double y, double z) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx1, dy1, dz1); + value += attn1 * attn1 * extrapolate(xsb, ysb + 1, zsb + 1, dx1, dy1, dz1); } // Contribution (1,1,1) @@ -717,7 +717,7 @@ public double eval(double x, double y, double z) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1); + value += attn1 * attn1 * extrapolate(xsb + 1, ysb, zsb, dx1, dy1, dz1); } // Contribution (0,1,0) @@ -727,7 +727,7 @@ public double eval(double x, double y, double z) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2); + value += attn2 * attn2 * extrapolate(xsb, ysb + 1, zsb, dx2, dy2, dz2); } // Contribution (0,0,1) @@ -737,7 +737,7 @@ public double eval(double x, double y, double z) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3); + value += attn3 * attn3 * extrapolate(xsb, ysb, zsb + 1, dx3, dy3, dz3); } // Contribution (1,1,0) @@ -747,7 +747,7 @@ public double eval(double x, double y, double z) double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4; if (attn4 > 0) { attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx4, dy4, dz4); + value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb, dx4, dy4, dz4); } // Contribution (1,0,1) @@ -757,7 +757,7 @@ public double eval(double x, double y, double z) double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5; if (attn5 > 0) { attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx5, dy5, dz5); + value += attn5 * attn5 * extrapolate(xsb + 1, ysb, zsb + 1, dx5, dy5, dz5); } // Contribution (0,1,1) @@ -767,7 +767,7 @@ public double eval(double x, double y, double z) double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6; if (attn6 > 0) { attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx6, dy6, dz6); + value += attn6 * attn6 * extrapolate(xsb, ysb + 1, zsb + 1, dx6, dy6, dz6); } } @@ -1001,7 +1001,7 @@ public double eval(double x, double y, double z, double w) double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0; if (attn0 > 0) { attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 0, dx0, dy0, dz0, dw0); + value += attn0 * attn0 * extrapolate(xsb, ysb, zsb, wsb, dx0, dy0, dz0, dw0); } // Contribution (1,0,0,0) @@ -1012,7 +1012,7 @@ public double eval(double x, double y, double z, double w) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1); + value += attn1 * attn1 * extrapolate(xsb + 1, ysb, zsb, wsb, dx1, dy1, dz1, dw1); } // Contribution (0,1,0,0) @@ -1023,7 +1023,7 @@ public double eval(double x, double y, double z, double w) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2); + value += attn2 * attn2 * extrapolate(xsb, ysb + 1, zsb, wsb, dx2, dy2, dz2, dw2); } // Contribution (0,0,1,0) @@ -1034,7 +1034,7 @@ public double eval(double x, double y, double z, double w) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3); + value += attn3 * attn3 * extrapolate(xsb, ysb, zsb + 1, wsb, dx3, dy3, dz3, dw3); } // Contribution (0,0,0,1) @@ -1045,7 +1045,7 @@ public double eval(double x, double y, double z, double w) double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; if (attn4 > 0) { attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4); + value += attn4 * attn4 * extrapolate(xsb, ysb, zsb, wsb + 1, dx4, dy4, dz4, dw4); } } else if (inSum >= 3) { // We're inside the pentachoron (4-Simplex) at // (1,1,1,1) @@ -1212,7 +1212,7 @@ public double eval(double x, double y, double z, double w) double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; if (attn4 > 0) { attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4); + value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb, dx4, dy4, dz4, dw4); } // Contribution (1,1,0,1) @@ -1223,7 +1223,7 @@ public double eval(double x, double y, double z, double w) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3); + value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb, wsb + 1, dx3, dy3, dz3, dw3); } // Contribution (1,0,1,1) @@ -1234,7 +1234,7 @@ public double eval(double x, double y, double z, double w) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); + value += attn2 * attn2 * extrapolate(xsb + 1, ysb, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); } // Contribution (0,1,1,1) @@ -1245,7 +1245,7 @@ public double eval(double x, double y, double z, double w) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); + value += attn1 * attn1 * extrapolate(xsb, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); } // Contribution (1,1,1,1) @@ -1588,7 +1588,7 @@ public double eval(double x, double y, double z, double w) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1); + value += attn1 * attn1 * extrapolate(xsb + 1, ysb, zsb, wsb, dx1, dy1, dz1, dw1); } // Contribution (0,1,0,0) @@ -1599,7 +1599,7 @@ public double eval(double x, double y, double z, double w) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2); + value += attn2 * attn2 * extrapolate(xsb, ysb + 1, zsb, wsb, dx2, dy2, dz2, dw2); } // Contribution (0,0,1,0) @@ -1610,7 +1610,7 @@ public double eval(double x, double y, double z, double w) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3); + value += attn3 * attn3 * extrapolate(xsb, ysb, zsb + 1, wsb, dx3, dy3, dz3, dw3); } // Contribution (0,0,0,1) @@ -1621,7 +1621,7 @@ public double eval(double x, double y, double z, double w) double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; if (attn4 > 0) { attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4); + value += attn4 * attn4 * extrapolate(xsb, ysb, zsb, wsb + 1, dx4, dy4, dz4, dw4); } // Contribution (1,1,0,0) @@ -1632,7 +1632,7 @@ public double eval(double x, double y, double z, double w) double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5; if (attn5 > 0) { attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5); + value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb, wsb, dx5, dy5, dz5, dw5); } // Contribution (1,0,1,0) @@ -1643,7 +1643,7 @@ public double eval(double x, double y, double z, double w) double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6; if (attn6 > 0) { attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6); + value += attn6 * attn6 * extrapolate(xsb + 1, ysb, zsb + 1, wsb, dx6, dy6, dz6, dw6); } // Contribution (1,0,0,1) @@ -1654,7 +1654,7 @@ public double eval(double x, double y, double z, double w) double attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7; if (attn7 > 0) { attn7 *= attn7; - value += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7); + value += attn7 * attn7 * extrapolate(xsb + 1, ysb, zsb, wsb + 1, dx7, dy7, dz7, dw7); } // Contribution (0,1,1,0) @@ -1665,7 +1665,7 @@ public double eval(double x, double y, double z, double w) double attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8; if (attn8 > 0) { attn8 *= attn8; - value += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8); + value += attn8 * attn8 * extrapolate(xsb, ysb + 1, zsb + 1, wsb, dx8, dy8, dz8, dw8); } // Contribution (0,1,0,1) @@ -1676,7 +1676,7 @@ public double eval(double x, double y, double z, double w) double attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9; if (attn9 > 0) { attn9 *= attn9; - value += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9); + value += attn9 * attn9 * extrapolate(xsb, ysb + 1, zsb, wsb + 1, dx9, dy9, dz9, dw9); } // Contribution (0,0,1,1) @@ -1687,7 +1687,7 @@ public double eval(double x, double y, double z, double w) double attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10; if (attn10 > 0) { attn10 *= attn10; - value += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); + value += attn10 * attn10 * extrapolate(xsb, ysb, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); } } else { // We're inside the second dispentachoron (Rectified 4-Simplex) double aScore; @@ -2010,7 +2010,7 @@ public double eval(double x, double y, double z, double w) double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; if (attn4 > 0) { attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4); + value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb, dx4, dy4, dz4, dw4); } // Contribution (1,1,0,1) @@ -2021,7 +2021,7 @@ public double eval(double x, double y, double z, double w) double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; if (attn3 > 0) { attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3); + value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb, wsb + 1, dx3, dy3, dz3, dw3); } // Contribution (1,0,1,1) @@ -2032,7 +2032,7 @@ public double eval(double x, double y, double z, double w) double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; if (attn2 > 0) { attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); + value += attn2 * attn2 * extrapolate(xsb + 1, ysb, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); } // Contribution (0,1,1,1) @@ -2043,7 +2043,7 @@ public double eval(double x, double y, double z, double w) double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; if (attn1 > 0) { attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); + value += attn1 * attn1 * extrapolate(xsb, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); } // Contribution (1,1,0,0) @@ -2054,7 +2054,7 @@ public double eval(double x, double y, double z, double w) double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5; if (attn5 > 0) { attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5); + value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb, wsb, dx5, dy5, dz5, dw5); } // Contribution (1,0,1,0) @@ -2065,7 +2065,7 @@ public double eval(double x, double y, double z, double w) double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6; if (attn6 > 0) { attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6); + value += attn6 * attn6 * extrapolate(xsb + 1, ysb, zsb + 1, wsb, dx6, dy6, dz6, dw6); } // Contribution (1,0,0,1) @@ -2076,7 +2076,7 @@ public double eval(double x, double y, double z, double w) double attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7; if (attn7 > 0) { attn7 *= attn7; - value += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7); + value += attn7 * attn7 * extrapolate(xsb + 1, ysb, zsb, wsb + 1, dx7, dy7, dz7, dw7); } // Contribution (0,1,1,0) @@ -2087,7 +2087,7 @@ public double eval(double x, double y, double z, double w) double attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8; if (attn8 > 0) { attn8 *= attn8; - value += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8); + value += attn8 * attn8 * extrapolate(xsb, ysb + 1, zsb + 1, wsb, dx8, dy8, dz8, dw8); } // Contribution (0,1,0,1) @@ -2098,7 +2098,7 @@ public double eval(double x, double y, double z, double w) double attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9; if (attn9 > 0) { attn9 *= attn9; - value += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9); + value += attn9 * attn9 * extrapolate(xsb, ysb + 1, zsb, wsb + 1, dx9, dy9, dz9, dw9); } // Contribution (0,0,1,1) @@ -2109,7 +2109,7 @@ public double eval(double x, double y, double z, double w) double attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10; if (attn10 > 0) { attn10 *= attn10; - value += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); + value += attn10 * attn10 * extrapolate(xsb, ysb, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/math/noise/fastnoise/lite/FastNoiseLite.java b/Common/src/main/java/potionstudios/byg/common/world/math/noise/fastnoise/lite/FastNoiseLite.java index dd5ca0db7a..c7a9cc66ca 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/math/noise/fastnoise/lite/FastNoiseLite.java +++ b/Common/src/main/java/potionstudios/byg/common/world/math/noise/fastnoise/lite/FastNoiseLite.java @@ -316,7 +316,8 @@ public float GetNoise(/*FMLdouble*/ double x, /*FMLdouble*/ double y) case OpenSimplex2: case OpenSimplex2S: { - final /*FMLdouble*/ double SQRT3 = (/*FMLdouble*/ double)1.7320508075688772935274463415059; + /*FMLdouble*/ + final /*FMLdouble*/ double SQRT3 = 1.7320508075688772935274463415059; final /*FMLdouble*/ double F2 = 0.5f * (SQRT3 - 1); /*FMLdouble*/ double t = (x + y) * F2; x += t; @@ -327,17 +328,12 @@ public float GetNoise(/*FMLdouble*/ double x, /*FMLdouble*/ double y) break; } - switch (mFractalType) - { - default: - return GenNoiseSingle(mSeed, x, y); - case FBm: - return GenFractalFBm(x, y); - case Ridged: - return GenFractalRidged(x, y); - case PingPong: - return GenFractalPingPong(x, y); - } + return switch (mFractalType) { + default -> GenNoiseSingle(mSeed, x, y); + case FBm -> GenFractalFBm(x, y); + case Ridged -> GenFractalRidged(x, y); + case PingPong -> GenFractalPingPong(x, y); + }; } /// @@ -358,25 +354,30 @@ public float GetNoise(/*FMLdouble*/ double x, /*FMLdouble*/ double y, /*FMLdoubl { /*FMLdouble*/ double xy = x + y; /*FMLdouble*/ double s2 = xy * -(/*FMLdouble*/ double)0.211324865405187; - z *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + z *= 0.577350269189626; x += s2 - z; y = y + s2 - z; - z += xy * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + z += xy * 0.577350269189626; } break; case ImproveXZPlanes: { /*FMLdouble*/ double xz = x + z; /*FMLdouble*/ double s2 = xz * -(/*FMLdouble*/ double)0.211324865405187; - y *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + y *= 0.577350269189626; x += s2 - y; z += s2 - y; - y += xz * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + y += xz * 0.577350269189626; } break; case DefaultOpenSimplex2: { - final /*FMLdouble*/ double R3 = (/*FMLdouble*/ double)(2.0 / 3.0); + /*FMLdouble*/ + final /*FMLdouble*/ double R3 = 2.0 / 3.0; /*FMLdouble*/ double r = (x + y + z) * R3; // Rotation, not skew x = r - x; y = r - y; @@ -387,17 +388,12 @@ public float GetNoise(/*FMLdouble*/ double x, /*FMLdouble*/ double y, /*FMLdoubl break; } - switch (mFractalType) - { - default: - return GenNoiseSingle(mSeed, x, y, z); - case FBm: - return GenFractalFBm(x, y, z); - case Ridged: - return GenFractalRidged(x, y, z); - case PingPong: - return GenFractalPingPong(x, y, z); - } + return switch (mFractalType) { + default -> GenNoiseSingle(mSeed, x, y, z); + case FBm -> GenFractalFBm(x, y, z); + case Ridged -> GenFractalRidged(x, y, z); + case PingPong -> GenFractalPingPong(x, y, z); + }; } @@ -687,44 +683,28 @@ private static float GradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, private float GenNoiseSingle(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ double y) { - switch (mNoiseType) - { - case OpenSimplex2: - return SingleSimplex(seed, x, y); - case OpenSimplex2S: - return SingleOpenSimplex2S(seed, x, y); - case Cellular: - return SingleCellular(seed, x, y); - case Perlin: - return SinglePerlin(seed, x, y); - case ValueCubic: - return SingleValueCubic(seed, x, y); - case Value: - return SingleValue(seed, x, y); - default: - return 0; - } + return switch (mNoiseType) { + case OpenSimplex2 -> SingleSimplex(seed, x, y); + case OpenSimplex2S -> SingleOpenSimplex2S(seed, x, y); + case Cellular -> SingleCellular(seed, x, y); + case Perlin -> SinglePerlin(seed, x, y); + case ValueCubic -> SingleValueCubic(seed, x, y); + case Value -> SingleValue(seed, x, y); + default -> 0; + }; } private float GenNoiseSingle(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ double y, /*FMLdouble*/ double z) { - switch (mNoiseType) - { - case OpenSimplex2: - return SingleOpenSimplex2(seed, x, y, z); - case OpenSimplex2S: - return SingleOpenSimplex2S(seed, x, y, z); - case Cellular: - return SingleCellular(seed, x, y, z); - case Perlin: - return SinglePerlin(seed, x, y, z); - case ValueCubic: - return SingleValueCubic(seed, x, y, z); - case Value: - return SingleValue(seed, x, y, z); - default: - return 0; - } + return switch (mNoiseType) { + case OpenSimplex2 -> SingleOpenSimplex2(seed, x, y, z); + case OpenSimplex2S -> SingleOpenSimplex2S(seed, x, y, z); + case Cellular -> SingleCellular(seed, x, y, z); + case Perlin -> SinglePerlin(seed, x, y, z); + case ValueCubic -> SingleValueCubic(seed, x, y, z); + case Value -> SingleValue(seed, x, y, z); + default -> 0; + }; } @@ -935,8 +915,8 @@ private float SingleSimplex(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ doub float yi = (float)(y - j); float t = (xi + yi) * G2; - float x0 = (float)(xi - t); - float y0 = (float)(yi - t); + float x0 = xi - t; + float y0 = yi - t; i *= PrimeX; j *= PrimeY; @@ -950,19 +930,19 @@ private float SingleSimplex(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ doub n0 = (a * a) * (a * a) * GradCoord(seed, i, j, x0, y0); } - float c = (float)(2 * (1 - 2 * G2) * (1 / G2 - 2)) * t + ((float)(-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); + float c = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); if (c <= 0) n2 = 0; else { - float x2 = x0 + (2 * (float)G2 - 1); - float y2 = y0 + (2 * (float)G2 - 1); + float x2 = x0 + (2 * G2 - 1); + float y2 = y0 + (2 * G2 - 1); n2 = (c * c) * (c * c) * GradCoord(seed, i + PrimeX, j + PrimeY, x2, y2); } if (y0 > x0) { - float x1 = x0 + (float)G2; - float y1 = y0 + ((float)G2 - 1); + float x1 = x0 + G2; + float y1 = y0 + (G2 - 1); float b = 0.5f - x1 * x1 - y1 * y1; if (b <= 0) n1 = 0; else @@ -972,8 +952,8 @@ private float SingleSimplex(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ doub } else { - float x1 = x0 + ((float)G2 - 1); - float y1 = y0 + (float)G2; + float x1 = x0 + (G2 - 1); + float y1 = y0 + G2; float b = 0.5f - x1 * x1 - y1 * y1; if (b <= 0) n1 = 0; else @@ -1086,7 +1066,8 @@ private float SingleOpenSimplex2S(int seed, /*FMLdouble*/ double x, /*FMLdouble* { // 2D OpenSimplex2S case is a modified 2D simplex noise. - final /*FMLdouble*/ double SQRT3 = (/*FMLdouble*/ double)1.7320508075688772935274463415059; + /*FMLdouble*/ + final /*FMLdouble*/ double SQRT3 = 1.7320508075688772935274463415059; final /*FMLdouble*/ double G2 = (3 - SQRT3) / 6; /* @@ -1515,25 +1496,16 @@ private float SingleCellular(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ dou } } - switch (mCellularReturnType) - { - case CellValue: - return closestHash * (1 / 2147483648.0f); - case Distance: - return distance0 - 1; - case Distance2: - return distance1 - 1; - case Distance2Add: - return (distance1 + distance0) * 0.5f - 1; - case Distance2Sub: - return distance1 - distance0 - 1; - case Distance2Mul: - return distance1 * distance0 * 0.5f - 1; - case Distance2Div: - return distance0 / distance1 - 1; - default: - return 0; - } + return switch (mCellularReturnType) { + case CellValue -> closestHash * (1 / 2147483648.0f); + case Distance -> distance0 - 1; + case Distance2 -> distance1 - 1; + case Distance2Add -> (distance1 + distance0) * 0.5f - 1; + case Distance2Sub -> distance1 - distance0 - 1; + case Distance2Mul -> distance1 * distance0 * 0.5f - 1; + case Distance2Div -> distance0 / distance1 - 1; + default -> 0; + }; } private float SingleCellular(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ double y, /*FMLdouble*/ double z) @@ -1668,25 +1640,16 @@ private float SingleCellular(int seed, /*FMLdouble*/ double x, /*FMLdouble*/ dou } } - switch (mCellularReturnType) - { - case CellValue: - return closestHash * (1 / 2147483648.0f); - case Distance: - return distance0 - 1; - case Distance2: - return distance1 - 1; - case Distance2Add: - return (distance1 + distance0) * 0.5f - 1; - case Distance2Sub: - return distance1 - distance0 - 1; - case Distance2Mul: - return distance1 * distance0 * 0.5f - 1; - case Distance2Div: - return distance0 / distance1 - 1; - default: - return 0; - } + return switch (mCellularReturnType) { + case CellValue -> closestHash * (1 / 2147483648.0f); + case Distance -> distance0 - 1; + case Distance2 -> distance1 - 1; + case Distance2Add -> (distance1 + distance0) * 0.5f - 1; + case Distance2Sub -> distance1 - distance0 - 1; + case Distance2Mul -> distance1 * distance0 * 0.5f - 1; + case Distance2Div -> distance0 / distance1 - 1; + default -> 0; + }; } @@ -1937,7 +1900,8 @@ private void DomainWarpSingle(Vector2 coord) case OpenSimplex2: case OpenSimplex2Reduced: { - final /*FMLdouble*/ double SQRT3 = (/*FMLdouble*/ double)1.7320508075688772935274463415059; + /*FMLdouble*/ + final /*FMLdouble*/ double SQRT3 = 1.7320508075688772935274463415059; final /*FMLdouble*/ double F2 = 0.5f * (SQRT3 - 1); /*FMLdouble*/ double t = (xs + ys) * F2; xs += t; ys += t; @@ -1965,24 +1929,29 @@ private void DomainWarpSingle(Vector3 coord) { /*FMLdouble*/ double xy = xs + ys; /*FMLdouble*/ double s2 = xy * -(/*FMLdouble*/ double)0.211324865405187; - zs *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs *= 0.577350269189626; xs += s2 - zs; ys = ys + s2 - zs; - zs += xy * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs += xy * 0.577350269189626; } break; case ImproveXZPlanes: { /*FMLdouble*/ double xz = xs + zs; /*FMLdouble*/ double s2 = xz * -(/*FMLdouble*/ double)0.211324865405187; - ys *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys *= 0.577350269189626; xs += s2 - ys; zs += s2 - ys; - ys += xz * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys += xz * 0.577350269189626; } break; case DefaultOpenSimplex2: { - final /*FMLdouble*/ double R3 = (/*FMLdouble*/ double)(2.0 / 3.0); + /*FMLdouble*/ + final /*FMLdouble*/ double R3 = 2.0 / 3.0; /*FMLdouble*/ double r = (xs + ys + zs) * R3; // Rotation, not skew xs = r - xs; ys = r - ys; @@ -2014,7 +1983,8 @@ private void DomainWarpFractalProgressive(Vector2 coord) case OpenSimplex2: case OpenSimplex2Reduced: { - final /*FMLdouble*/ double SQRT3 = (/*FMLdouble*/ double)1.7320508075688772935274463415059; + /*FMLdouble*/ + final /*FMLdouble*/ double SQRT3 = 1.7320508075688772935274463415059; final /*FMLdouble*/ double F2 = 0.5f * (SQRT3 - 1); /*FMLdouble*/ double t = (xs + ys) * F2; xs += t; ys += t; @@ -2049,24 +2019,29 @@ private void DomainWarpFractalProgressive(Vector3 coord) { /*FMLdouble*/ double xy = xs + ys; /*FMLdouble*/ double s2 = xy * -(/*FMLdouble*/ double)0.211324865405187; - zs *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs *= 0.577350269189626; xs += s2 - zs; ys = ys + s2 - zs; - zs += xy * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs += xy * 0.577350269189626; } break; case ImproveXZPlanes: { /*FMLdouble*/ double xz = xs + zs; /*FMLdouble*/ double s2 = xz * -(/*FMLdouble*/ double)0.211324865405187; - ys *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys *= 0.577350269189626; xs += s2 - ys; zs += s2 - ys; - ys += xz * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys += xz * 0.577350269189626; } break; case DefaultOpenSimplex2: { - final /*FMLdouble*/ double R3 = (/*FMLdouble*/ double)(2.0 / 3.0); + /*FMLdouble*/ + final /*FMLdouble*/ double R3 = 2.0 / 3.0; /*FMLdouble*/ double r = (xs + ys + zs) * R3; // Rotation, not skew xs = r - xs; ys = r - ys; @@ -2096,7 +2071,8 @@ private void DomainWarpFractalIndependent(Vector2 coord) case OpenSimplex2: case OpenSimplex2Reduced: { - final /*FMLdouble*/ double SQRT3 = (/*FMLdouble*/ double)1.7320508075688772935274463415059; + /*FMLdouble*/ + final /*FMLdouble*/ double SQRT3 = 1.7320508075688772935274463415059; final /*FMLdouble*/ double F2 = 0.5f * (SQRT3 - 1); /*FMLdouble*/ double t = (xs + ys) * F2; xs += t; ys += t; @@ -2131,24 +2107,29 @@ private void DomainWarpFractalIndependent(Vector3 coord) { /*FMLdouble*/ double xy = xs + ys; /*FMLdouble*/ double s2 = xy * -(/*FMLdouble*/ double)0.211324865405187; - zs *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs *= 0.577350269189626; xs += s2 - zs; ys = ys + s2 - zs; - zs += xy * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + zs += xy * 0.577350269189626; } break; case ImproveXZPlanes: { /*FMLdouble*/ double xz = xs + zs; /*FMLdouble*/ double s2 = xz * -(/*FMLdouble*/ double)0.211324865405187; - ys *= (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys *= 0.577350269189626; xs += s2 - ys; zs += s2 - ys; - ys += xz * (/*FMLdouble*/ double)0.577350269189626; + /*FMLdouble*/ + ys += xz * 0.577350269189626; } break; case DefaultOpenSimplex2: { - final /*FMLdouble*/ double R3 = (/*FMLdouble*/ double)(2.0 / 3.0); + /*FMLdouble*/ + final /*FMLdouble*/ double R3 = 2.0 / 3.0; /*FMLdouble*/ double r = (xs + ys + zs) * R3; // Rotation, not skew xs = r - xs; ys = r - ys; @@ -2289,8 +2270,8 @@ private void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float freq float yi = (float)(y - j); float t = (xi + yi) * G2; - float x0 = (float)(xi - t); - float y0 = (float)(yi - t); + float x0 = xi - t; + float y0 = yi - t; i *= PrimeX; j *= PrimeY; @@ -2326,11 +2307,11 @@ private void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float freq vy += aaaa * yo; } - float c = (float)(2 * (1 - 2 * G2) * (1 / G2 - 2)) * t + ((float)(-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); + float c = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); if (c > 0) { - float x2 = x0 + (2 * (float)G2 - 1); - float y2 = y0 + (2 * (float)G2 - 1); + float x2 = x0 + (2 * G2 - 1); + float y2 = y0 + (2 * G2 - 1); float cccc = (c * c) * (c * c); float xo, yo; if (outGradOnly) @@ -2358,8 +2339,8 @@ private void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float freq if (y0 > x0) { - float x1 = x0 + (float)G2; - float y1 = y0 + ((float)G2 - 1); + float x1 = x0 + G2; + float y1 = y0 + (G2 - 1); float b = 0.5f - x1 * x1 - y1 * y1; if (b > 0) { @@ -2390,8 +2371,8 @@ private void SingleDomainWarpSimplexGradient(int seed, float warpAmp, float freq } else { - float x1 = x0 + ((float)G2 - 1); - float y1 = y0 + (float)G2; + float x1 = x0 + (G2 - 1); + float y1 = y0 + G2; float b = 0.5f - x1 * x1 - y1 * y1; if (b > 0) { diff --git a/Common/src/main/java/potionstudios/byg/common/world/math/noise/simplex/OpenSimplex2.java b/Common/src/main/java/potionstudios/byg/common/world/math/noise/simplex/OpenSimplex2.java index fdf8b27040..765eb1c11a 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/math/noise/simplex/OpenSimplex2.java +++ b/Common/src/main/java/potionstudios/byg/common/world/math/noise/simplex/OpenSimplex2.java @@ -267,12 +267,12 @@ private static int fastRound(double x) { } i += grad2.length; } - for (int f = 0; f < grad2FillIndices.length; f++) { - int gi = grad2FillIndices[f] * 2; - GRADIENTS_2D[i | 0] = grad2[gi | 0]; - GRADIENTS_2D[i | 1] = grad2[gi | 1]; - i += 2; - } + for (int grad2FillIndex : grad2FillIndices) { + int gi = grad2FillIndex * 2; + GRADIENTS_2D[i | 0] = grad2[gi | 0]; + GRADIENTS_2D[i | 1] = grad2[gi | 1]; + i += 2; + } } int[] grad3FillIndices = new int[] { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 44, 45, 46, 47 }; @@ -338,13 +338,13 @@ private static int fastRound(double x) { } i += grad3.length; } - for (int f = 0; f < grad3FillIndices.length; f++) { - int gi = grad3FillIndices[f] * 4; - GRADIENTS_3D[i | 0] = grad3[gi | 0]; - GRADIENTS_3D[i | 1] = grad3[gi | 1]; - GRADIENTS_3D[i | 2] = grad3[gi | 2]; - i += 4; - } + for (int grad3FillIndex : grad3FillIndices) { + int gi = grad3FillIndex * 4; + GRADIENTS_3D[i | 0] = grad3[gi | 0]; + GRADIENTS_3D[i | 1] = grad3[gi | 1]; + GRADIENTS_3D[i | 2] = grad3[gi | 2]; + i += 4; + } } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/placement/AboveHeightmapFilter.java b/Common/src/main/java/potionstudios/byg/common/world/placement/AboveHeightmapFilter.java index a0f3bc7f67..d1c6ebce4e 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/placement/AboveHeightmapFilter.java +++ b/Common/src/main/java/potionstudios/byg/common/world/placement/AboveHeightmapFilter.java @@ -8,15 +8,14 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.jetbrains.annotations.NotNull; import java.util.stream.Stream; public class AboveHeightmapFilter extends PlacementModifier { - public static Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Heightmap.Types.CODEC.fieldOf("above_type").forGetter(nearWaterPlacementFilter -> nearWaterPlacementFilter.heightmap) - ).apply(builder, AboveHeightmapFilter::new); - }); + public static Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + Heightmap.Types.CODEC.fieldOf("above_type").forGetter(nearWaterPlacementFilter -> nearWaterPlacementFilter.heightmap) + ).apply(builder, AboveHeightmapFilter::new)); private final Heightmap.Types heightmap; @@ -26,12 +25,12 @@ public AboveHeightmapFilter(Heightmap.Types heightmap) { @Override - public Stream getPositions(PlacementContext placementContext, RandomSource random, BlockPos blockPos) { + public @NotNull Stream getPositions(PlacementContext placementContext, @NotNull RandomSource random, BlockPos blockPos) { return blockPos.getY() >= placementContext.getHeight(heightmap, blockPos.getX(), blockPos.getZ()) ? Stream.of(blockPos) : Stream.empty(); } @Override - public PlacementModifierType type() { + public @NotNull PlacementModifierType type() { return BYGPlacementModifierType.ABOVE_HEIGHTMAP_FILTER.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/placement/ChunkCoveringPlacement.java b/Common/src/main/java/potionstudios/byg/common/world/placement/ChunkCoveringPlacement.java index 08c2ee3892..72707b6333 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/placement/ChunkCoveringPlacement.java +++ b/Common/src/main/java/potionstudios/byg/common/world/placement/ChunkCoveringPlacement.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -17,7 +18,7 @@ public class ChunkCoveringPlacement extends PlacementModifier { public static final Codec CODEC = Codec.unit(() -> INSTANCE); @Override - public Stream getPositions(PlacementContext placementContext, RandomSource random, BlockPos blockPos) { + public @NotNull Stream getPositions(@NotNull PlacementContext placementContext, @NotNull RandomSource random, @NotNull BlockPos blockPos) { List positions = new ArrayList<>(); for (int x = 0; x < 16; x++) { @@ -31,7 +32,7 @@ public Stream getPositions(PlacementContext placementContext, RandomSo } @Override - public PlacementModifierType type() { + public @NotNull PlacementModifierType type() { return BYGPlacementModifierType.CHUNK_COVERING_PLACEMENT.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/placement/IsBiomeTagFilter.java b/Common/src/main/java/potionstudios/byg/common/world/placement/IsBiomeTagFilter.java index ad02bc42f8..1bb9688f22 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/placement/IsBiomeTagFilter.java +++ b/Common/src/main/java/potionstudios/byg/common/world/placement/IsBiomeTagFilter.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.jetbrains.annotations.NotNull; import java.util.stream.Stream; @@ -27,12 +28,12 @@ public IsBiomeTagFilter(TagKey biomeTag) { } @Override - public Stream getPositions(PlacementContext placementContext, RandomSource random, BlockPos blockPos) { + public @NotNull Stream getPositions(PlacementContext placementContext, @NotNull RandomSource random, @NotNull BlockPos blockPos) { return placementContext.getLevel().getBiome(blockPos).is(this.biomeTag) ? Stream.of(blockPos) : Stream.of(); } @Override - public PlacementModifierType type() { + public @NotNull PlacementModifierType type() { return BYGPlacementModifierType.IS_BIOME_TAG_FILTER.get(); } } \ No newline at end of file diff --git a/Common/src/main/java/potionstudios/byg/common/world/placement/IsDimensionFilter.java b/Common/src/main/java/potionstudios/byg/common/world/placement/IsDimensionFilter.java index bf49cef23f..bb2e8ab48c 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/placement/IsDimensionFilter.java +++ b/Common/src/main/java/potionstudios/byg/common/world/placement/IsDimensionFilter.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Stream; @@ -28,12 +29,12 @@ public IsDimensionFilter(List> validDimensions) { } @Override - public Stream getPositions(PlacementContext placementContext, RandomSource random, BlockPos blockPos) { + public @NotNull Stream getPositions(PlacementContext placementContext, @NotNull RandomSource random, @NotNull BlockPos blockPos) { return this.validDimensions.contains(placementContext.getLevel().getLevel().dimension()) ? Stream.of(blockPos) : Stream.empty(); } @Override - public PlacementModifierType type() { + public @NotNull PlacementModifierType type() { return BYGPlacementModifierType.IS_DIMENSION_FILTER.get(); } } \ No newline at end of file diff --git a/Common/src/main/java/potionstudios/byg/common/world/placement/NearWaterPlacementFilter.java b/Common/src/main/java/potionstudios/byg/common/world/placement/NearWaterPlacementFilter.java index 85da4130fa..f0ce9a395e 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/placement/NearWaterPlacementFilter.java +++ b/Common/src/main/java/potionstudios/byg/common/world/placement/NearWaterPlacementFilter.java @@ -8,15 +8,14 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.jetbrains.annotations.NotNull; import java.util.stream.Stream; public class NearWaterPlacementFilter extends PlacementModifier { - public static Codec CODEC = RecordCodecBuilder.create(builder -> { - return builder.group( - Codec.INT.fieldOf("searchRange").forGetter(nearWaterPlacementFilter -> nearWaterPlacementFilter.waterSearchRange) - ).apply(builder, NearWaterPlacementFilter::new); - }); + public static Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( + Codec.INT.fieldOf("searchRange").forGetter(nearWaterPlacementFilter -> nearWaterPlacementFilter.waterSearchRange) + ).apply(builder, NearWaterPlacementFilter::new)); private final int waterSearchRange; @@ -26,7 +25,7 @@ public NearWaterPlacementFilter(int waterSearchRange) { @Override - public Stream getPositions(PlacementContext placementContext, RandomSource random, BlockPos blockPos) { + public @NotNull Stream getPositions(@NotNull PlacementContext placementContext, @NotNull RandomSource random, @NotNull BlockPos blockPos) { for (int xMove = -waterSearchRange; xMove <= waterSearchRange; xMove++) { for (int zMove = -waterSearchRange; zMove <= waterSearchRange; zMove++) { if (placementContext.getLevel().getBlockState(blockPos.offset(xMove, -1, zMove)).is(Blocks.WATER)) { @@ -39,7 +38,7 @@ public Stream getPositions(PlacementContext placementContext, RandomSo } @Override - public PlacementModifierType type() { + public @NotNull PlacementModifierType type() { return BYGPlacementModifierType.NEAR_WATER_FILTER.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/AncientSequoiaTreeStructure.java b/Common/src/main/java/potionstudios/byg/common/world/structure/AncientSequoiaTreeStructure.java index 199a6c371c..578d0764fb 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/AncientSequoiaTreeStructure.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/AncientSequoiaTreeStructure.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -58,14 +59,12 @@ public static BoundingBox getWritableArea(ChunkPos chunkPos, LevelHeightAccessor } @Override - public Optional findGenerationPoint(GenerationContext generationContext) { - return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> { - generatePieces(piecesBuilder, generationContext, this.config); - }); + public @NotNull Optional findGenerationPoint(@NotNull GenerationContext generationContext) { + return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> generatePieces(piecesBuilder, generationContext, this.config)); } @Override - public StructureType type() { + public @NotNull StructureType type() { return BYGStructureTypes.ANCIENT_SEQUOIA_TREE.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/AncientTreePiece.java b/Common/src/main/java/potionstudios/byg/common/world/structure/AncientTreePiece.java index 0defebb7e2..5e6fbfd9f5 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/AncientTreePiece.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/AncientTreePiece.java @@ -21,6 +21,7 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGWoodTypes; import potionstudios.byg.mixin.access.StructureTemplateAccess; @@ -49,13 +50,13 @@ public AncientTreePiece(StructurePieceSerializationContext context, CompoundTag } @Override - protected void addAdditionalSaveData(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag) { + protected void addAdditionalSaveData(@NotNull StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag) { compoundTag.put("place_pos", NbtUtils.writeBlockPos(this.placePos)); compoundTag.putString("structure_id", this.structureId.toString()); } @Override - public void postProcess(WorldGenLevel worldGenLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, RandomSource randomSource, BoundingBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { + public void postProcess(@NotNull WorldGenLevel worldGenLevel, @NotNull StructureManager structureManager, @NotNull ChunkGenerator chunkGenerator, @NotNull RandomSource randomSource, @NotNull BoundingBox boundingBox, @NotNull ChunkPos chunkPos, @NotNull BlockPos blockPos) { StructurePlaceSettings placeSettings = new StructurePlaceSettings().setRotation(Rotation.getRandom(randomSource)); List basePalettes = ((StructureTemplateAccess) this.structureTemplate).byg_getPalettes(); diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/BYGStructureTypes.java b/Common/src/main/java/potionstudios/byg/common/world/structure/BYGStructureTypes.java index 2553c46033..f394e24b20 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/BYGStructureTypes.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/BYGStructureTypes.java @@ -21,7 +21,7 @@ public class BYGStructureTypes { public static final RegistryObject> ANCIENT_SEQUOIA_TREE = register("ancient_sequoia_tree", () -> AncientSequoiaTreeStructure.CODEC); private static RegistryObject> register(String id, Supplier> codec) { - return PROVIDER.register(id, () -> () -> codec.get()); + return PROVIDER.register(id, () -> codec::get); } public static void loadClass() { diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchPiece.java b/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchPiece.java index 76f9a42fca..b5e589734f 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchPiece.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchPiece.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.StructurePiece; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import potionstudios.byg.common.world.feature.BYGFeatures; import potionstudios.byg.common.world.feature.config.NoisySphereConfig; @@ -62,7 +63,7 @@ public ArchPiece(StructurePieceSerializationContext context, CompoundTag tag) { } @Override - protected void addAdditionalSaveData(StructurePieceSerializationContext context, CompoundTag compoundTag) { + protected void addAdditionalSaveData(StructurePieceSerializationContext context, @NotNull CompoundTag compoundTag) { ListTag positions = new ListTag(); RegistryOps tagRegistryOps = RegistryOps.create(NbtOps.INSTANCE, context.registryAccess()); @@ -80,7 +81,7 @@ protected void addAdditionalSaveData(StructurePieceSerializationContext context, } @Override - public void postProcess(WorldGenLevel worldGenLevel, StructureManager structureFeatureManager, ChunkGenerator chunkGenerator, RandomSource random, BoundingBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { + public void postProcess(@NotNull WorldGenLevel worldGenLevel, @NotNull StructureManager structureFeatureManager, @NotNull ChunkGenerator chunkGenerator, @NotNull RandomSource random, @NotNull BoundingBox boundingBox, @NotNull ChunkPos chunkPos, @NotNull BlockPos blockPos) { Long2ObjectLinkedOpenHashMap toPlace = new Long2ObjectLinkedOpenHashMap<>(1000); for (BlockPos position : this.positions) { diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchStructure.java b/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchStructure.java index 071410ea12..00113d7725 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchStructure.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/arch/ArchStructure.java @@ -20,6 +20,7 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.structure.BYGStructureTypes; import java.util.HashSet; @@ -30,11 +31,7 @@ public class ArchStructure extends Structure { - public static final Codec CODEC = RecordCodecBuilder.mapCodec((archStructureInstance) -> { - return archStructureInstance.group(settingsCodec(archStructureInstance), ArchConfiguration.CODEC.fieldOf("settings").forGetter((p_227656_) -> { - return p_227656_.archConfiguration; - })).apply(archStructureInstance, ArchStructure::new); - }).codec(); + public static final Codec CODEC = RecordCodecBuilder.mapCodec((archStructureInstance) -> archStructureInstance.group(settingsCodec(archStructureInstance), ArchConfiguration.CODEC.fieldOf("settings").forGetter((p_227656_) -> p_227656_.archConfiguration)).apply(archStructureInstance, ArchStructure::new)).codec(); public static final int PIECE_BB_EXPANSION = 5; @@ -185,14 +182,12 @@ private static boolean matchesBiome(BlockPos pos, ChunkGenerator generator, TagK @Override - public Optional findGenerationPoint(GenerationContext generationContext) { - return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> { - generatePieces(piecesBuilder, generationContext, this.archConfiguration); - }); + public @NotNull Optional findGenerationPoint(@NotNull GenerationContext generationContext) { + return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> generatePieces(piecesBuilder, generationContext, this.archConfiguration)); } @Override - public StructureType type() { + public @NotNull StructureType type() { return BYGStructureTypes.ARCH.get(); } } diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoPiece.java b/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoPiece.java index 4f0c1f5982..dff8a0b6a9 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoPiece.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoPiece.java @@ -20,6 +20,7 @@ import net.minecraft.world.level.levelgen.structure.StructurePiece; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGBlocks; import potionstudios.byg.common.world.feature.stateproviders.BetweenNoiseThresholdProvider; import potionstudios.byg.common.world.math.noise.fastnoise.lite.FastNoiseLite; @@ -42,13 +43,13 @@ public VolcanoPiece(StructurePieceSerializationContext context, CompoundTag tag) } @Override - protected void addAdditionalSaveData(StructurePieceSerializationContext context, CompoundTag compoundTag) { + protected void addAdditionalSaveData(@NotNull StructurePieceSerializationContext context, CompoundTag compoundTag) { compoundTag.put("volcano_info", VolcanoStructure.PieceStructureInfo.CODEC.encodeStart(NbtOps.INSTANCE, this.structureInfo).result().orElseThrow()); } @Override - public void postProcess(WorldGenLevel worldGenLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, RandomSource randomSource, BoundingBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { + public void postProcess(@NotNull WorldGenLevel worldGenLevel, @NotNull StructureManager structureManager, @NotNull ChunkGenerator chunkGenerator, @NotNull RandomSource randomSource, @NotNull BoundingBox boundingBox, ChunkPos chunkPos, @NotNull BlockPos blockPos) { BetweenNoiseThresholdProvider weightedBlockStateProvider = new BetweenNoiseThresholdProvider(123, new NormalNoise.NoiseParameters(-9, 1.0D, 1.0D, 1.0D, 1.0D), 1, List.of(UniformFloat.of(-0.0045F - 0.9F, 0.0045F - 0.9F), UniformFloat.of(-0.0045F, 0.0045F)), BlockStateProvider.simple(Blocks.MAGMA_BLOCK), new WeightedStateProvider(SimpleWeightedRandomList.builder() .add(Blocks.BASALT.defaultBlockState(), 9) diff --git a/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoStructure.java b/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoStructure.java index 9d125c2332..71af55d8d9 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoStructure.java +++ b/Common/src/main/java/potionstudios/byg/common/world/structure/volcano/VolcanoStructure.java @@ -17,6 +17,7 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.structure.BYGStructureTypes; import java.util.Optional; @@ -82,14 +83,12 @@ private static boolean matchesBiome(BlockPos pos, ChunkGenerator generator, TagK @Override - public Optional findGenerationPoint(GenerationContext generationContext) { - return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> { - generatePieces(piecesBuilder, generationContext); - }); + public @NotNull Optional findGenerationPoint(@NotNull GenerationContext generationContext) { + return onTopOfChunkCenter(generationContext, Heightmap.Types.WORLD_SURFACE_WG, (piecesBuilder) -> generatePieces(piecesBuilder, generationContext)); } @Override - public StructureType type() { + public @NotNull StructureType type() { return BYGStructureTypes.VOLCANO.get(); } diff --git a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BandsRuleSource.java b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BandsRuleSource.java index 6283d532e1..470028fa6b 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BandsRuleSource.java +++ b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BandsRuleSource.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.levelgen.SurfaceRules; import net.minecraft.world.level.levelgen.SurfaceSystem; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.SurfaceRuleContextAccess; import potionstudios.byg.mixin.access.SurfaceSystemAccess; @@ -41,7 +42,7 @@ public BandsRuleSource(BlockState[] bandStates) { } @Override - public KeyDispatchDataCodec codec() { + public @NotNull KeyDispatchDataCodec codec() { return CODEC; } diff --git a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BetweenRepeatingNoiseRange.java b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BetweenRepeatingNoiseRange.java index 742f07dcf3..dcfded1c51 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BetweenRepeatingNoiseRange.java +++ b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BetweenRepeatingNoiseRange.java @@ -8,6 +8,7 @@ import net.minecraft.util.valueproviders.FloatProvider; import net.minecraft.world.level.levelgen.SurfaceRules; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.world.feature.stateproviders.BetweenNoiseThresholdProvider; import java.util.ArrayList; @@ -58,7 +59,7 @@ private static SurfaceRules.RuleSource createNoiseConditions(ResourceKey codec() { + public @NotNull KeyDispatchDataCodec codec() { return CODEC; } diff --git a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BlockRuleSourceWithTick.java b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BlockRuleSourceWithTick.java index 2bb1ee3e43..076637f3fb 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BlockRuleSourceWithTick.java +++ b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/BlockRuleSourceWithTick.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.ticks.ScheduledTick; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.ChunkAccessAccess; import potionstudios.byg.mixin.access.SurfaceRuleContextAccess; import potionstudios.byg.mixin.access.SurfaceRulesStateRuleAccess; @@ -30,7 +31,7 @@ public record BlockRuleSourceWithTick(BlockState state, int tickDelay, } @Override - public KeyDispatchDataCodec codec() { + public @NotNull KeyDispatchDataCodec codec() { return CODEC; } diff --git a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/WeightedRuleSource.java b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/WeightedRuleSource.java index da75dee803..8b60acc557 100644 --- a/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/WeightedRuleSource.java +++ b/Common/src/main/java/potionstudios/byg/common/world/surfacerules/rulesource/WeightedRuleSource.java @@ -6,6 +6,7 @@ import net.minecraft.world.level.levelgen.PositionalRandomFactory; import net.minecraft.world.level.levelgen.SurfaceRules; import net.minecraft.world.level.levelgen.SurfaceSystem; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.mixin.access.SurfaceRuleContextAccess; import potionstudios.byg.util.SeedGetter; @@ -27,7 +28,7 @@ public WeightedRuleSource(SimpleWeightedRandomList rule } @Override - public KeyDispatchDataCodec codec() { + public @NotNull KeyDispatchDataCodec codec() { return CODEC; } diff --git a/Common/src/main/java/potionstudios/byg/config/BiomepediaConfig.java b/Common/src/main/java/potionstudios/byg/config/BiomepediaConfig.java index 559d7d52ad..c0ce05e493 100644 --- a/Common/src/main/java/potionstudios/byg/config/BiomepediaConfig.java +++ b/Common/src/main/java/potionstudios/byg/config/BiomepediaConfig.java @@ -44,9 +44,7 @@ private static BiomepediaConfig readConfig(boolean recreate) { final Path path = ModPlatform.INSTANCE.configPath().resolve("biomepedia.json5"); if (!path.toFile().exists() || recreate) { - JanksonUtil.createConfig(path, CODEC, JanksonUtil.HEADER_CLOSED, Util.make(new HashMap<>(), map -> { - map.put("inventory_enabled", ""); - }), JanksonJsonOps.INSTANCE, DEFAULT); + JanksonUtil.createConfig(path, CODEC, JanksonUtil.HEADER_CLOSED, Util.make(new HashMap<>(), map -> map.put("inventory_enabled", "")), JanksonJsonOps.INSTANCE, DEFAULT); } BYG.logInfo(String.format("\"%s\" was read.", path)); diff --git a/Common/src/main/java/potionstudios/byg/mixin/common/entity/MixinVillager.java b/Common/src/main/java/potionstudios/byg/mixin/common/entity/MixinVillager.java index faec5d7815..dfea3dac8c 100644 --- a/Common/src/main/java/potionstudios/byg/mixin/common/entity/MixinVillager.java +++ b/Common/src/main/java/potionstudios/byg/mixin/common/entity/MixinVillager.java @@ -20,6 +20,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.trading.MerchantOffer; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -49,7 +50,7 @@ public void makeWarden(Player player, InteractionHand hand, CallbackInfoReturnab } @Shadow - protected void rewardTradeXp(MerchantOffer var1) { + protected void rewardTradeXp(@NotNull MerchantOffer var1) { } @Shadow @@ -60,7 +61,7 @@ protected void updateTrades() { @Nullable @Override - public AgeableMob getBreedOffspring(ServerLevel $$0, AgeableMob $$1) { + public AgeableMob getBreedOffspring(@NotNull ServerLevel $$0, @NotNull AgeableMob $$1) { double $$2 = this.random.nextDouble(); VillagerType $$3; if ($$2 < 0.5D) { @@ -72,7 +73,7 @@ public AgeableMob getBreedOffspring(ServerLevel $$0, AgeableMob $$1) { } Villager $$6 = new Villager(EntityType.VILLAGER, $$0, $$3); - $$6.finalizeSpawn($$0, $$0.getCurrentDifficultyAt($$6.blockPosition()), MobSpawnType.BREEDING, (SpawnGroupData)null, (CompoundTag)null); + $$6.finalizeSpawn($$0, $$0.getCurrentDifficultyAt($$6.blockPosition()), MobSpawnType.BREEDING, null, null); return $$6; } } diff --git a/Common/src/main/java/potionstudios/byg/util/BlockHelper.java b/Common/src/main/java/potionstudios/byg/util/BlockHelper.java index 77e4f34045..5fce1611f4 100644 --- a/Common/src/main/java/potionstudios/byg/util/BlockHelper.java +++ b/Common/src/main/java/potionstudios/byg/util/BlockHelper.java @@ -69,11 +69,11 @@ public static Direction randomDirection(Random random) { } public static BlockState rotateHorizontal(BlockState state, Rotation rotation, DirectionProperty facing) { - return (BlockState) state.setValue(facing, rotation.rotate((Direction) state.getValue(facing))); + return state.setValue(facing, rotation.rotate(state.getValue(facing))); } public static BlockState mirrorHorizontal(BlockState state, Mirror mirror, DirectionProperty facing) { - return state.rotate(mirror.getRotation((Direction) state.getValue(facing))); + return state.rotate(mirror.getRotation(state.getValue(facing))); } public static Direction getRandomHorizontalDirection(Random rand) { diff --git a/Common/src/main/java/potionstudios/byg/util/ModMathHelper.java b/Common/src/main/java/potionstudios/byg/util/ModMathHelper.java index ad2621afbe..73d39abf09 100644 --- a/Common/src/main/java/potionstudios/byg/util/ModMathHelper.java +++ b/Common/src/main/java/potionstudios/byg/util/ModMathHelper.java @@ -62,8 +62,8 @@ public static int fromHSBtoRGB(float hue, float saturation, float brightness) } else { - float var6 = (hue - (float) Math.floor((double) hue)) * 6.0F; - float var7 = var6 - (float) Math.floor((double) var6); + float var6 = (hue - (float) Math.floor(hue)) * 6.0F; + float var7 = var6 - (float) Math.floor(var6); float var8 = brightness * (1.0F - saturation); float var9 = brightness * (1.0F - saturation * var7); float var10 = brightness * (1.0F - saturation * (1.0F - var7)); diff --git a/Fabric/src/main/java/potionstudios/byg/network/FabricNetworkHandler.java b/Fabric/src/main/java/potionstudios/byg/network/FabricNetworkHandler.java index e88beb0e23..15dd6c9518 100644 --- a/Fabric/src/main/java/potionstudios/byg/network/FabricNetworkHandler.java +++ b/Fabric/src/main/java/potionstudios/byg/network/FabricNetworkHandler.java @@ -63,9 +63,7 @@ public static void sendToAllPlayers(List players, MSG packet FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); encoder.accept(packet, buf); - players.forEach(player -> { - ServerPlayNetworking.send(player, packetId, buf); - }); + players.forEach(player -> ServerPlayNetworking.send(player, packetId, buf)); } public static class ClientProxy { diff --git a/Forge/src/data/java/potionstudios/byg/datagen/BYGDataGen.java b/Forge/src/data/java/potionstudios/byg/datagen/BYGDataGen.java index 6b5005ad4c..7f2c58b09e 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/BYGDataGen.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/BYGDataGen.java @@ -33,47 +33,9 @@ public class BYGDataGen { private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() - .add(Registries.CONFIGURED_FEATURE, pContext -> { - BYGFeaturesUtil.CONFIGURED_FEATURES_FACTORIES.forEach((biomeResourceKey, factory) -> { - pContext.register(biomeResourceKey, factory.generate(pContext)); - }); - }) - .add(Registries.PLACED_FEATURE, pContext -> { - BYGPlacedFeaturesUtil.PLACED_FEATURE_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.CONFIGURED_FEATURE))); - }); - }) - .add(Registries.BIOME, pContext -> { - BYGBiomes.BIOME_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.PLACED_FEATURE), pContext.lookup(Registries.CONFIGURED_CARVER))); - - }); - }).add(Registries.STRUCTURE, pContext -> { - BYGStructures.STRUCTURE_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }).add(Registries.STRUCTURE_SET, pContext -> { - BYGStructureSets.STRUCTURE_SET_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.STRUCTURE))); - - }); - }).add(Registries.TEMPLATE_POOL, pContext -> { - StructureTemplatePoolFactory.STRUCTURE_TEMPLATE_POOL_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }).add(Registries.WORLD_PRESET, pContext -> { - BYGWorldPresets.WORLD_PRESET_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }).add(Registries.DAMAGE_TYPE, pContext -> { - BYGDamageTypes.DAMAGE_TYPE_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }); + .add(Registries.CONFIGURED_FEATURE, pContext -> BYGFeaturesUtil.CONFIGURED_FEATURES_FACTORIES.forEach((biomeResourceKey, factory) -> pContext.register(biomeResourceKey, factory.generate(pContext)))) + .add(Registries.PLACED_FEATURE, pContext -> BYGPlacedFeaturesUtil.PLACED_FEATURE_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.CONFIGURED_FEATURE))))) + .add(Registries.BIOME, pContext -> BYGBiomes.BIOME_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.PLACED_FEATURE), pContext.lookup(Registries.CONFIGURED_CARVER))))).add(Registries.STRUCTURE, pContext -> BYGStructures.STRUCTURE_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))).add(Registries.STRUCTURE_SET, pContext -> BYGStructureSets.STRUCTURE_SET_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.STRUCTURE))))).add(Registries.TEMPLATE_POOL, pContext -> StructureTemplatePoolFactory.STRUCTURE_TEMPLATE_POOL_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))).add(Registries.WORLD_PRESET, pContext -> BYGWorldPresets.WORLD_PRESET_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))).add(Registries.DAMAGE_TYPE, pContext -> BYGDamageTypes.DAMAGE_TYPE_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))); @SubscribeEvent static void onDatagen(final GatherDataEvent event) { diff --git a/Forge/src/data/java/potionstudios/byg/datagen/BYGWorldGenerationProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/BYGWorldGenerationProvider.java index cf5376d9cc..2dd910dc3a 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/BYGWorldGenerationProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/BYGWorldGenerationProvider.java @@ -18,42 +18,9 @@ public class BYGWorldGenerationProvider { private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() - .add(Registries.CONFIGURED_FEATURE, pContext -> { - BYGFeaturesUtil.CONFIGURED_FEATURES_FACTORIES.forEach((biomeResourceKey, factory) -> { - pContext.register(biomeResourceKey, factory.generate(pContext)); - }); - }) - .add(Registries.PLACED_FEATURE, pContext -> { - BYGPlacedFeaturesUtil.PLACED_FEATURE_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.CONFIGURED_FEATURE))); - }); - }) - .add(Registries.BIOME, pContext -> { - BYGBiomes.BIOME_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.PLACED_FEATURE), pContext.lookup(Registries.CONFIGURED_CARVER))); - - }); - }).add(Registries.STRUCTURE, pContext -> { - BYGStructures.STRUCTURE_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }).add(Registries.STRUCTURE_SET, pContext -> { - BYGStructureSets.STRUCTURE_SET_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.STRUCTURE))); - - }); - }).add(Registries.TEMPLATE_POOL, pContext -> { - StructureTemplatePoolFactory.STRUCTURE_TEMPLATE_POOL_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }).add(Registries.WORLD_PRESET, pContext -> { - BYGWorldPresets.WORLD_PRESET_FACTORIES.forEach((resourceKey, factory) -> { - pContext.register(resourceKey, factory.generate(pContext)); - - }); - }); + .add(Registries.CONFIGURED_FEATURE, pContext -> BYGFeaturesUtil.CONFIGURED_FEATURES_FACTORIES.forEach((biomeResourceKey, factory) -> pContext.register(biomeResourceKey, factory.generate(pContext)))) + .add(Registries.PLACED_FEATURE, pContext -> BYGPlacedFeaturesUtil.PLACED_FEATURE_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.CONFIGURED_FEATURE))))) + .add(Registries.BIOME, pContext -> BYGBiomes.BIOME_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.PLACED_FEATURE), pContext.lookup(Registries.CONFIGURED_CARVER))))).add(Registries.STRUCTURE, pContext -> BYGStructures.STRUCTURE_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))).add(Registries.STRUCTURE_SET, pContext -> BYGStructureSets.STRUCTURE_SET_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext.lookup(Registries.STRUCTURE))))).add(Registries.TEMPLATE_POOL, pContext -> StructureTemplatePoolFactory.STRUCTURE_TEMPLATE_POOL_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))).add(Registries.WORLD_PRESET, pContext -> BYGWorldPresets.WORLD_PRESET_FACTORIES.forEach((resourceKey, factory) -> pContext.register(resourceKey, factory.generate(pContext)))); @SubscribeEvent public static void onGatherData(GatherDataEvent event) { diff --git a/Forge/src/data/java/potionstudios/byg/datagen/providers/BYGWoodAssetsProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/providers/BYGWoodAssetsProvider.java index 92b3cae527..e2a50851fd 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/providers/BYGWoodAssetsProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/providers/BYGWoodAssetsProvider.java @@ -314,9 +314,7 @@ public ItemModelBuilder item(String path) { @Override public CompletableFuture run(CachedOutput cache) { - return super.run(cache).thenRun(() -> { - item.generateAll(cache); - }); + return super.run(cache).thenRun(() -> item.generateAll(cache)); } diff --git a/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGBlockLootProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGBlockLootProvider.java index b9897d0f2f..ce0d56743c 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGBlockLootProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGBlockLootProvider.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.BYG; import potionstudios.byg.common.block.BYGWoodTypes; @@ -45,13 +46,13 @@ protected void add(@Nullable Supplier pBlock, Function pFactory) { + protected void add(@NotNull Block pBlock, @NotNull Function pFactory) { super.add(pBlock, pFactory); blocks.add(pBlock); } @Override - protected void add(Block pBlock, LootTable.Builder pBuilder) { + protected void add(@NotNull Block pBlock, LootTable.@NotNull Builder pBuilder) { super.add(pBlock, pBuilder); blocks.add(pBlock); } @@ -82,21 +83,19 @@ protected void generate() { if (type.growerItem() != null) { final var growerName = type.growerItem().getId().getPath(); final var potted = ForgeRegistries.BLOCKS.getDelegate(BYG.createLocation("potted_" + growerName)); - potted.ifPresent(blockReference -> { - add(blockReference.value(), LootTable.lootTable() - .withPool(applyExplosionCondition(type.growerItem(), LootPool.lootPool() - .setRolls(ConstantValue.exactly(1.0F)) - .add(LootItem.lootTableItem(type.growerItem())))) - .withPool(applyExplosionCondition(Items.FLOWER_POT, LootPool.lootPool() - .setRolls(ConstantValue.exactly(1.0F)) - .add(LootItem.lootTableItem(Items.FLOWER_POT))))); - }); + potted.ifPresent(blockReference -> add(blockReference.value(), LootTable.lootTable() + .withPool(applyExplosionCondition(type.growerItem(), LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .add(LootItem.lootTableItem(type.growerItem())))) + .withPool(applyExplosionCondition(Items.FLOWER_POT, LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .add(LootItem.lootTableItem(Items.FLOWER_POT)))))); } } } @Override - protected Iterable getKnownBlocks() { + protected @NotNull Iterable getKnownBlocks() { return blocks; } } diff --git a/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGEntityLootProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGEntityLootProvider.java index 3ec5dca91b..1a8cf06737 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGEntityLootProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/providers/loot/BYGEntityLootProvider.java @@ -8,6 +8,7 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import org.jetbrains.annotations.NotNull; import potionstudios.byg.common.block.BYGWoodTypes; import potionstudios.byg.common.entity.boat.BYGBoat; @@ -23,7 +24,7 @@ protected BYGEntityLootProvider(FeatureFlagSet pEnabledFeatures) { } @Override - public void generate(BiConsumer consumer) { + public void generate(@NotNull BiConsumer consumer) { for (final BYGWoodTypes type : BYGWoodTypes.values()) { if (type.boatType() == null) { continue; diff --git a/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGBiomeTagsProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGBiomeTagsProvider.java index 799b4e94d1..a226b06dd9 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGBiomeTagsProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGBiomeTagsProvider.java @@ -5,6 +5,7 @@ import net.minecraft.data.tags.BiomeTagsProvider; import net.minecraft.resources.ResourceKey; import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import potionstudios.byg.BYG; import potionstudios.byg.common.world.biome.BYGBiomes; @@ -18,7 +19,7 @@ public BYGBiomeTagsProvider(DataGenerator gen, CompletableFuture { this.tag(tag).add(ros.stream().toArray(ResourceKey[]::new)); diff --git a/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGEntityTagsProvider.java b/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGEntityTagsProvider.java index 8e920d60dd..516d248c7c 100644 --- a/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGEntityTagsProvider.java +++ b/Forge/src/data/java/potionstudios/byg/datagen/providers/tag/BYGEntityTagsProvider.java @@ -5,6 +5,7 @@ import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.EntityTypeTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import potionstudios.byg.BYG; import potionstudios.byg.common.BYGTags; @@ -19,7 +20,7 @@ public BYGEntityTagsProvider(DataGenerator pGenerator, CompletableFuture