diff --git a/build.gradle b/build.gradle index 863bfba6..4c2cbfb7 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}" - useApi "ru.bclib:bclib:0.1.1" + useApi "ru.bclib:bclib:${project.bclib_version}" useOptional "me.shedaniel:RoughlyEnoughItems:${project.rei_version}" useOptional "me.shedaniel:RoughlyEnoughItems-api:${project.rei_version}" diff --git a/gradle.properties b/gradle.properties index 8921b2dd..c9e57250 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,5 @@ patchouli_version = 50-FABRIC fabric_version = 0.32.9+1.16 canvas_version = 1.0.+ - rei_version = 5.8.10 \ No newline at end of file + rei_version = 5.8.10 + bclib_version = 0.1.2 \ No newline at end of file diff --git a/src/main/java/ru/betterend/BetterEnd.java b/src/main/java/ru/betterend/BetterEnd.java index c7abb988..35de61ba 100644 --- a/src/main/java/ru/betterend/BetterEnd.java +++ b/src/main/java/ru/betterend/BetterEnd.java @@ -29,7 +29,7 @@ import ru.betterend.registry.EndPortals; import ru.betterend.registry.EndSounds; import ru.betterend.registry.EndStructures; import ru.betterend.registry.EndTags; -import ru.betterend.util.BonemealUtil; +import ru.betterend.util.BonemealPlants; import ru.betterend.util.DataFixerUtil; import ru.betterend.util.LootTableUtil; import ru.betterend.world.generator.BetterEndBiomeSource; @@ -64,7 +64,7 @@ public class BetterEnd implements ModInitializer { InfusionRecipes.register(); EndStructures.register(); Integrations.register(); - BonemealUtil.init(); + BonemealPlants.init(); GeneratorOptions.init(); DataFixerUtil.init(); LootTableUtil.init(); diff --git a/src/main/java/ru/betterend/blocks/BulbVineSeedBlock.java b/src/main/java/ru/betterend/blocks/BulbVineSeedBlock.java index 38b5e60c..8444b7b8 100644 --- a/src/main/java/ru/betterend/blocks/BulbVineSeedBlock.java +++ b/src/main/java/ru/betterend/blocks/BulbVineSeedBlock.java @@ -7,17 +7,17 @@ import net.minecraft.tags.BlockTags; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class BulbVineSeedBlock extends EndPlantWithAgeBlock { @Override public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { BlockState up = world.getBlockState(pos.above()); - return up.is(EndTags.GEN_TERRAIN) || up.is(BlockTags.LOGS) || up.is(BlockTags.LEAVES); + return up.is(TagAPI.GEN_TERRAIN) || up.is(BlockTags.LOGS) || up.is(BlockTags.LEAVES); } @Override diff --git a/src/main/java/ru/betterend/blocks/LumecornBlock.java b/src/main/java/ru/betterend/blocks/LumecornBlock.java index f091fa8a..8d5b1b8c 100644 --- a/src/main/java/ru/betterend/blocks/LumecornBlock.java +++ b/src/main/java/ru/betterend/blocks/LumecornBlock.java @@ -22,6 +22,7 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties.LumecornShape; import ru.betterend.blocks.basis.BlockBaseNotFull; @@ -29,7 +30,6 @@ import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndItems; -import ru.betterend.registry.EndTags; public class LumecornBlock extends BlockBaseNotFull implements IRenderTypeable { public static final EnumProperty SHAPE = EnumProperty.create("shape", LumecornShape.class); @@ -62,7 +62,7 @@ public class LumecornBlock extends BlockBaseNotFull implements IRenderTypeable { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { LumecornShape shape = state.getValue(SHAPE); if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL) { - return world.getBlockState(pos.below()).is(EndTags.END_GROUND); + return world.getBlockState(pos.below()).is(TagAPI.END_GROUND); } else if (shape == LumecornShape.LIGHT_TOP) { return world.getBlockState(pos.below()).is(this); diff --git a/src/main/java/ru/betterend/blocks/NeonCactusPlantBlock.java b/src/main/java/ru/betterend/blocks/NeonCactusPlantBlock.java index d01a65be..7ee13210 100644 --- a/src/main/java/ru/betterend/blocks/NeonCactusPlantBlock.java +++ b/src/main/java/ru/betterend/blocks/NeonCactusPlantBlock.java @@ -37,6 +37,7 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties.CactusBottom; import ru.betterend.blocks.BlockProperties.TripleShape; @@ -44,7 +45,6 @@ import ru.betterend.blocks.basis.BlockBaseNotFull; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class NeonCactusPlantBlock extends BlockBaseNotFull implements SimpleWaterloggedBlock, IRenderTypeable { @@ -311,7 +311,7 @@ public class NeonCactusPlantBlock extends BlockBaseNotFull implements SimpleWate mut.move(dir); state = world.getBlockState(mut); if (!state.is(this)) { - if (!state.is(EndTags.END_GROUND)) { + if (!state.is(TagAPI.END_GROUND)) { length = -1; } break; diff --git a/src/main/java/ru/betterend/blocks/SmallJellyshroomBlock.java b/src/main/java/ru/betterend/blocks/SmallJellyshroomBlock.java index f9f6b212..20fffd86 100644 --- a/src/main/java/ru/betterend/blocks/SmallJellyshroomBlock.java +++ b/src/main/java/ru/betterend/blocks/SmallJellyshroomBlock.java @@ -29,11 +29,11 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.basis.AttachedBlock; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.registry.EndFeatures; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class SmallJellyshroomBlock extends AttachedBlock implements IRenderTypeable, BonemealableBlock { @@ -87,7 +87,7 @@ public class SmallJellyshroomBlock extends AttachedBlock implements IRenderTypea @Override public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) { - return state.getValue(FACING) == Direction.UP && world.getBlockState(pos.below()).is(EndTags.END_GROUND); + return state.getValue(FACING) == Direction.UP && world.getBlockState(pos.below()).is(TagAPI.END_GROUND); } @Override diff --git a/src/main/java/ru/betterend/blocks/basis/DoublePlantBlock.java b/src/main/java/ru/betterend/blocks/basis/DoublePlantBlock.java index a1c09b06..7b2c7948 100644 --- a/src/main/java/ru/betterend/blocks/basis/DoublePlantBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/DoublePlantBlock.java @@ -34,10 +34,10 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.BlockProperties; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class DoublePlantBlock extends BlockBaseNotFull implements IRenderTypeable, BonemealableBlock { @@ -94,7 +94,7 @@ public class DoublePlantBlock extends BlockBaseNotFull implements IRenderTypeabl } protected boolean isTerrain(BlockState state) { - return state.is(EndTags.END_GROUND); + return state.is(TagAPI.END_GROUND); } @Override diff --git a/src/main/java/ru/betterend/blocks/basis/EndPlantBlock.java b/src/main/java/ru/betterend/blocks/basis/EndPlantBlock.java index bf785d30..9a6112fc 100644 --- a/src/main/java/ru/betterend/blocks/basis/EndPlantBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/EndPlantBlock.java @@ -30,9 +30,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; -import ru.betterend.registry.EndTags; public class EndPlantBlock extends BlockBaseNotFull implements IRenderTypeable, BonemealableBlock { private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12); @@ -84,7 +84,7 @@ public class EndPlantBlock extends BlockBaseNotFull implements IRenderTypeable, } protected boolean isTerrain(BlockState state) { - return state.is(EndTags.END_GROUND); + return state.is(TagAPI.END_GROUND); } @Override diff --git a/src/main/java/ru/betterend/blocks/basis/FeatureSaplingBlock.java b/src/main/java/ru/betterend/blocks/basis/FeatureSaplingBlock.java index 5d0f663e..1e3b6060 100644 --- a/src/main/java/ru/betterend/blocks/basis/FeatureSaplingBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/FeatureSaplingBlock.java @@ -28,12 +28,12 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.client.models.BlockModelProvider; import ru.betterend.client.models.ModelsHelper; import ru.betterend.client.models.Patterns; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; -import ru.betterend.registry.EndTags; public abstract class FeatureSaplingBlock extends SaplingBlock implements IRenderTypeable, BlockModelProvider { private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12); @@ -71,7 +71,7 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende @Override public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { - return world.getBlockState(pos.below()).is(EndTags.END_GROUND); + return world.getBlockState(pos.below()).is(TagAPI.END_GROUND); } @Override diff --git a/src/main/java/ru/betterend/blocks/basis/UnderwaterPlantBlock.java b/src/main/java/ru/betterend/blocks/basis/UnderwaterPlantBlock.java index 39e94ec2..7b413f2d 100644 --- a/src/main/java/ru/betterend/blocks/basis/UnderwaterPlantBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/UnderwaterPlantBlock.java @@ -34,10 +34,10 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; public class UnderwaterPlantBlock extends BlockBaseNotFull implements IRenderTypeable, BonemealableBlock, LiquidBlockContainer { private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12); @@ -82,7 +82,7 @@ public class UnderwaterPlantBlock extends BlockBaseNotFull implements IRenderTyp } protected boolean isTerrain(BlockState state) { - return state.is(EndTags.END_GROUND) || state.getBlock() == EndBlocks.ENDSTONE_DUST; + return state.is(TagAPI.END_GROUND) || state.getBlock() == EndBlocks.ENDSTONE_DUST; } @Override diff --git a/src/main/java/ru/betterend/blocks/basis/UpDownPlantBlock.java b/src/main/java/ru/betterend/blocks/basis/UpDownPlantBlock.java index d53fbb34..6b353bba 100644 --- a/src/main/java/ru/betterend/blocks/basis/UpDownPlantBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/UpDownPlantBlock.java @@ -26,9 +26,9 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IRenderTypeable; -import ru.betterend.registry.EndTags; public class UpDownPlantBlock extends BlockBaseNotFull implements IRenderTypeable { private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12); @@ -54,7 +54,7 @@ public class UpDownPlantBlock extends BlockBaseNotFull implements IRenderTypeabl } protected boolean isTerrain(BlockState state) { - return state.is(EndTags.END_GROUND); + return state.is(TagAPI.END_GROUND); } protected boolean isSupport(BlockState state, LevelReader world, BlockPos pos) { diff --git a/src/main/java/ru/betterend/blocks/complex/StoneMaterial.java b/src/main/java/ru/betterend/blocks/complex/StoneMaterial.java index fb1caa8b..adb713eb 100644 --- a/src/main/java/ru/betterend/blocks/complex/StoneMaterial.java +++ b/src/main/java/ru/betterend/blocks/complex/StoneMaterial.java @@ -6,6 +6,7 @@ import net.minecraft.tags.ItemTags; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.MaterialColor; +import ru.bclib.api.TagAPI; import ru.bclib.util.TagHelper; import ru.betterend.blocks.EndPedestal; import ru.betterend.blocks.basis.BlockBase; @@ -21,7 +22,6 @@ import ru.betterend.recipe.CraftingRecipes; import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndItems; -import ru.betterend.registry.EndTags; public class StoneMaterial { public final Block stone; @@ -90,15 +90,15 @@ public class StoneMaterial { TagHelper.addTag(ItemTags.STONE_BRICKS, bricks); TagHelper.addTag(ItemTags.STONE_CRAFTING_MATERIALS, stone); TagHelper.addTag(ItemTags.STONE_TOOL_MATERIALS, stone); - TagHelper.addTag(EndTags.FURNACES, furnace); + TagHelper.addTag(TagAPI.FURNACES, furnace); // Block Tags // TagHelper.addTag(BlockTags.STONE_BRICKS, bricks); TagHelper.addTag(BlockTags.WALLS, wall, brick_wall); TagHelper.addTag(BlockTags.SLABS, slab, brick_slab); TagHelper.addTags(pressure_plate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES); - TagHelper.addTag(EndTags.END_STONES, stone); + TagHelper.addTag(TagAPI.END_STONES, stone); - TagHelper.addTag(EndTags.DRAGON_IMMUNE, stone, stairs, slab, wall); + TagHelper.addTag(TagAPI.DRAGON_IMMUNE, stone, stairs, slab, wall); } } \ No newline at end of file diff --git a/src/main/java/ru/betterend/blocks/complex/WoodenMaterial.java b/src/main/java/ru/betterend/blocks/complex/WoodenMaterial.java index a02c89bf..34e345a3 100644 --- a/src/main/java/ru/betterend/blocks/complex/WoodenMaterial.java +++ b/src/main/java/ru/betterend/blocks/complex/WoodenMaterial.java @@ -11,7 +11,9 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MaterialColor; +import ru.bclib.api.TagAPI; import ru.bclib.util.TagHelper; +import ru.betterend.BetterEnd; import ru.betterend.blocks.basis.BarkBlock; import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.EndBarrelBlock; @@ -34,7 +36,6 @@ import ru.betterend.blocks.basis.EndWoodenPlateBlock; import ru.betterend.blocks.basis.StrippableBarkBlock; import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; public class WoodenMaterial { public final Block log; @@ -127,7 +128,7 @@ public class WoodenMaterial { TagHelper.addTags(slab, ItemTags.WOODEN_SLABS, ItemTags.SLABS); TagHelper.addTags(stairs, ItemTags.WOODEN_STAIRS, ItemTags.STAIRS); TagHelper.addTags(trapdoor, ItemTags.WOODEN_TRAPDOORS, ItemTags.TRAPDOORS); - TagHelper.addTag(EndTags.ITEM_CHEST, chest); + TagHelper.addTag(TagAPI.ITEM_CHEST, chest); // Block Tags // TagHelper.addTag(BlockTags.PLANKS, planks); @@ -141,11 +142,11 @@ public class WoodenMaterial { TagHelper.addTags(slab, BlockTags.WOODEN_SLABS, BlockTags.SLABS); TagHelper.addTags(stairs, BlockTags.WOODEN_STAIRS, BlockTags.STAIRS); TagHelper.addTags(trapdoor, BlockTags.WOODEN_TRAPDOORS, BlockTags.TRAPDOORS); - TagHelper.addTag(EndTags.BOOKSHELVES, shelf); - TagHelper.addTag(EndTags.BLOCK_CHEST, chest); + TagHelper.addTag(TagAPI.BOOKSHELVES, shelf); + TagHelper.addTag(TagAPI.BLOCK_CHEST, chest); - logBlockTag = EndTags.makeBlockTag(name + "_logs"); - logItemTag = EndTags.makeItemTag(name + "_logs"); + logBlockTag = TagAPI.makeBlockTag(BetterEnd.MOD_ID, name + "_logs"); + logItemTag = TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_logs"); TagHelper.addTag(logBlockTag, log_stripped, bark_stripped, log, bark); TagHelper.addTag(logItemTag, log_stripped, bark_stripped, log, bark); diff --git a/src/main/java/ru/betterend/integration/byg/BYGIntegration.java b/src/main/java/ru/betterend/integration/byg/BYGIntegration.java index 760300a0..56cdbe74 100644 --- a/src/main/java/ru/betterend/integration/byg/BYGIntegration.java +++ b/src/main/java/ru/betterend/integration/byg/BYGIntegration.java @@ -7,13 +7,13 @@ import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.ai.behavior.WeightedList; import net.minecraft.world.level.biome.Biome; +import ru.bclib.api.TagAPI; import ru.bclib.util.TagHelper; import ru.betterend.integration.Integrations; import ru.betterend.integration.ModIntegration; import ru.betterend.integration.byg.biomes.BYGBiomes; import ru.betterend.integration.byg.features.BYGFeatures; import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndTags; import ru.betterend.world.biome.EndBiome; public class BYGIntegration extends ModIntegration { @@ -23,7 +23,7 @@ public class BYGIntegration extends ModIntegration { @Override public void register() { - TagHelper.addTags(Integrations.BYG.getBlock("ivis_phylium"), EndTags.END_GROUND, EndTags.GEN_TERRAIN); + TagHelper.addTags(Integrations.BYG.getBlock("ivis_phylium"), TagAPI.END_GROUND, TagAPI.GEN_TERRAIN); BYGBlocks.register(); BYGFeatures.register(); BYGBiomes.register(); diff --git a/src/main/java/ru/betterend/integration/byg/features/BigEtherTreeFeature.java b/src/main/java/ru/betterend/integration/byg/features/BigEtherTreeFeature.java index 968916c0..bf9daf26 100644 --- a/src/main/java/ru/betterend/integration/byg/features/BigEtherTreeFeature.java +++ b/src/main/java/ru/betterend/integration/byg/features/BigEtherTreeFeature.java @@ -12,17 +12,17 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.integration.Integrations; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class BigEtherTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlockState log = Integrations.BYG.getDefaultState("ether_log"); @@ -31,7 +31,7 @@ public class BigEtherTreeFeature extends DefaultFeature { return log; }; Function replace = (state) -> { - return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) + return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable(); }; @@ -62,7 +62,7 @@ public class BigEtherTreeFeature extends DefaultFeature { } sdf.setReplaceFunction((state) -> { - return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) + return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable(); }).addPostProcess((info) -> { if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) { diff --git a/src/main/java/ru/betterend/integration/byg/features/GreatNightshadeTreeFeature.java b/src/main/java/ru/betterend/integration/byg/features/GreatNightshadeTreeFeature.java index 1e098981..8049a382 100644 --- a/src/main/java/ru/betterend/integration/byg/features/GreatNightshadeTreeFeature.java +++ b/src/main/java/ru/betterend/integration/byg/features/GreatNightshadeTreeFeature.java @@ -17,6 +17,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; @@ -27,7 +28,6 @@ import ru.bclib.sdf.primitive.SDFSphere; import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.integration.Integrations; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -37,7 +37,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlockState log = Integrations.BYG.getDefaultState("nightshade_log"); @@ -50,7 +50,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature { return log; }; Function replace = (state) -> { - return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) + return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable(); }; Function post = (info) -> { diff --git a/src/main/java/ru/betterend/integration/byg/features/NightshadeRedwoodTreeFeature.java b/src/main/java/ru/betterend/integration/byg/features/NightshadeRedwoodTreeFeature.java index d48d233b..294505a8 100644 --- a/src/main/java/ru/betterend/integration/byg/features/NightshadeRedwoodTreeFeature.java +++ b/src/main/java/ru/betterend/integration/byg/features/NightshadeRedwoodTreeFeature.java @@ -17,6 +17,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; @@ -27,7 +28,6 @@ import ru.bclib.sdf.primitive.SDFSphere; import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.integration.Integrations; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -37,7 +37,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlockState log = Integrations.BYG.getDefaultState("nightshade_log"); @@ -49,7 +49,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature { return log; }; Function replace = (state) -> { - return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) + return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable(); }; Function post = (info) -> { diff --git a/src/main/java/ru/betterend/integration/byg/features/OldBulbisTreeFeature.java b/src/main/java/ru/betterend/integration/byg/features/OldBulbisTreeFeature.java index 5a2b543d..2f6ab077 100644 --- a/src/main/java/ru/betterend/integration/byg/features/OldBulbisTreeFeature.java +++ b/src/main/java/ru/betterend/integration/byg/features/OldBulbisTreeFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.AABB; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFSubtraction; @@ -26,7 +27,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.integration.Integrations; import ru.betterend.noise.OpenSimplexNoise; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class OldBulbisTreeFeature extends DefaultFeature { @@ -38,9 +38,9 @@ public class OldBulbisTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; - if (!world.getBlockState(pos.below(4)).getBlock().is(EndTags.GEN_TERRAIN)) + if (!world.getBlockState(pos.below(4)).getBlock().is(TagAPI.GEN_TERRAIN)) return false; BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem"); @@ -50,7 +50,7 @@ public class OldBulbisTreeFeature extends DefaultFeature { BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight"); Function replacement = (state) -> { - if (state.equals(stem) || state.equals(wood) || state.is(EndTags.END_GROUND) + if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) { return true; } @@ -159,7 +159,7 @@ public class OldBulbisTreeFeature extends DefaultFeature { SplineHelper.rotateSpline(branch, angle); SplineHelper.scale(branch, scale); Vector3f last = branch.get(branch.size() - 1); - if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) { SplineHelper.fillSpline(branch, world, wood, pos, replacement); } } diff --git a/src/main/java/ru/betterend/mixin/client/EnchantingTableBlockMixin.java b/src/main/java/ru/betterend/mixin/client/EnchantingTableBlockMixin.java deleted file mode 100644 index 384dc491..00000000 --- a/src/main/java/ru/betterend/mixin/client/EnchantingTableBlockMixin.java +++ /dev/null @@ -1,46 +0,0 @@ -package ru.betterend.mixin.client; - -import java.util.Random; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EnchantmentTableBlock; -import net.minecraft.world.level.block.state.BlockState; -import ru.betterend.registry.EndTags; - -@Mixin(EnchantmentTableBlock.class) -public abstract class EnchantingTableBlockMixin extends Block { - public EnchantingTableBlockMixin(Properties settings) { - super(settings); - } - - @Inject(method = "animateTick", at = @At(value = "TAIL")) - private void be_onRandomDisplayTick(BlockState state, Level world, BlockPos pos, Random random, CallbackInfo info) { - for (int px = -2; px <= 2; ++px) { - for (int pz = -2; pz <= 2; ++pz) { - if (px > -2 && px < 2 && pz == -1) { - pz = 2; - } - if (random.nextInt(16) == 0) { - for (int py = 0; py <= 1; ++py) { - BlockPos blockPos = pos.offset(px, py, pz); - if (world.getBlockState(blockPos).is(EndTags.BOOKSHELVES)) { - if (!world.isEmptyBlock(pos.offset(px / 2, 0, pz / 2))) { - break; - } - world.addParticle(ParticleTypes.ENCHANT, pos.getX() + 0.5, pos.getY() + 2.0, pos.getZ() + 0.5, px + random.nextFloat() - 0.5, py - random.nextFloat() - 1.0, pz + random.nextFloat() - 0.5); - } - } - } - } - } - - } -} diff --git a/src/main/java/ru/betterend/mixin/common/BoneMealItemMixin.java b/src/main/java/ru/betterend/mixin/common/BoneMealItemMixin.java deleted file mode 100644 index 7ca15a9c..00000000 --- a/src/main/java/ru/betterend/mixin/common/BoneMealItemMixin.java +++ /dev/null @@ -1,161 +0,0 @@ -package ru.betterend.mixin.common; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.BlockPos.MutableBlockPos; -import net.minecraft.core.Vec3i; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.BoneMealItem; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome.BiomeCategory; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; -import ru.bclib.util.MHelper; -import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; -import ru.betterend.util.BlocksHelper; -import ru.betterend.util.BonemealUtil; -import ru.betterend.world.biome.EndBiome; - -@Mixin(BoneMealItem.class) -public class BoneMealItemMixin { - private static final MutableBlockPos BE_BLOCK_POS = new MutableBlockPos(); - - @Inject(method = "useOn", at = @At("HEAD"), cancellable = true) - private void be_onUse(UseOnContext context, CallbackInfoReturnable info) { - Level world = context.getLevel(); - BlockPos blockPos = context.getClickedPos(); - if (!world.isClientSide) { - BlockPos offseted = blockPos.relative(context.getClickedFace()); - boolean endBiome = world.getBiome(offseted).getBiomeCategory() == BiomeCategory.THEEND; - - if (world.getBlockState(blockPos).is(EndTags.END_GROUND)) { - boolean consume = false; - if (world.getBlockState(blockPos).is(Blocks.END_STONE)) { - BlockState nylium = be_getNylium(world, blockPos); - if (nylium != null) { - BlocksHelper.setWithoutUpdate(world, blockPos, nylium); - consume = true; - } - } - else { - if (!world.getFluidState(offseted).isEmpty() && endBiome) { - if (world.getBlockState(offseted).getBlock().equals(Blocks.WATER)) { - consume = be_growWaterGrass(world, blockPos); - } - } - else { - consume = be_growGrass(world, blockPos); - } - } - if (consume) { - if (!context.getPlayer().isCreative()) { - context.getItemInHand().shrink(1); - } - world.levelEvent(2005, blockPos, 0); - info.setReturnValue(InteractionResult.SUCCESS); - info.cancel(); - } - } - else if (!world.getFluidState(offseted).isEmpty() && endBiome) { - if (world.getBlockState(offseted).getBlock().equals(Blocks.WATER)) { - info.setReturnValue(InteractionResult.FAIL); - info.cancel(); - } - } - } - } - - private boolean be_growGrass(Level world, BlockPos pos) { - int y1 = pos.getY() + 3; - int y2 = pos.getY() - 3; - boolean result = false; - for (int i = 0; i < 64; i++) { - int x = (int) (pos.getX() + world.random.nextGaussian() * 2); - int z = (int) (pos.getZ() + world.random.nextGaussian() * 2); - BE_BLOCK_POS.setX(x); - BE_BLOCK_POS.setZ(z); - for (int y = y1; y >= y2; y--) { - BE_BLOCK_POS.setY(y); - BlockPos down = BE_BLOCK_POS.below(); - if (world.isEmptyBlock(BE_BLOCK_POS) && !world.isEmptyBlock(down)) { - BlockState grass = be_getGrassState(world, down); - if (grass != null) { - BlocksHelper.setWithoutUpdate(world, BE_BLOCK_POS, grass); - result = true; - } - break; - } - } - } - return result; - } - - private boolean be_growWaterGrass(Level world, BlockPos pos) { - int y1 = pos.getY() + 3; - int y2 = pos.getY() - 3; - boolean result = false; - for (int i = 0; i < 64; i++) { - int x = (int) (pos.getX() + world.random.nextGaussian() * 2); - int z = (int) (pos.getZ() + world.random.nextGaussian() * 2); - BE_BLOCK_POS.setX(x); - BE_BLOCK_POS.setZ(z); - for (int y = y1; y >= y2; y--) { - BE_BLOCK_POS.setY(y); - BlockPos down = BE_BLOCK_POS.below(); - if (world.getBlockState(BE_BLOCK_POS).is(Blocks.WATER) && world.getBlockState(down).is(EndTags.END_GROUND)) { - BlockState grass = be_getWaterGrassState(world, down); - if (grass != null) { - BlocksHelper.setWithoutUpdate(world, BE_BLOCK_POS, grass); - result = true; - } - break; - } - } - } - return result; - } - - private BlockState be_getGrassState(Level world, BlockPos pos) { - BlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - block = BonemealUtil.getGrass(EndBiomes.getBiomeID(world.getBiome(pos)), block, world.getRandom()); - return block == null ? null : block.defaultBlockState(); - } - - private BlockState be_getWaterGrassState(Level world, BlockPos pos) { - EndBiome biome = EndBiomes.getFromBiome(world.getBiome(pos)); - if (world.random.nextInt(16) == 0) { - return EndBlocks.CHARNIA_RED.defaultBlockState(); - } - else if (biome == EndBiomes.FOGGY_MUSHROOMLAND || biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) { - return world.random.nextBoolean() ? EndBlocks.CHARNIA_LIGHT_BLUE.defaultBlockState() : EndBlocks.CHARNIA_LIGHT_BLUE.defaultBlockState(); - } - else if (biome == EndBiomes.AMBER_LAND) { - return world.random.nextBoolean() ? EndBlocks.CHARNIA_ORANGE.defaultBlockState() : EndBlocks.CHARNIA_RED.defaultBlockState(); - } - else if (biome == EndBiomes.CHORUS_FOREST || biome == EndBiomes.SHADOW_FOREST) { - return EndBlocks.CHARNIA_PURPLE.defaultBlockState(); - } - return null; - } - - private BlockState be_getNylium(Level world, BlockPos pos) { - Vec3i[] offsets = MHelper.getOffsets(world.getRandom()); - for (Vec3i dir : offsets) { - BlockPos p = pos.offset(dir); - BlockState state = world.getBlockState(p); - if (BlocksHelper.isEndNylium(state) && !world.getBlockState(p.above()).is(EndTags.END_GROUND)) { - return state; - } - } - return null; - } -} \ No newline at end of file diff --git a/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java index cfb4f4b3..4ebcd077 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java @@ -26,8 +26,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import ru.bclib.api.TagAPI; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.generator.GeneratorOptions; @@ -54,7 +54,7 @@ public abstract class ChorusFlowerBlockMixin extends Block { @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) private void be_randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) { - if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { BlockPos up = pos.above(); if (world.isEmptyBlock(up) && up.getY() < 256) { int i = state.getValue(ChorusFlowerBlock.AGE); @@ -102,7 +102,7 @@ public abstract class ChorusFlowerBlockMixin extends Block { @Inject(method = "placeDeadFlower", at = @At("HEAD"), cancellable = true) private void be_placeDeadFlower(Level world, BlockPos pos, CallbackInfo info) { BlockState down = world.getBlockState(pos.below()); - if (down.is(Blocks.CHORUS_PLANT) || down.is(EndTags.GEN_TERRAIN)) { + if (down.is(Blocks.CHORUS_PLANT) || down.is(TagAPI.GEN_TERRAIN)) { world.setBlock(pos, this.defaultBlockState().setValue(BlockStateProperties.AGE_5, 5), 2); world.levelEvent(1034, pos, 0); } diff --git a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java index c6f1bdcd..96de3294 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java @@ -20,8 +20,8 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import ru.bclib.api.TagAPI; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.generator.GeneratorOptions; @@ -51,7 +51,7 @@ public abstract class ChorusPlantBlockMixin extends Block { BlockPos pos = ctx.getClickedPos(); Level world = ctx.getLevel(); BlockState plant = info.getReturnValue(); - if (ctx.canPlace() && plant.is(Blocks.CHORUS_PLANT) && world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + if (ctx.canPlace() && plant.is(Blocks.CHORUS_PLANT) && world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { if (GeneratorOptions.changeChorusPlant()) { info.setReturnValue(plant.setValue(BlocksHelper.ROOTS, true).setValue(BlockStateProperties.DOWN, true)); } @@ -69,7 +69,7 @@ public abstract class ChorusPlantBlockMixin extends Block { private void be_getStateForPlacement(BlockGetter blockGetter, BlockPos blockPos, CallbackInfoReturnable info) { BlockState plant = info.getReturnValue(); if (plant.is(Blocks.CHORUS_PLANT)) { - if (blockGetter.getBlockState(blockPos.below()).is(EndTags.END_GROUND)) { + if (blockGetter.getBlockState(blockPos.below()).is(TagAPI.END_GROUND)) { if (GeneratorOptions.changeChorusPlant()) { info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true).setValue(BlocksHelper.ROOTS, true)); } @@ -100,7 +100,7 @@ public abstract class ChorusPlantBlockMixin extends Block { private void be_updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable info) { BlockState plant = info.getReturnValue(); if (plant.is(Blocks.CHORUS_PLANT)) { - if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { if (GeneratorOptions.changeChorusPlant()) { plant = plant.setValue(BlockStateProperties.DOWN, true).setValue(BlocksHelper.ROOTS, true); } diff --git a/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java b/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java index 311b79fe..3848fb27 100644 --- a/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java @@ -20,7 +20,7 @@ import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentInstance; -import ru.betterend.registry.EndTags; +import ru.bclib.api.TagAPI; @Mixin(EnchantmentMenu.class) public abstract class EnchantmentMenuMixin extends AbstractContainerMenu { @@ -68,28 +68,28 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu { for (j = -1; j <= 1; ++j) { for (int k = -1; k <= 1; ++k) { if ((j != 0 || k != 0) && world.isEmptyBlock(blockPos.offset(k, 0, j)) && world.isEmptyBlock(blockPos.offset(k, 1, j))) { - if (world.getBlockState(blockPos.offset(k * 2, 0, j * 2)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k * 2, 0, j * 2)).is(TagAPI.BOOKSHELVES)) { ++i; } - if (world.getBlockState(blockPos.offset(k * 2, 1, j * 2)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k * 2, 1, j * 2)).is(TagAPI.BOOKSHELVES)) { ++i; } if (k != 0 && j != 0) { - if (world.getBlockState(blockPos.offset(k * 2, 0, j)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k * 2, 0, j)).is(TagAPI.BOOKSHELVES)) { ++i; } - if (world.getBlockState(blockPos.offset(k * 2, 1, j)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k * 2, 1, j)).is(TagAPI.BOOKSHELVES)) { ++i; } - if (world.getBlockState(blockPos.offset(k, 0, j * 2)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k, 0, j * 2)).is(TagAPI.BOOKSHELVES)) { ++i; } - if (world.getBlockState(blockPos.offset(k, 1, j * 2)).is(EndTags.BOOKSHELVES)) { + if (world.getBlockState(blockPos.offset(k, 1, j * 2)).is(TagAPI.BOOKSHELVES)) { ++i; } } diff --git a/src/main/java/ru/betterend/recipe/CraftingRecipes.java b/src/main/java/ru/betterend/recipe/CraftingRecipes.java index 12fb9e86..3e1c24da 100644 --- a/src/main/java/ru/betterend/recipe/CraftingRecipes.java +++ b/src/main/java/ru/betterend/recipe/CraftingRecipes.java @@ -8,12 +8,12 @@ import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import ru.bclib.api.TagAPI; import ru.betterend.BetterEnd; import ru.betterend.item.GuideBookItem; import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndItems; -import ru.betterend.registry.EndTags; public class CraftingRecipes { @@ -41,7 +41,7 @@ public class CraftingRecipes { .setShape("T#T", "V V", "T#T") .addMaterial('#', Blocks.END_STONE_BRICKS) .addMaterial('T', EndBlocks.THALLASIUM.ingot) - .addMaterial('V', EndTags.FURNACES) + .addMaterial('V', TagAPI.FURNACES) .build(); registerPedestal("andesite_pedestal", EndBlocks.ANDESITE_PEDESTAL, Blocks.POLISHED_ANDESITE_SLAB, Blocks.POLISHED_ANDESITE); @@ -145,13 +145,13 @@ public class CraftingRecipes { GridRecipe.make("hopper", Blocks.HOPPER) .setShape("I I", "ICI", " I ") .addMaterial('I', Items.IRON_INGOT) - .addMaterial('C', EndTags.ITEM_CHEST) + .addMaterial('C', TagAPI.ITEM_CHEST) .build(); GridRecipe.make("shulker_box", Blocks.SHULKER_BOX) .setShape("S", "C", "S") .addMaterial('S', Items.SHULKER_SHELL) - .addMaterial('C', EndTags.ITEM_CHEST) + .addMaterial('C', TagAPI.ITEM_CHEST) .build(); GridRecipe.make("twisted_umbrella_moss_dye", Items.PURPLE_DYE).setList("#").addMaterial('#', EndBlocks.TWISTED_UMBRELLA_MOSS).build(); @@ -208,17 +208,17 @@ public class CraftingRecipes { GridRecipe.make("neon_cactus_block_slab", EndBlocks.NEON_CACTUS_BLOCK_SLAB).setShape("###").setOutputCount(6).addMaterial('#', EndBlocks.NEON_CACTUS_BLOCK).build(); GridRecipe.make("neon_cactus_block_stairs", EndBlocks.NEON_CACTUS_BLOCK_STAIRS).setShape("# ", "## ", "###").setOutputCount(4).addMaterial('#', EndBlocks.NEON_CACTUS_BLOCK).build(); - GridRecipe.make("tag_smith_table", Blocks.SMITHING_TABLE).setShape("II", "##", "##").addMaterial('#', ItemTags.PLANKS).addMaterial('I', EndTags.IRON_INGOTS).build(); - GridRecipe.make("tag_cauldron", Blocks.CAULDRON).setShape("I I", "I I", "III").addMaterial('I', EndTags.IRON_INGOTS).build(); - GridRecipe.make("tag_hopper", Blocks.HOPPER).setShape("I I", "ICI", " I ").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('C', EndTags.ITEM_CHEST).build(); - GridRecipe.make("tag_piston", Blocks.PISTON).setShape("WWW", "CIC", "CDC").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('D', Items.REDSTONE).addMaterial('C', Items.COBBLESTONE).addMaterial('W', ItemTags.PLANKS).build(); - GridRecipe.make("tag_rail", Blocks.RAIL).setShape("I I", "ISI", "I I").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('S', Items.STICK).build(); - GridRecipe.make("tag_stonecutter", Blocks.STONECUTTER).setShape(" I ", "SSS").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('S', Items.STONE).build(); + GridRecipe.make("tag_smith_table", Blocks.SMITHING_TABLE).setShape("II", "##", "##").addMaterial('#', ItemTags.PLANKS).addMaterial('I', TagAPI.IRON_INGOTS).build(); + GridRecipe.make("tag_cauldron", Blocks.CAULDRON).setShape("I I", "I I", "III").addMaterial('I', TagAPI.IRON_INGOTS).build(); + GridRecipe.make("tag_hopper", Blocks.HOPPER).setShape("I I", "ICI", " I ").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('C', TagAPI.ITEM_CHEST).build(); + GridRecipe.make("tag_piston", Blocks.PISTON).setShape("WWW", "CIC", "CDC").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('D', Items.REDSTONE).addMaterial('C', Items.COBBLESTONE).addMaterial('W', ItemTags.PLANKS).build(); + GridRecipe.make("tag_rail", Blocks.RAIL).setShape("I I", "ISI", "I I").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('S', Items.STICK).build(); + GridRecipe.make("tag_stonecutter", Blocks.STONECUTTER).setShape(" I ", "SSS").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('S', Items.STONE).build(); - GridRecipe.make("tag_bucket", Items.BUCKET).setShape("I I", " I ").addMaterial('I', EndTags.IRON_INGOTS).build(); - GridRecipe.make("tag_compass", Items.COMPASS).setShape(" I ", "IDI", " I ").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('D', Items.REDSTONE).build(); - GridRecipe.make("tag_minecart", Items.MINECART).setShape("I I", "III").addMaterial('I', EndTags.IRON_INGOTS).build(); - GridRecipe.make("tag_shield", Items.SHIELD).setShape("WIW", "WWW", " W ").addMaterial('I', EndTags.IRON_INGOTS).addMaterial('W', ItemTags.PLANKS).build(); + GridRecipe.make("tag_bucket", Items.BUCKET).setShape("I I", " I ").addMaterial('I', TagAPI.IRON_INGOTS).build(); + GridRecipe.make("tag_compass", Items.COMPASS).setShape(" I ", "IDI", " I ").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('D', Items.REDSTONE).build(); + GridRecipe.make("tag_minecart", Items.MINECART).setShape("I I", "III").addMaterial('I', TagAPI.IRON_INGOTS).build(); + GridRecipe.make("tag_shield", Items.SHIELD).setShape("WIW", "WWW", " W ").addMaterial('I', TagAPI.IRON_INGOTS).addMaterial('W', ItemTags.PLANKS).build(); GridRecipe.make("sugar_from_root", Items.SUGAR).setList("###").addMaterial('#', EndItems.AMBER_ROOT_RAW).build(); } diff --git a/src/main/java/ru/betterend/registry/EndTags.java b/src/main/java/ru/betterend/registry/EndTags.java index 6c242fab..c6f9632d 100644 --- a/src/main/java/ru/betterend/registry/EndTags.java +++ b/src/main/java/ru/betterend/registry/EndTags.java @@ -18,14 +18,13 @@ import net.minecraft.tags.TagCollection; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.TagHelper; import ru.betterend.BetterEnd; import ru.betterend.blocks.basis.EndTerrainBlock; @@ -40,18 +39,11 @@ public class EndTags { // https://fabricmc.net/wiki/tutorial:tags // Block Tags - public static final Tag.Named BOOKSHELVES = makeCommonBlockTag("bookshelves"); - public static final Tag.Named GEN_TERRAIN = makeBlockTag("gen_terrain"); - public static final Tag.Named END_GROUND = makeBlockTag("end_ground"); public static final Tag.Named PEDESTALS = makeBlockTag("pedestal"); - public static final Tag.Named BLOCK_CHEST = makeCommonBlockTag("chest"); public static final Tag.Named END_STONES = makeCommonBlockTag("end_stones"); public static final Tag.Named DRAGON_IMMUNE = getMCBlockTag("dragon_immune"); // Item Tags - public static final Tag.Named ITEM_CHEST = makeCommonItemTag("chest"); - public static final Tag.Named IRON_INGOTS = makeCommonItemTag("iron_ingots"); - public static final Tag.Named FURNACES = makeCommonItemTag("furnaces"); public final static Tag.Named HAMMERS = makeFabricItemTag("hammers"); public static Tag.Named makeTag(Supplier> containerSupplier, ResourceLocation id) { @@ -86,15 +78,14 @@ public class EndTags { } public static void register() { - addSurfaceBlock(Blocks.END_STONE); - addSurfaceBlock(EndBlocks.THALLASIUM.ore); - addSurfaceBlock(EndBlocks.ENDSTONE_DUST); - addSurfaceBlock(EndBlocks.AMBER_ORE); + TagAPI.addEndGround(EndBlocks.THALLASIUM.ore); + TagAPI.addEndGround(EndBlocks.ENDSTONE_DUST); + TagAPI.addEndGround(EndBlocks.AMBER_ORE); EndItems.getModBlocks().forEach(blockItem -> { Block block = ((BlockItem) blockItem).getBlock(); if (block instanceof EndTerrainBlock) { - addSurfaceBlock(block); + TagAPI.addEndGround(block); TagHelper.addTag(BlockTags.NYLIUM, block); } else if (block instanceof LeavesBlock || block instanceof SimpleLeavesBlock) { @@ -130,7 +121,7 @@ public class EndTags { ToolManagerImpl.tag(HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(hammers)); TagHelper.addTag( - GEN_TERRAIN, + TagAPI.GEN_TERRAIN, EndBlocks.ENDER_ORE, EndBlocks.FLAVOLITE.stone, EndBlocks.VIOLECITE.stone, @@ -140,23 +131,17 @@ public class EndTags { EndBlocks.AZURE_JADESTONE.stone, EndBlocks.SANDY_JADESTONE.stone ); - TagHelper.addTag(END_GROUND, EndBlocks.SULPHURIC_ROCK.stone, EndBlocks.BRIMSTONE); - - TagHelper.addTag(FURNACES, Blocks.FURNACE); + TagHelper.addTag(TagAPI.END_GROUND, EndBlocks.SULPHURIC_ROCK.stone, EndBlocks.BRIMSTONE); TagHelper.addTag(BlockTags.ANVIL, EndBlocks.AETERNIUM_ANVIL); - TagHelper.addTag(BlockTags.BEACON_BASE_BLOCKS, EndBlocks.AETERNIUM_BLOCK); TagHelper.addTag(ItemTags.BEACON_PAYMENT_ITEMS, EndItems.AETERNIUM_INGOT); - - TagHelper.addTag(EndTags.DRAGON_IMMUNE, EndBlocks.ENDER_ORE, EndBlocks.ETERNAL_PEDESTAL, EndBlocks.FLAVOLITE_RUNED_ETERNAL, EndBlocks.FLAVOLITE_RUNED); - - TagHelper.addTag(EndTags.IRON_INGOTS, Items.IRON_INGOT); - TagHelper.addTag(EndTags.IRON_INGOTS, EndBlocks.THALLASIUM.ingot); - } - - public static void addSurfaceBlock(Block block) { - TagHelper.addTag(END_GROUND, block); - TagHelper.addTag(GEN_TERRAIN, block); + TagHelper.addTag(EndTags.DRAGON_IMMUNE, + EndBlocks.ENDER_ORE, + EndBlocks.ETERNAL_PEDESTAL, + EndBlocks.FLAVOLITE_RUNED_ETERNAL, + EndBlocks.FLAVOLITE_RUNED + ); + TagHelper.addTag(TagAPI.IRON_INGOTS, EndBlocks.THALLASIUM.ingot); } public static void addTerrainTags(Registry biomeRegistry) { @@ -165,10 +150,10 @@ public class EndTags { SurfaceBuilderConfiguration config = biome.getGenerationSettings().getSurfaceBuilderConfig(); Block under = config.getUnderMaterial().getBlock(); Block surface = config.getTopMaterial().getBlock(); - TagHelper.addTag(GEN_TERRAIN, under, surface); - TagHelper.addTag(END_GROUND, surface); + TagHelper.addTag(TagAPI.GEN_TERRAIN, under, surface); + TagHelper.addTag(TagAPI.END_GROUND, surface); } }); - END_STONES.getValues().forEach(EndTags::addSurfaceBlock); + END_STONES.getValues().forEach(TagAPI::addEndGround); } } diff --git a/src/main/java/ru/betterend/util/BlocksHelper.java b/src/main/java/ru/betterend/util/BlocksHelper.java index 62b5eeaa..562522b2 100644 --- a/src/main/java/ru/betterend/util/BlocksHelper.java +++ b/src/main/java/ru/betterend/util/BlocksHelper.java @@ -23,13 +23,13 @@ import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.Property; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.BlueVineBlock; import ru.betterend.blocks.basis.DoublePlantBlock; import ru.betterend.blocks.basis.FurBlock; import ru.betterend.blocks.basis.StalactiteBlock; import ru.betterend.blocks.basis.VineBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; public class BlocksHelper { public static final BooleanProperty ROOTS = BooleanProperty.create("roots"); @@ -346,7 +346,7 @@ public class BlocksHelper { } public static boolean isEndNylium(Block block) { - return block.is(BlockTags.NYLIUM) && block.is(EndTags.END_GROUND); + return block.is(BlockTags.NYLIUM) && block.is(TagAPI.END_GROUND); } public static boolean isEndNylium(BlockState state) { diff --git a/src/main/java/ru/betterend/util/BonemealPlants.java b/src/main/java/ru/betterend/util/BonemealPlants.java new file mode 100644 index 00000000..4caf39c3 --- /dev/null +++ b/src/main/java/ru/betterend/util/BonemealPlants.java @@ -0,0 +1,55 @@ +package ru.betterend.util; + +import ru.bclib.api.BonemealAPI; +import ru.betterend.registry.EndBlocks; + +public class BonemealPlants { + public static void init() { + BonemealAPI.addLandGrass(EndBlocks.END_MOSS, EndBlocks.CREEPING_MOSS); + BonemealAPI.addLandGrass(EndBlocks.END_MOSS, EndBlocks.UMBRELLA_MOSS); + BonemealAPI.addLandGrass(EndBlocks.END_MYCELIUM, EndBlocks.CREEPING_MOSS); + BonemealAPI.addLandGrass(EndBlocks.END_MYCELIUM, EndBlocks.UMBRELLA_MOSS); + + BonemealAPI.addLandGrass(EndBlocks.CAVE_MOSS, EndBlocks.CAVE_GRASS); + BonemealAPI.addLandGrass(EndBlocks.CHORUS_NYLIUM, EndBlocks.CHORUS_GRASS); + BonemealAPI.addLandGrass(EndBlocks.CRYSTAL_MOSS, EndBlocks.CRYSTAL_GRASS); + BonemealAPI.addLandGrass(EndBlocks.SHADOW_GRASS, EndBlocks.SHADOW_PLANT); + BonemealAPI.addLandGrass(EndBlocks.PINK_MOSS, EndBlocks.BUSHY_GRASS); + BonemealAPI.addLandGrass(EndBlocks.AMBER_MOSS, EndBlocks.AMBER_GRASS); + + BonemealAPI.addLandGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.JUNGLE_GRASS); + BonemealAPI.addLandGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS); + BonemealAPI.addLandGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.SMALL_JELLYSHROOM, 0.1F); + + // Wait for Lib changes + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.BLOOMING_COOKSONIA); + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.VAIOLUSH_FERN); + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.FRACTURN); + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.SALTEAGO); + + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.CREEPING_MOSS, 0.1F); + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.UMBRELLA_MOSS, 0.1F); + //BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS, 0.1F); + + BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.ORANGO); + BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F); + BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.LUTEBUS, 0.2F); + BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM); + + //BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F); + //BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM); + //BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.BOLUX_MUSHROOM, 0.05F); + + BonemealAPI.addLandGrass(EndBlocks.SANGNUM, EndBlocks.GLOBULAGUS); + BonemealAPI.addLandGrass(EndBlocks.SANGNUM, EndBlocks.CLAWFERN); + BonemealAPI.addLandGrass(EndBlocks.SANGNUM, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); + + BonemealAPI.addLandGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.GLOBULAGUS); + BonemealAPI.addLandGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.CLAWFERN); + BonemealAPI.addLandGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); + + BonemealAPI.addLandGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.GLOBULAGUS); + BonemealAPI.addLandGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.CLAWFERN); + BonemealAPI.addLandGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); + } +} diff --git a/src/main/java/ru/betterend/util/BonemealUtil.java b/src/main/java/ru/betterend/util/BonemealUtil.java deleted file mode 100644 index 2229d089..00000000 --- a/src/main/java/ru/betterend/util/BonemealUtil.java +++ /dev/null @@ -1,152 +0,0 @@ -package ru.betterend.util; - -import java.util.List; -import java.util.Map; -import java.util.Random; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; -import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndBlocks; -import ru.betterend.world.biome.EndBiome; - -public class BonemealUtil { - private static final Map> GRASS_BIOMES = Maps.newHashMap(); - private static final Map GRASS_TYPES = Maps.newHashMap(); - - public static void init() { - addBonemealGrass(EndBlocks.END_MOSS, EndBlocks.CREEPING_MOSS); - addBonemealGrass(EndBlocks.END_MOSS, EndBlocks.UMBRELLA_MOSS); - addBonemealGrass(EndBlocks.END_MYCELIUM, EndBlocks.CREEPING_MOSS); - addBonemealGrass(EndBlocks.END_MYCELIUM, EndBlocks.UMBRELLA_MOSS); - - addBonemealGrass(EndBlocks.CAVE_MOSS, EndBlocks.CAVE_GRASS); - addBonemealGrass(EndBlocks.CHORUS_NYLIUM, EndBlocks.CHORUS_GRASS); - addBonemealGrass(EndBlocks.CRYSTAL_MOSS, EndBlocks.CRYSTAL_GRASS); - addBonemealGrass(EndBlocks.SHADOW_GRASS, EndBlocks.SHADOW_PLANT); - addBonemealGrass(EndBlocks.PINK_MOSS, EndBlocks.BUSHY_GRASS); - addBonemealGrass(EndBlocks.AMBER_MOSS, EndBlocks.AMBER_GRASS); - - addBonemealGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.JUNGLE_GRASS); - addBonemealGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS); - addBonemealGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.SMALL_JELLYSHROOM, 0.1F); - - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.BLOOMING_COOKSONIA); - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.VAIOLUSH_FERN); - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.FRACTURN); - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.SALTEAGO); - - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.CREEPING_MOSS, 0.1F); - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.UMBRELLA_MOSS, 0.1F); - addBonemealGrass(EndBiomes.GLOWING_GRASSLANDS, EndBlocks.END_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS, 0.1F); - - addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.ORANGO); - addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F); - addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.LUTEBUS, 0.2F); - addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM); - - addBonemealGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F); - addBonemealGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM); - addBonemealGrass(EndBiomes.LANTERN_WOODS, EndBlocks.RUTISCUS, EndBlocks.BOLUX_MUSHROOM, 0.05F); - - addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.GLOBULAGUS); - addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.CLAWFERN); - addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); - - addBonemealGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.GLOBULAGUS); - addBonemealGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.CLAWFERN); - addBonemealGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); - - addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.GLOBULAGUS); - addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.CLAWFERN); - addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F); - } - - public static void addBonemealGrass(Block terrain, Block plant) { - addBonemealGrass(terrain, plant, 1F); - } - - public static void addBonemealGrass(Block terrain, Block plant, float chance) { - GrassList list = GRASS_TYPES.get(terrain); - if (list == null) { - list = new GrassList(); - GRASS_TYPES.put(terrain, list); - } - list.addGrass(plant, chance); - } - - public static void addBonemealGrass(EndBiome biome, Block terrain, Block plant) { - addBonemealGrass(biome, terrain, plant, 1F); - } - - public static void addBonemealGrass(EndBiome biome, Block terrain, Block plant, float chance) { - Map map = GRASS_BIOMES.get(biome.getID()); - if (map == null) { - map = Maps.newHashMap(); - GRASS_BIOMES.put(biome.getID(), map); - } - GrassList list = map.get(terrain); - if (list == null) { - list = new GrassList(); - map.put(terrain, list); - } - list.addGrass(plant, chance); - } - - public static Block getGrass(ResourceLocation biomeID, Block terrain, Random random) { - Map map = GRASS_BIOMES.get(biomeID); - GrassList list = null; - if (map != null) { - list = map.get(terrain); - if (list == null) { - list = GRASS_TYPES.get(terrain); - } - } - else { - list = GRASS_TYPES.get(terrain); - } - return list == null ? null : list.getGrass(random); - } - - private static final class GrassInfo { - final Block grass; - float chance; - - public GrassInfo(Block grass, float chance) { - this.grass = grass; - this.chance = chance; - } - - public float addChance(float chance) { - this.chance += chance; - return this.chance; - } - } - - private static final class GrassList { - final List list = Lists.newArrayList(); - float maxChance = 0; - - public void addGrass(Block grass, float chance) { - GrassInfo info = new GrassInfo(grass, chance); - maxChance = info.addChance(maxChance); - list.add(info); - } - - public Block getGrass(Random random) { - if (maxChance == 0 || list.isEmpty()) { - return null; - } - float chance = random.nextFloat() * maxChance; - for (GrassInfo info: list) { - if (chance <= info.chance) { - return info.grass; - } - } - return null; - } - } -} diff --git a/src/main/java/ru/betterend/world/features/CavePumpkinFeature.java b/src/main/java/ru/betterend/world/features/CavePumpkinFeature.java index 05d4788a..b465a248 100644 --- a/src/main/java/ru/betterend/world/features/CavePumpkinFeature.java +++ b/src/main/java/ru/betterend/world/features/CavePumpkinFeature.java @@ -6,16 +6,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.BlockProperties; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class CavePumpkinFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.above()).is(EndTags.GEN_TERRAIN) || !world.isEmptyBlock(pos) + if (!world.getBlockState(pos.above()).is(TagAPI.GEN_TERRAIN) || !world.isEmptyBlock(pos) || !world.isEmptyBlock(pos.below())) { return false; } diff --git a/src/main/java/ru/betterend/world/features/CrashedShipFeature.java b/src/main/java/ru/betterend/world/features/CrashedShipFeature.java index 97aaa1d0..7e61006a 100644 --- a/src/main/java/ru/betterend/world/features/CrashedShipFeature.java +++ b/src/main/java/ru/betterend/world/features/CrashedShipFeature.java @@ -20,9 +20,9 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProc import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.bclib.util.StructureHelper; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class CrashedShipFeature extends NBTStructureFeature { @@ -48,7 +48,7 @@ public class CrashedShipFeature extends NBTStructureFeature { if (x * x + z * z < 3600) { return false; } - return pos.getY() > 5 && world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN); + return pos.getY() > 5 && world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN); } @Override diff --git a/src/main/java/ru/betterend/world/features/ListFeature.java b/src/main/java/ru/betterend/world/features/ListFeature.java index 34ed408c..833a049e 100644 --- a/src/main/java/ru/betterend/world/features/ListFeature.java +++ b/src/main/java/ru/betterend/world/features/ListFeature.java @@ -9,8 +9,8 @@ import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import ru.bclib.api.TagAPI; import ru.bclib.util.StructureHelper; -import ru.betterend.registry.EndTags; public class ListFeature extends NBTStructureFeature { private final List list; @@ -30,7 +30,7 @@ public class ListFeature extends NBTStructureFeature { protected boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random) { int cx = pos.getX() >> 4; int cz = pos.getZ() >> 4; - return ((cx + cz) & 1) == 0 && pos.getY() > 58 && world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN); + return ((cx + cz) & 1) == 0 && pos.getY() > 58 && world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN); } @Override diff --git a/src/main/java/ru/betterend/world/features/NBTStructureFeature.java b/src/main/java/ru/betterend/world/features/NBTStructureFeature.java index 8ca4639c..e0ced9fd 100644 --- a/src/main/java/ru/betterend/world/features/NBTStructureFeature.java +++ b/src/main/java/ru/betterend/world/features/NBTStructureFeature.java @@ -22,8 +22,8 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderConfiguration; +import ru.bclib.api.TagAPI; import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.processors.DestructionStructureProcessor; @@ -125,11 +125,11 @@ public abstract class NBTStructureFeature extends DefaultFeature { mut.setZ(z); mut.setY(surfMax); BlockState state = world.getBlockState(mut); - if (!state.is(EndTags.GEN_TERRAIN) && state.isFaceSturdy(world, mut, Direction.DOWN)) { + if (!state.is(TagAPI.GEN_TERRAIN) && state.isFaceSturdy(world, mut, Direction.DOWN)) { for (int i = 0; i < 10; i++) { mut.setY(mut.getY() - 1); BlockState stateSt = world.getBlockState(mut); - if (!stateSt.is(EndTags.GEN_TERRAIN)) { + if (!stateSt.is(TagAPI.GEN_TERRAIN)) { if (merge == TerrainMerge.SURFACE) { SurfaceBuilderConfiguration config = world.getBiome(mut).getGenerationSettings() .getSurfaceBuilderConfig(); @@ -140,7 +140,7 @@ public abstract class NBTStructureFeature extends DefaultFeature { BlocksHelper.setWithoutUpdate(world, mut, state); } } else { - if (stateSt.is(EndTags.END_GROUND) && state.getMaterial().isSolidBlocking()) { + if (stateSt.is(TagAPI.END_GROUND) && state.getMaterial().isSolidBlocking()) { if (merge == TerrainMerge.SURFACE) { SurfaceBuilderConfiguration config = world.getBiome(mut).getGenerationSettings() .getSurfaceBuilderConfig(); diff --git a/src/main/java/ru/betterend/world/features/ScatterFeature.java b/src/main/java/ru/betterend/world/features/ScatterFeature.java index 99b2b502..e0482253 100644 --- a/src/main/java/ru/betterend/world/features/ScatterFeature.java +++ b/src/main/java/ru/betterend/world/features/ScatterFeature.java @@ -7,8 +7,8 @@ import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public abstract class ScatterFeature extends DefaultFeature { @@ -31,7 +31,7 @@ public abstract class ScatterFeature extends DefaultFeature { protected boolean canSpawn(WorldGenLevel world, BlockPos pos) { if (pos.getY() < 5) { return false; - } else if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + } else if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { return false; } return true; diff --git a/src/main/java/ru/betterend/world/features/bushes/BushFeature.java b/src/main/java/ru/betterend/world/features/bushes/BushFeature.java index d16626e7..5388430a 100644 --- a/src/main/java/ru/betterend/world/features/bushes/BushFeature.java +++ b/src/main/java/ru/betterend/world/features/bushes/BushFeature.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale3D; @@ -20,7 +21,6 @@ import ru.bclib.sdf.operator.SDFTranslate; import ru.bclib.sdf.primitive.SDFSphere; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -37,8 +37,8 @@ public class BushFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND) - && !world.getBlockState(pos.above()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND) + && !world.getBlockState(pos.above()).getBlock().is(TagAPI.END_GROUND)) return false; float radius = MHelper.randRange(1.8F, 3.5F, random); diff --git a/src/main/java/ru/betterend/world/features/bushes/BushWithOuterFeature.java b/src/main/java/ru/betterend/world/features/bushes/BushWithOuterFeature.java index a0e0fab5..cb72aeb4 100644 --- a/src/main/java/ru/betterend/world/features/bushes/BushWithOuterFeature.java +++ b/src/main/java/ru/betterend/world/features/bushes/BushWithOuterFeature.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale3D; @@ -21,7 +22,6 @@ import ru.bclib.sdf.operator.SDFTranslate; import ru.bclib.sdf.primitive.SDFSphere; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -41,8 +41,8 @@ public class BushWithOuterFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND) - && !world.getBlockState(pos.above()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND) + && !world.getBlockState(pos.above()).getBlock().is(TagAPI.END_GROUND)) return false; float radius = MHelper.randRange(1.8F, 3.5F, random); diff --git a/src/main/java/ru/betterend/world/features/bushes/LargeAmaranitaFeature.java b/src/main/java/ru/betterend/world/features/bushes/LargeAmaranitaFeature.java index 85c70726..5ec7f94d 100644 --- a/src/main/java/ru/betterend/world/features/bushes/LargeAmaranitaFeature.java +++ b/src/main/java/ru/betterend/world/features/bushes/LargeAmaranitaFeature.java @@ -9,11 +9,11 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -21,7 +21,7 @@ public class LargeAmaranitaFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; MutableBlockPos mut = new MutableBlockPos().set(pos); diff --git a/src/main/java/ru/betterend/world/features/bushes/Lumecorn.java b/src/main/java/ru/betterend/world/features/bushes/Lumecorn.java index 7c09c47e..b8d73c2e 100644 --- a/src/main/java/ru/betterend/world/features/bushes/Lumecorn.java +++ b/src/main/java/ru/betterend/world/features/bushes/Lumecorn.java @@ -9,11 +9,11 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties.LumecornShape; import ru.betterend.blocks.LumecornBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -21,7 +21,7 @@ public class Lumecorn extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; int height = MHelper.randRange(4, 7, random); diff --git a/src/main/java/ru/betterend/world/features/bushes/TenaneaBushFeature.java b/src/main/java/ru/betterend/world/features/bushes/TenaneaBushFeature.java index 1d00db6e..61dbfdae 100644 --- a/src/main/java/ru/betterend/world/features/bushes/TenaneaBushFeature.java +++ b/src/main/java/ru/betterend/world/features/bushes/TenaneaBushFeature.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale3D; @@ -27,7 +28,6 @@ import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.basis.FurBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -41,7 +41,7 @@ public class TenaneaBushFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; float radius = MHelper.randRange(1.8F, 3.5F, random); diff --git a/src/main/java/ru/betterend/world/features/terrain/BigAuroraCrystalFeature.java b/src/main/java/ru/betterend/world/features/terrain/BigAuroraCrystalFeature.java index 760ea87e..6d66b1a4 100644 --- a/src/main/java/ru/betterend/world/features/terrain/BigAuroraCrystalFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/BigAuroraCrystalFeature.java @@ -9,12 +9,12 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFRotation; import ru.bclib.sdf.primitive.SDFHexPrism; import ru.bclib.util.MHelper; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -38,7 +38,7 @@ public class BigAuroraCrystalFeature extends DefaultFeature { Vector3f vec = MHelper.randomHorizontal(random); prism = new SDFRotation().setRotation(vec, random.nextFloat()).setSource(prism); prism.setReplaceFunction((bState) -> { - return bState.getMaterial().isReplaceable() || bState.is(EndTags.GEN_TERRAIN) + return bState.getMaterial().isReplaceable() || bState.is(TagAPI.GEN_TERRAIN) || bState.getMaterial().equals(Material.PLANT) || bState.getMaterial().equals(Material.LEAVES); }); prism.fillRecursive(world, pos); diff --git a/src/main/java/ru/betterend/world/features/terrain/DesertLakeFeature.java b/src/main/java/ru/betterend/world/features/terrain/DesertLakeFeature.java index 4dda99ad..5fddd8c7 100644 --- a/src/main/java/ru/betterend/world/features/terrain/DesertLakeFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/DesertLakeFeature.java @@ -11,10 +11,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -110,11 +110,11 @@ public class DesertLakeFeature extends DefaultFeature { r *= r; if (x2 + z2 <= r) { state = world.getBlockState(POS); - if (state.is(EndTags.GEN_TERRAIN)) { + if (state.is(TagAPI.GEN_TERRAIN)) { BlocksHelper.setWithoutUpdate(world, POS, AIR); } pos = POS.below(); - if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) { state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial(); if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state); @@ -162,7 +162,7 @@ public class DesertLakeFeature extends DefaultFeature { BlocksHelper.setWithoutUpdate(world, POS, state); } pos = POS.below(); - if (world.getBlockState(pos).getBlock().is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) { BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState()); } pos = POS.above(); @@ -174,7 +174,7 @@ public class DesertLakeFeature extends DefaultFeature { // Make border else if (y2 + x2 + z2 <= rb) { state = world.getBlockState(POS); - if (state.is(EndTags.GEN_TERRAIN) && world.isEmptyBlock(POS.above())) { + if (state.is(TagAPI.GEN_TERRAIN) && world.isEmptyBlock(POS.above())) { BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.END_MOSS); } else if (y < waterLevel) { @@ -201,7 +201,7 @@ public class DesertLakeFeature extends DefaultFeature { private boolean canReplace(BlockState state) { return state.getMaterial().isReplaceable() - || state.is(EndTags.GEN_TERRAIN) + || state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.ENDSTONE_DUST) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.WATER_PLANT) diff --git a/src/main/java/ru/betterend/world/features/terrain/EndLakeFeature.java b/src/main/java/ru/betterend/world/features/terrain/EndLakeFeature.java index 443ef636..f5fa6bf8 100644 --- a/src/main/java/ru/betterend/world/features/terrain/EndLakeFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/EndLakeFeature.java @@ -11,10 +11,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -110,11 +110,11 @@ public class EndLakeFeature extends DefaultFeature { r *= r; if (x2 + z2 <= r) { state = world.getBlockState(POS); - if (state.is(EndTags.GEN_TERRAIN)) { + if (state.is(TagAPI.GEN_TERRAIN)) { BlocksHelper.setWithoutUpdate(world, POS, AIR); } pos = POS.below(); - if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) { state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial(); if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state); @@ -162,7 +162,7 @@ public class EndLakeFeature extends DefaultFeature { BlocksHelper.setWithoutUpdate(world, POS, state); } pos = POS.below(); - if (world.getBlockState(pos).getBlock().is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) { BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState()); } pos = POS.above(); @@ -195,7 +195,7 @@ public class EndLakeFeature extends DefaultFeature { private boolean canReplace(BlockState state) { return state.getMaterial().isReplaceable() - || state.is(EndTags.GEN_TERRAIN) + || state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.ENDSTONE_DUST) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.WATER_PLANT) diff --git a/src/main/java/ru/betterend/world/features/terrain/FallenPillarFeature.java b/src/main/java/ru/betterend/world/features/terrain/FallenPillarFeature.java index 501dbe52..05bb8aeb 100644 --- a/src/main/java/ru/betterend/world/features/terrain/FallenPillarFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/FallenPillarFeature.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFRotation; @@ -19,16 +20,14 @@ import ru.bclib.sdf.primitive.SDFCappedCone; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class FallenPillarFeature extends DefaultFeature { @Override - public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, - NoneFeatureConfiguration config) { + public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16))); - if (!world.getBlockState(pos.below(5)).is(EndTags.GEN_TERRAIN)) { + if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) { return false; } @@ -52,7 +51,7 @@ public class FallenPillarFeature extends DefaultFeature { } return info.getState(); }).setReplaceFunction((state) -> { - return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN) + return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT); }).fillRecursive(world, pos); diff --git a/src/main/java/ru/betterend/world/features/terrain/GeyserFeature.java b/src/main/java/ru/betterend/world/features/terrain/GeyserFeature.java index 948a2b57..12e82c4f 100644 --- a/src/main/java/ru/betterend/world/features/terrain/GeyserFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/GeyserFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFCoordModify; import ru.bclib.sdf.operator.SDFDisplacement; @@ -35,7 +36,6 @@ import ru.betterend.blocks.HydrothermalVentBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndFeatures; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -57,7 +57,7 @@ public class GeyserFeature extends DefaultFeature { MutableBlockPos bpos = new MutableBlockPos().set(pos); bpos.setY(bpos.getY() - 1); BlockState state = world.getBlockState(bpos); - while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { + while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { bpos.setY(bpos.getY() - 1); state = world.getBlockState(bpos); } @@ -182,7 +182,7 @@ public class GeyserFeature extends DefaultFeature { mut.setY(mut.getY() - 1); state = world.getBlockState(mut); } - if (state.is(EndTags.GEN_TERRAIN) + if (state.is(TagAPI.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) { for (int j = 0; j <= dist; j++) { BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); @@ -221,7 +221,7 @@ public class GeyserFeature extends DefaultFeature { mut.setY(mut.getY() - 1); state = world.getBlockState(mut); } - if (state.is(EndTags.GEN_TERRAIN)) { + if (state.is(TagAPI.GEN_TERRAIN)) { for (int j = 0; j <= dist; j++) { BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); mut.setY(mut.getY() + 1); @@ -252,12 +252,11 @@ public class GeyserFeature extends DefaultFeature { static { REPLACE1 = (state) -> { - return state.isAir() || (state.is(EndTags.GEN_TERRAIN)); + return state.isAir() || (state.is(TagAPI.GEN_TERRAIN)); }; REPLACE2 = (state) -> { - if (state.is(EndTags.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT) - || state.is(EndBlocks.SULPHUR_CRYSTAL)) { + if (state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT) || state.is(EndBlocks.SULPHUR_CRYSTAL)) { return true; } if (state.getMaterial().equals(Material.PLANT)) { @@ -267,8 +266,7 @@ public class GeyserFeature extends DefaultFeature { }; IGNORE = (state) -> { - return state.is(Blocks.WATER) || state.is(Blocks.CAVE_AIR) || state.is(EndBlocks.SULPHURIC_ROCK.stone) - || state.is(EndBlocks.BRIMSTONE); + return state.is(Blocks.WATER) || state.is(Blocks.CAVE_AIR) || state.is(EndBlocks.SULPHURIC_ROCK.stone) || state.is(EndBlocks.BRIMSTONE); }; } } diff --git a/src/main/java/ru/betterend/world/features/terrain/ObsidianBoulderFeature.java b/src/main/java/ru/betterend/world/features/terrain/ObsidianBoulderFeature.java index 352cc659..f88f2408 100644 --- a/src/main/java/ru/betterend/world/features/terrain/ObsidianBoulderFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/ObsidianBoulderFeature.java @@ -9,6 +9,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale3D; @@ -16,7 +17,6 @@ import ru.bclib.sdf.primitive.SDFSphere; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class ObsidianBoulderFeature extends DefaultFeature { @@ -25,7 +25,7 @@ public class ObsidianBoulderFeature extends DefaultFeature { NoneFeatureConfiguration config) { pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16))); - if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { return false; } @@ -40,7 +40,7 @@ public class ObsidianBoulderFeature extends DefaultFeature { } private void makeBoulder(WorldGenLevel world, BlockPos pos, Random random) { - if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { + if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) { return; } @@ -62,7 +62,7 @@ public class ObsidianBoulderFeature extends DefaultFeature { } return info.getState(); }).setReplaceFunction((state) -> { - return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN) + return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT); }).fillRecursive(world, pos); } diff --git a/src/main/java/ru/betterend/world/features/terrain/ObsidianPillarBasementFeature.java b/src/main/java/ru/betterend/world/features/terrain/ObsidianPillarBasementFeature.java index c7f55638..3990f60c 100644 --- a/src/main/java/ru/betterend/world/features/terrain/ObsidianPillarBasementFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/ObsidianPillarBasementFeature.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFRotation; @@ -21,14 +22,13 @@ import ru.bclib.sdf.primitive.SDFFlatland; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class ObsidianPillarBasementFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16))); - if (!world.getBlockState(pos.below(5)).is(EndTags.GEN_TERRAIN)) { + if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) { return false; } @@ -56,7 +56,7 @@ public class ObsidianPillarBasementFeature extends DefaultFeature { } return info.getState(); }).setReplaceFunction((state) -> { - return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT); + return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT); }).fillRecursive(world, pos); return true; diff --git a/src/main/java/ru/betterend/world/features/terrain/SingleBlockFeature.java b/src/main/java/ru/betterend/world/features/terrain/SingleBlockFeature.java index d35ce510..b28adb55 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SingleBlockFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SingleBlockFeature.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import ru.betterend.registry.EndTags; +import ru.bclib.api.TagAPI; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -21,9 +21,8 @@ public class SingleBlockFeature extends DefaultFeature { } @Override - public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, - NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN)) { + public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { + if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) { return false; } diff --git a/src/main/java/ru/betterend/world/features/terrain/SmaragdantCrystalFeature.java b/src/main/java/ru/betterend/world/features/terrain/SmaragdantCrystalFeature.java index 97384bca..e2b5e145 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SmaragdantCrystalFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SmaragdantCrystalFeature.java @@ -9,9 +9,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -19,7 +19,7 @@ public class SmaragdantCrystalFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN)) { + if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) { return false; } @@ -38,7 +38,7 @@ public class SmaragdantCrystalFeature extends DefaultFeature { mut.setY(mut.getY() - 1); state = world.getBlockState(mut); } - if (state.is(EndTags.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(crystal.getBlock())) { + if (state.is(TagAPI.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(crystal.getBlock())) { for (int j = 0; j <= dist; j++) { BlocksHelper.setWithoutUpdate(world, mut, crystal); mut.setY(mut.getY() + 1); diff --git a/src/main/java/ru/betterend/world/features/terrain/SpireFeature.java b/src/main/java/ru/betterend/world/features/terrain/SpireFeature.java index dd74a12c..3eaab4f7 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SpireFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SpireFeature.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFSmoothUnion; @@ -24,7 +25,6 @@ import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndFeatures; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class SpireFeature extends DefaultFeature { @@ -34,8 +34,8 @@ public class SpireFeature extends DefaultFeature { public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { pos = getPosOnSurfaceWG(world, pos); - if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(EndTags.GEN_TERRAIN) - || !world.getBlockState(pos.below(6)).is(EndTags.GEN_TERRAIN)) { + if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN) + || !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) { return false; } @@ -83,7 +83,7 @@ public class SpireFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getBlock() instanceof LeavesBlock) { diff --git a/src/main/java/ru/betterend/world/features/terrain/StalactiteFeature.java b/src/main/java/ru/betterend/world/features/terrain/StalactiteFeature.java index 76522f31..e2e3cc19 100644 --- a/src/main/java/ru/betterend/world/features/terrain/StalactiteFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/StalactiteFeature.java @@ -11,8 +11,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.betterend.blocks.basis.StalactiteBlock; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -43,7 +43,7 @@ public class StalactiteFeature extends DefaultFeature { mut.setY(pos.getY() + i * dir); BlockState state = world.getBlockState(mut); if (!state.getMaterial().isReplaceable()) { - stalagnate = state.is(EndTags.GEN_TERRAIN); + stalagnate = state.is(TagAPI.GEN_TERRAIN); height = i; break; } diff --git a/src/main/java/ru/betterend/world/features/terrain/SulphuricCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/SulphuricCaveFeature.java index 8c74c582..c37156c3 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SulphuricCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SulphuricCaveFeature.java @@ -16,12 +16,12 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.SulphurCrystalBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -42,7 +42,7 @@ public class SulphuricCaveFeature extends DefaultFeature { bpos.setY(top - 1); BlockState state = world.getBlockState(bpos); - while (!state.is(EndTags.GEN_TERRAIN) && bpos.getY() > 5) { + while (!state.is(TagAPI.GEN_TERRAIN) && bpos.getY() > 5) { bpos.setY(bpos.getY() - 1); state = world.getBlockState(bpos); } @@ -51,7 +51,7 @@ public class SulphuricCaveFeature extends DefaultFeature { } top = (int) (bpos.getY() - (radius * 1.3F + 5)); - while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { + while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { bpos.setY(bpos.getY() - 1); state = world.getBlockState(bpos); } @@ -102,7 +102,7 @@ public class SulphuricCaveFeature extends DefaultFeature { } } else if (dist < r2 * r2) { state = world.getBlockState(mut); - if (state.is(EndTags.GEN_TERRAIN) || state.is(Blocks.AIR)) { + if (state.is(TagAPI.GEN_TERRAIN) || state.is(Blocks.AIR)) { double v = noise.eval(x * 0.1, y * 0.1, z * 0.1) + noise.eval(x * 0.03, y * 0.03, z * 0.03) * 0.5; if (v > 0.4) { @@ -132,7 +132,7 @@ public class SulphuricCaveFeature extends DefaultFeature { mut.setY(mut.getY() - 1); state = world.getBlockState(mut); } - if (state.is(EndTags.GEN_TERRAIN) + if (state.is(TagAPI.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) { for (int j = 0; j <= dist; j++) { BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); @@ -167,7 +167,7 @@ public class SulphuricCaveFeature extends DefaultFeature { } private boolean isReplaceable(BlockState state) { - return state.is(EndTags.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT) + return state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT) || state.is(EndBlocks.VENT_BUBBLE_COLUMN) || state.is(EndBlocks.SULPHUR_CRYSTAL) || state.getMaterial().isReplaceable() || state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.WATER_PLANT) || state.getMaterial().equals(Material.LEAVES); diff --git a/src/main/java/ru/betterend/world/features/terrain/SulphuricLakeFeature.java b/src/main/java/ru/betterend/world/features/terrain/SulphuricLakeFeature.java index 0b6e313c..07754d0d 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SulphuricLakeFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SulphuricLakeFeature.java @@ -14,12 +14,12 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Fluids; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.SulphurCrystalBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -60,7 +60,7 @@ public class SulphuricLakeFeature extends DefaultFeature { int dist = x2 + z2; if (dist <= r) { POS.setY(getYOnSurface(world, x, z) - 1); - if (world.getBlockState(POS).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(POS).is(TagAPI.GEN_TERRAIN)) { if (isBorder(world, POS)) { if (random.nextInt(8) > 0) { brimstone.add(POS.immutable()); @@ -93,7 +93,7 @@ public class SulphuricLakeFeature extends DefaultFeature { brimstone.remove(POS); for (Direction dir : BlocksHelper.HORIZONTAL) { BlockPos offseted = POS.relative(dir); - if (world.getBlockState(offseted).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(offseted).is(TagAPI.GEN_TERRAIN)) { brimstone.add(offseted); } } @@ -102,7 +102,7 @@ public class SulphuricLakeFeature extends DefaultFeature { brimstone.remove(POS); for (Direction dir : BlocksHelper.HORIZONTAL) { BlockPos offseted = POS.relative(dir); - if (world.getBlockState(offseted).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(offseted).is(TagAPI.GEN_TERRAIN)) { brimstone.add(offseted); } } @@ -118,7 +118,7 @@ public class SulphuricLakeFeature extends DefaultFeature { } } else if (dist < r2) { POS.setY(getYOnSurface(world, x, z) - 1); - if (world.getBlockState(POS).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(POS).is(TagAPI.GEN_TERRAIN)) { brimstone.add(POS.immutable()); if (random.nextBoolean()) { brimstone.add(POS.below()); diff --git a/src/main/java/ru/betterend/world/features/terrain/SurfaceVentFeature.java b/src/main/java/ru/betterend/world/features/terrain/SurfaceVentFeature.java index 1fc11cf5..9315fc79 100644 --- a/src/main/java/ru/betterend/world/features/terrain/SurfaceVentFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/SurfaceVentFeature.java @@ -8,10 +8,10 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.blocks.HydrothermalVentBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -21,26 +21,23 @@ public class SurfaceVentFeature extends DefaultFeature { NoneFeatureConfiguration config) { pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16))); - if (!world.getBlockState(pos.below(3)).is(EndTags.GEN_TERRAIN)) { + if (!world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)) { return false; } MutableBlockPos mut = new MutableBlockPos(); int count = MHelper.randRange(15, 30, random); - BlockState vent = EndBlocks.HYDROTHERMAL_VENT.defaultBlockState().setValue(HydrothermalVentBlock.WATERLOGGED, - false); + BlockState vent = EndBlocks.HYDROTHERMAL_VENT.defaultBlockState().setValue(HydrothermalVentBlock.WATERLOGGED, false); for (int i = 0; i < count; i++) { - mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, - MHelper.floor(random.nextGaussian() * 2 + 0.5)); - int dist = MHelper.floor(2 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) - + random.nextInt(2); + mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, MHelper.floor(random.nextGaussian() * 2 + 0.5)); + int dist = MHelper.floor(2 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2); if (dist > 0) { BlockState state = world.getBlockState(mut); for (int n = 0; n < 10 && state.isAir(); n++) { mut.setY(mut.getY() - 1); state = world.getBlockState(mut); } - if (state.is(EndTags.GEN_TERRAIN) + if (state.is(TagAPI.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) { for (int j = 0; j <= dist; j++) { BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/CaveChunkPopulatorFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/CaveChunkPopulatorFeature.java index 91aa7714..e1e1c63d 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/CaveChunkPopulatorFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/CaveChunkPopulatorFeature.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import ru.betterend.registry.EndTags; +import ru.bclib.api.TagAPI; import ru.betterend.util.BlocksHelper; import ru.betterend.world.biome.cave.EndCaveBiome; import ru.betterend.world.features.DefaultFeature; @@ -28,8 +28,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature { } @Override - public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, - NoneFeatureConfiguration config) { + public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { Set floorPositions = Sets.newHashSet(); Set ceilPositions = Sets.newHashSet(); int sx = (pos.getX() >> 4) << 4; @@ -61,12 +60,13 @@ public class CaveChunkPopulatorFeature extends DefaultFeature { mut.setY(y); BlockState top = chunk.getBlockState(mut); BlockState bottom = chunk.getBlockState(mut2); - if (top.isAir() && (bottom.is(EndTags.GEN_TERRAIN) || bottom.is(Blocks.STONE))) { + if (top.isAir() && (bottom.is(TagAPI.GEN_TERRAIN) || bottom.is(Blocks.STONE))) { mut3.set(mut2).move(sx, 0, sz); floorPositions.add(mut3.immutable()); updateMin(mut3, min); updateMax(mut3, max); - } else if (bottom.isAir() && (top.is(EndTags.GEN_TERRAIN) || top.is(Blocks.STONE))) { + } + else if (bottom.isAir() && (top.is(TagAPI.GEN_TERRAIN) || top.is(Blocks.STONE))) { mut3.set(mut).move(sx, 0, sz); ceilPositions.add(mut3.immutable()); updateMin(mut3, min); diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java index 4209eb44..d5b13e9f 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java @@ -19,10 +19,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.interfaces.IBiomeArray; import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.biome.EndBiome; import ru.betterend.world.biome.cave.EndCaveBiome; @@ -63,11 +63,11 @@ public abstract class EndCaveFeature extends DefaultFeature { mut.set(bpos); if (world.getBlockState(mut).getMaterial().isReplaceable()) { mut.setY(bpos.getY() - 1); - if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) { floorPositions.add(mut.immutable()); } mut.setY(bpos.getY() + 1); - if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) { ceilPositions.add(mut.immutable()); } } @@ -124,7 +124,7 @@ public abstract class EndCaveFeature extends DefaultFeature { if (wallBlock != null) { for (Vec3i offset: SPHERE) { BlockPos wallPos = pos.offset(offset); - if (!positions.contains(wallPos) && !placed.contains(wallPos) && world.getBlockState(wallPos).is(EndTags.GEN_TERRAIN)) { + if (!positions.contains(wallPos) && !placed.contains(wallPos) && world.getBlockState(wallPos).is(TagAPI.GEN_TERRAIN)) { wallBlock = biome.getWall(wallPos); BlocksHelper.setWithoutUpdate(world, wallPos, wallBlock); placed.add(wallPos); @@ -164,7 +164,7 @@ public abstract class EndCaveFeature extends DefaultFeature { bpos.setY(top - 1); BlockState state = world.getBlockState(bpos); - while (!state.is(EndTags.GEN_TERRAIN) && bpos.getY() > 5) { + while (!state.is(TagAPI.GEN_TERRAIN) && bpos.getY() > 5) { bpos.setY(bpos.getY() - 1); state = world.getBlockState(bpos); } @@ -173,7 +173,7 @@ public abstract class EndCaveFeature extends DefaultFeature { } top = (int) (bpos.getY() - (radius * 1.3F + 5)); - while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { + while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) { bpos.setY(bpos.getY() - 1); state = world.getBlockState(bpos); } diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/RoundCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/RoundCaveFeature.java index 6f005f20..db5fdaaf 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/RoundCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/RoundCaveFeature.java @@ -10,9 +10,9 @@ import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class RoundCaveFeature extends EndCaveFeature { @@ -76,7 +76,7 @@ public class RoundCaveFeature extends EndCaveFeature { } private boolean isReplaceable(BlockState state) { - return state.is(EndTags.GEN_TERRAIN) + return state.is(TagAPI.GEN_TERRAIN) || state.getMaterial().isReplaceable() || state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.LEAVES); diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java index 023e2fd2..92fff549 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java @@ -18,9 +18,9 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import ru.bclib.api.TagAPI; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBiomes; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.biome.cave.EndCaveBiome; @@ -53,7 +53,7 @@ public class TunelCaveFeature extends EndCaveFeature { float vert = Mth.sin((y + (float) noiseV.eval(x * 0.01, z * 0.01) * 20) * 0.1F) * 0.9F; float dist = (float) noiseD.eval(x * 0.1, y * 0.1, z * 0.1) * 0.12F; vert *= vert; - if (val + vert + dist < 0.15 && world.getBlockState(pos).is(EndTags.GEN_TERRAIN) && noWaterNear(world, pos)) { + if (val + vert + dist < 0.15 && world.getBlockState(pos).is(TagAPI.GEN_TERRAIN) && noWaterNear(world, pos)) { BlocksHelper.setWithoutUpdate(world, pos, AIR); positions.add(pos.immutable()); int height = world.getHeight(Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ()); @@ -115,7 +115,7 @@ public class TunelCaveFeature extends EndCaveFeature { } else if (world.getBlockState(mut).getMaterial().isReplaceable()) { mut.setY(bpos.getY() - 1); - if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) { Set floorPositions = floorSets.get(bio); if (floorPositions == null) { floorPositions = Sets.newHashSet(); @@ -124,7 +124,7 @@ public class TunelCaveFeature extends EndCaveFeature { floorPositions.add(mut.immutable()); } mut.setY(bpos.getY() + 1); - if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) { Set ceilPositions = ceilSets.get(bio); if (ceilPositions == null) { ceilPositions = Sets.newHashSet(); diff --git a/src/main/java/ru/betterend/world/features/trees/DragonTreeFeature.java b/src/main/java/ru/betterend/world/features/trees/DragonTreeFeature.java index bb61116e..03e20623 100644 --- a/src/main/java/ru/betterend/world/features/trees/DragonTreeFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/DragonTreeFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; @@ -28,7 +29,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -44,7 +44,7 @@ public class DragonTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; float size = MHelper.randRange(10, 25, random); @@ -111,7 +111,7 @@ public class DragonTreeFeature extends DefaultFeature { SplineHelper.rotateSpline(branch, angle); SplineHelper.scale(branch, scale); Vector3f last = branch.get(branch.size() - 1); - if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) { SplineHelper.fillSpline(branch, world, EndBlocks.DRAGON_TREE.bark.defaultBlockState(), pos, REPLACE); } } @@ -191,7 +191,7 @@ public class DragonTreeFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getBlock() == EndBlocks.DRAGON_TREE_LEAVES) { diff --git a/src/main/java/ru/betterend/world/features/trees/GiganticAmaranitaFeature.java b/src/main/java/ru/betterend/world/features/trees/GiganticAmaranitaFeature.java index 025c4cc1..5797d9c1 100644 --- a/src/main/java/ru/betterend/world/features/trees/GiganticAmaranitaFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/GiganticAmaranitaFeature.java @@ -17,13 +17,13 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.blocks.basis.AttachedBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -35,7 +35,7 @@ public class GiganticAmaranitaFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; float size = MHelper.randRange(5, 10, random); @@ -329,7 +329,7 @@ public class GiganticAmaranitaFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)) { + if (state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) { return true; } return state.getMaterial().isReplaceable(); diff --git a/src/main/java/ru/betterend/world/features/trees/HelixTreeFeature.java b/src/main/java/ru/betterend/world/features/trees/HelixTreeFeature.java index 29a64316..c2b16770 100644 --- a/src/main/java/ru/betterend/world/features/trees/HelixTreeFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/HelixTreeFeature.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.phys.AABB; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFRotation; @@ -26,7 +27,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.blocks.HelixTreeLeavesBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -36,7 +36,7 @@ public class HelixTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlocksHelper.setWithoutUpdate(world, pos, AIR); diff --git a/src/main/java/ru/betterend/world/features/trees/JellyshroomFeature.java b/src/main/java/ru/betterend/world/features/trees/JellyshroomFeature.java index 673513ba..41b92e3e 100644 --- a/src/main/java/ru/betterend/world/features/trees/JellyshroomFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/JellyshroomFeature.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFFlatWave; import ru.bclib.sdf.operator.SDFScale3D; @@ -25,7 +26,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.blocks.JellyshroomCapBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.world.features.DefaultFeature; public class JellyshroomFeature extends DefaultFeature { @@ -35,7 +35,7 @@ public class JellyshroomFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlockState bark = EndBlocks.JELLYSHROOM.bark.defaultBlockState(); @@ -89,7 +89,7 @@ public class JellyshroomFeature extends DefaultFeature { SplineHelper.rotateSpline(branch, angle); SplineHelper.scale(branch, scale); Vector3f last = branch.get(branch.size() - 1); - if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) { SplineHelper.fillSpline(branch, world, wood, pos, REPLACE); } } @@ -118,7 +118,7 @@ public class JellyshroomFeature extends DefaultFeature { SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0)); REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)) { + if (state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) { return true; } return state.getMaterial().isReplaceable(); diff --git a/src/main/java/ru/betterend/world/features/trees/LacugroveFeature.java b/src/main/java/ru/betterend/world/features/trees/LacugroveFeature.java index 96c12663..ce4b2483 100644 --- a/src/main/java/ru/betterend/world/features/trees/LacugroveFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/LacugroveFeature.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; @@ -25,7 +26,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -37,7 +37,7 @@ public class LacugroveFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false; float size = MHelper.randRange(15, 25, random); @@ -82,7 +82,7 @@ public class LacugroveFeature extends DefaultFeature { boolean generate = false; for (int y = minY; y < maxY; y++) { mut.setY(y); - if (world.getBlockState(mut).is(EndTags.END_GROUND)) { + if (world.getBlockState(mut).is(TagAPI.END_GROUND)) { generate = true; break; } @@ -93,7 +93,7 @@ public class LacugroveFeature extends DefaultFeature { mut.setY(y); BlockState state = world.getBlockState(mut); if (state.getMaterial().isReplaceable() || state.getMaterial().equals(Material.PLANT) - || state.is(EndTags.END_GROUND)) { + || state.is(TagAPI.END_GROUND)) { BlocksHelper.setWithoutUpdate(world, mut, y == top ? EndBlocks.LACUGROVE.bark : EndBlocks.LACUGROVE.log); } else { @@ -180,7 +180,7 @@ public class LacugroveFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (EndBlocks.LACUGROVE.isTreeLog(state)) { diff --git a/src/main/java/ru/betterend/world/features/trees/LucerniaFeature.java b/src/main/java/ru/betterend/world/features/trees/LucerniaFeature.java index 5ecf3f19..513f16dd 100644 --- a/src/main/java/ru/betterend/world/features/trees/LucerniaFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/LucerniaFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale; @@ -30,7 +31,6 @@ import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.basis.FurBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -44,7 +44,7 @@ public class LucerniaFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; float size = MHelper.randRange(12, 20, random); @@ -184,7 +184,7 @@ public class LucerniaFeature extends DefaultFeature { SplineHelper.rotateSpline(branch, angle); SplineHelper.scale(branch, scale); Vector3f last = branch.get(branch.size() - 1); - if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) { SplineHelper.fillSplineForce(branch, world, EndBlocks.LUCERNIA.bark.defaultBlockState(), pos, REPLACE); } } @@ -192,7 +192,7 @@ public class LucerniaFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getBlock() == EndBlocks.LUCERNIA_LEAVES) { diff --git a/src/main/java/ru/betterend/world/features/trees/MossyGlowshroomFeature.java b/src/main/java/ru/betterend/world/features/trees/MossyGlowshroomFeature.java index bf116686..9938d492 100644 --- a/src/main/java/ru/betterend/world/features/trees/MossyGlowshroomFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/MossyGlowshroomFeature.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFBinary; import ru.bclib.sdf.operator.SDFCoordModify; @@ -32,7 +33,6 @@ import ru.betterend.blocks.MossyGlowshroomCapBlock; import ru.betterend.blocks.basis.FurBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -86,12 +86,14 @@ public class MossyGlowshroomFeature extends DefaultFeature { info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.defaultBlockState() .setValue(MossyGlowshroomCapBlock.TRANSITION, true)); return info.getState(); - } else if (!EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) + } + else if (!EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) { info.setState(EndBlocks.MOSSY_GLOWSHROOM.bark.defaultBlockState()); return info.getState(); } - } else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) { + } + else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) { if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) { info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.defaultBlockState() .setValue(MossyGlowshroomCapBlock.TRANSITION, true)); @@ -100,7 +102,8 @@ public class MossyGlowshroomFeature extends DefaultFeature { info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.defaultBlockState()); return info.getState(); - } else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { + } + else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { for (Direction dir : BlocksHelper.HORIZONTAL) { if (info.getState(dir) == AIR) { info.setBlockPos(info.getPos().relative(dir), @@ -123,8 +126,7 @@ public class MossyGlowshroomFeature extends DefaultFeature { SDFCappedCone cone1 = new SDFCappedCone().setHeight(2.5F).setRadius1(1.5F).setRadius2(2.5F); SDFCappedCone cone2 = new SDFCappedCone().setHeight(3F).setRadius1(2.5F).setRadius2(13F); SDF posedCone2 = new SDFTranslate().setTranslate(0, 5, 0).setSource(cone2); - SDF posedCone3 = new SDFTranslate().setTranslate(0, 12F, 0) - .setSource(new SDFScale().setScale(2).setSource(cone2)); + SDF posedCone3 = new SDFTranslate().setTranslate(0, 12F, 0).setSource(new SDFScale().setScale(2).setSource(cone2)); SDF upCone = new SDFSubtraction().setSourceA(posedCone2).setSourceB(posedCone3); SDF wave = new SDFFlatWave().setRaysCount(12).setIntensity(1.3F).setSource(upCone); SDF cones = new SDFSmoothUnion().setRadius(3).setSourceA(cone1).setSourceB(wave); @@ -163,7 +165,7 @@ public class MossyGlowshroomFeature extends DefaultFeature { .setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT)); REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getMaterial().equals(Material.PLANT)) { diff --git a/src/main/java/ru/betterend/world/features/trees/PythadendronTreeFeature.java b/src/main/java/ru/betterend/world/features/trees/PythadendronTreeFeature.java index 2e7394e7..d080cfb8 100644 --- a/src/main/java/ru/betterend/world/features/trees/PythadendronTreeFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/PythadendronTreeFeature.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; @@ -26,7 +27,6 @@ import ru.bclib.util.MHelper; import ru.bclib.util.SplineHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -36,10 +36,10 @@ public class PythadendronTreeFeature extends DefaultFeature { private static final Function POST; @Override - public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, - NoneFeatureConfiguration config) { - if (world.getBlockState(pos.below()).getBlock() != EndBlocks.CHORUS_NYLIUM) + public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { + if (world.getBlockState(pos.below()).getBlock() != EndBlocks.CHORUS_NYLIUM) { return false; + } BlocksHelper.setWithoutUpdate(world, pos, AIR); float size = MHelper.randRange(10, 20, random); @@ -168,7 +168,7 @@ public class PythadendronTreeFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getBlock() == EndBlocks.PYTHADENDRON_LEAVES) { diff --git a/src/main/java/ru/betterend/world/features/trees/TenaneaFeature.java b/src/main/java/ru/betterend/world/features/trees/TenaneaFeature.java index 7f06d8f0..9089be16 100644 --- a/src/main/java/ru/betterend/world/features/trees/TenaneaFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/TenaneaFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFScale; @@ -30,7 +31,6 @@ import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.basis.FurBlock; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -43,7 +43,7 @@ public class TenaneaFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; float size = MHelper.randRange(7, 10, random); @@ -173,7 +173,7 @@ public class TenaneaFeature extends DefaultFeature { static { REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND)) { + if (state.is(TagAPI.END_GROUND)) { return true; } if (state.getBlock() == EndBlocks.TENANEA_LEAVES) { diff --git a/src/main/java/ru/betterend/world/features/trees/UmbrellaTreeFeature.java b/src/main/java/ru/betterend/world/features/trees/UmbrellaTreeFeature.java index 81868ca9..06676b0c 100644 --- a/src/main/java/ru/betterend/world/features/trees/UmbrellaTreeFeature.java +++ b/src/main/java/ru/betterend/world/features/trees/UmbrellaTreeFeature.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.material.Material; +import ru.bclib.api.TagAPI; import ru.bclib.sdf.SDF; import ru.bclib.sdf.operator.SDFFlatWave; import ru.bclib.sdf.operator.SDFScale; @@ -30,7 +31,6 @@ import ru.bclib.util.SplineHelper; import ru.betterend.blocks.UmbrellaTreeClusterBlock; import ru.betterend.blocks.UmbrellaTreeMembraneBlock; import ru.betterend.registry.EndBlocks; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; import ru.betterend.world.features.DefaultFeature; @@ -42,7 +42,7 @@ public class UmbrellaTreeFeature extends DefaultFeature { @Override public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) { - if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND)) + if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)) return false; BlockState wood = EndBlocks.UMBRELLA_TREE.bark.defaultBlockState(); @@ -156,7 +156,7 @@ public class UmbrellaTreeFeature extends DefaultFeature { SplineHelper.rotateSpline(branch, angle); SplineHelper.scale(branch, scale); Vector3f last = branch.get(branch.size() - 1); - if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) { + if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) { SplineHelper.fillSplineForce(branch, world, wood, pos, REPLACE); } } @@ -206,7 +206,7 @@ public class UmbrellaTreeFeature extends DefaultFeature { SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0)); REPLACE = (state) -> { - if (state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) + if (state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.is(EndBlocks.UMBRELLA_TREE_MEMBRANE)) { return true; } diff --git a/src/main/java/ru/betterend/world/structures/piece/CavePiece.java b/src/main/java/ru/betterend/world/structures/piece/CavePiece.java index 0a90ded3..c997ef0f 100644 --- a/src/main/java/ru/betterend/world/structures/piece/CavePiece.java +++ b/src/main/java/ru/betterend/world/structures/piece/CavePiece.java @@ -13,10 +13,10 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndStructures; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class CavePiece extends BasePiece { @@ -66,7 +66,7 @@ public class CavePiece extends BasePiece { double r2 = r - 4.5; double dist = xsq + ysq + zsq; if (dist < r2 * r2) { - if (world.getBlockState(pos).is(EndTags.END_GROUND)) { + if (world.getBlockState(pos).is(TagAPI.END_GROUND)) { BlocksHelper.setWithoutUpdate(world, pos, CAVE_AIR); } } diff --git a/src/main/java/ru/betterend/world/structures/piece/CrystalMountainPiece.java b/src/main/java/ru/betterend/world/structures/piece/CrystalMountainPiece.java index 45ce8dad..d090fc5c 100644 --- a/src/main/java/ru/betterend/world/structures/piece/CrystalMountainPiece.java +++ b/src/main/java/ru/betterend/world/structures/piece/CrystalMountainPiece.java @@ -18,11 +18,11 @@ import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndStructures; -import ru.betterend.registry.EndTags; public class CrystalMountainPiece extends MountainPiece { private BlockState top; @@ -68,7 +68,7 @@ public class CrystalMountainPiece extends MountainPiece { continue; } pos.setY(minY); - while (!chunk.getBlockState(pos).is(EndTags.GEN_TERRAIN) && pos.getY() > 56 && !chunk.getBlockState(pos.below()).is(Blocks.CAVE_AIR)) { + while (!chunk.getBlockState(pos).is(TagAPI.GEN_TERRAIN) && pos.getY() > 56 && !chunk.getBlockState(pos.below()).is(Blocks.CAVE_AIR)) { pos.setY(pos.getY() - 1); } minY = pos.getY(); diff --git a/src/main/java/ru/betterend/world/structures/piece/LakePiece.java b/src/main/java/ru/betterend/world/structures/piece/LakePiece.java index d1806a2b..6c04a592 100644 --- a/src/main/java/ru/betterend/world/structures/piece/LakePiece.java +++ b/src/main/java/ru/betterend/world/structures/piece/LakePiece.java @@ -24,12 +24,12 @@ import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; import net.minecraft.world.level.material.FluidState; +import ru.bclib.api.TagAPI; import ru.bclib.util.MHelper; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndStructures; -import ru.betterend.registry.EndTags; import ru.betterend.util.BlocksHelper; public class LakePiece extends BasePiece { @@ -117,7 +117,7 @@ public class LakePiece extends BasePiece { double dist = x3 + y2 + z3; if (dist < r2) { BlockState state = chunk.getBlockState(mut); - if (state.is(EndTags.GEN_TERRAIN) || state.isAir()) { + if (state.is(TagAPI.GEN_TERRAIN) || state.isAir()) { state = mut.getY() < center.getY() ? WATER : CAVE_AIR; chunk.setBlockState(mut, state, false); } diff --git a/src/main/resources/betterend.mixins.client.json b/src/main/resources/betterend.mixins.client.json index 5f4555ed..a178cbc6 100644 --- a/src/main/resources/betterend.mixins.client.json +++ b/src/main/resources/betterend.mixins.client.json @@ -6,7 +6,6 @@ "client": [ "AbstractSoundInstanceAccessor", "ClientPlayNetworkHandlerMixin", - "EnchantingTableBlockMixin", "HumanoidMobRendererMixin", "ArmorStandRendererMixin", "BackgroundRendererMixin", diff --git a/src/main/resources/betterend.mixins.common.json b/src/main/resources/betterend.mixins.common.json index fe080a91..a5527273 100644 --- a/src/main/resources/betterend.mixins.common.json +++ b/src/main/resources/betterend.mixins.common.json @@ -16,13 +16,11 @@ "EndPodiumFeatureMixin", "PotionBrewingAccessor", "RecipeManagerAccessor", - "EnchantmentMenuMixin", "MinecraftServerMixin", "EndDragonFightMixin", "BlockBehaviourMixin", "DimensionTypeMixin", "RecipeManagerMixin", - "BoneMealItemMixin", "CraftingMenuMixin", "LivingEntityMixin", "ServerPlayerMixin",