diff --git a/src/main/generated/.cache/255077b0edcd375a36194e341290090413149a04 b/src/main/generated/.cache/255077b0edcd375a36194e341290090413149a04 index 011b583..b27aa50 100644 --- a/src/main/generated/.cache/255077b0edcd375a36194e341290090413149a04 +++ b/src/main/generated/.cache/255077b0edcd375a36194e341290090413149a04 @@ -1,4 +1,4 @@ -// 1.20.1 2024-02-28T16:10:55.923496592 Hollow/Model Definitions +// 1.20.1 2024-03-05T19:09:45.284734127 Hollow/Model Definitions 957f8f0186bb09ed323faac324b5df5f8671b02d assets/hollow/models/block/stripped_cherry_hollow_log.json 641cc377332e8cf8d849ac2e135a175f33733b37 assets/hollow/models/block/stripped_cherry_hollow_log_horizontal.json 28a6bd9e9b4a62bd3ce03d0f0af1c99acd72aa88 assets/hollow/models/item/stripped_oak_hollow_log.json @@ -16,9 +16,9 @@ fd8d6b93e356a2632b8db7a846273ab9b1737db7 assets/hollow/models/block/crimson_holl bd3123ec45fe3d031a28d5b0868b229ecc0dabed assets/hollow/models/item/stripped_mangrove_hollow_log.json 68a7a41493cb5c9cf6d4c84daa4ff878f02451fc assets/hollow/blockstates/stripped_mangrove_hollow_log.json f48c02690796da2328b2afb51a6e64ae76c8fcb2 assets/hollow/models/item/oak_hollow_log.json +6cfc739e7aeebff948981811876f709fb8d404fe assets/hollow/blockstates/warped_hollow_stem.json cb048fa4b582d96b7d5c9345273ec9dc2a9c3d4a assets/hollow/models/block/stripped_crimson_hollow_stem.json 989df3afc76cd3268265f35f24a92f48b07bc809 assets/hollow/models/block/stripped_oak_hollow_log.json -6cfc739e7aeebff948981811876f709fb8d404fe assets/hollow/blockstates/warped_hollow_stem.json 0b3bbe89040c807a8e46ce665f554929c0b28784 assets/hollow/blockstates/birch_hollow_log.json f78d6aaf29d2f56153350a99bc5dc2b8e69571f6 assets/hollow/models/block/stripped_jungle_hollow_log.json e9028ee18b8c78ae0482073f3332e606e9c6d47f assets/hollow/models/item/spruce_hollow_log.json @@ -61,8 +61,8 @@ d37c24fa00564bc4f804814d0bb9956d8e46ea1e assets/hollow/models/block/stripped_bir 3cac0a21adf2477e3b01cd21945d0f806f82a1a9 assets/hollow/blockstates/oak_hollow_log.json d2b27363f222a836291843499134c1c713d8b9ce assets/hollow/models/item/stripped_acacia_hollow_log.json 01c40b7e9bc6af191f3e44cc993691501b8f3f10 assets/hollow/blockstates/stripped_jungle_hollow_log.json -846db65370b5234748b994a5f2c8d359261d20cd assets/hollow/models/block/stripped_dark_oak_hollow_log_horizontal.json eae596b71330da28b5566ac1078d3a2d16c4dabb assets/hollow/blockstates/stripped_dark_oak_hollow_log.json +846db65370b5234748b994a5f2c8d359261d20cd assets/hollow/models/block/stripped_dark_oak_hollow_log_horizontal.json 5fc6bfd74fd5c2bb9c21b6cc069f59dc3051c805 assets/hollow/models/block/stripped_spruce_hollow_log.json cd86ba8936382b6f13e4206f5fcc202779fc9e74 assets/hollow/blockstates/cherry_hollow_log.json 346d05d24a30781b0c8fcf318fadcbccd84cc892 assets/hollow/models/block/warped_hollow_stem.json diff --git a/src/main/java/dev/callmeecho/hollow/client/HollowClient.java b/src/main/java/dev/callmeecho/hollow/client/HollowClient.java index 4a67e51..a458b4e 100644 --- a/src/main/java/dev/callmeecho/hollow/client/HollowClient.java +++ b/src/main/java/dev/callmeecho/hollow/client/HollowClient.java @@ -1,13 +1,22 @@ package dev.callmeecho.hollow.client; import dev.callmeecho.hollow.client.render.entity.FireflyEntityRenderer; +import dev.callmeecho.hollow.main.Hollow; import dev.callmeecho.hollow.main.block.HollowLogBlock; import dev.callmeecho.hollow.main.registry.HollowBlockRegistry; import dev.callmeecho.hollow.main.registry.HollowEntityTypeRegistry; +import dev.callmeecho.hollow.main.registry.HollowItemRegistry; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; +import net.fabricmc.fabric.mixin.client.rendering.BlockColorsMixin; +import net.minecraft.block.BlockState; +import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.item.ItemColorProvider; +import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.render.RenderLayer; +import net.minecraft.item.BlockItem; public class HollowClient implements ClientModInitializer { @Override @@ -16,5 +25,8 @@ public void onInitializeClient() { BlockRenderLayerMap.INSTANCE.putBlock(HollowBlockRegistry.PINK_DAISY, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(HollowBlockRegistry.PAEONIA, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(HollowBlockRegistry.LOTUS_LILYPAD, RenderLayer.getCutout()); + ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> world != null && pos != null ? 0x208030 : 0x71C35C, HollowBlockRegistry.LOTUS_LILYPAD); + ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? 0x71C35C : -1, HollowItemRegistry.LOTUS_LILYPAD); } } diff --git a/src/main/java/dev/callmeecho/hollow/datagen/ModelProvider.java b/src/main/java/dev/callmeecho/hollow/datagen/ModelProvider.java index d4b9bfa..b77a793 100644 --- a/src/main/java/dev/callmeecho/hollow/datagen/ModelProvider.java +++ b/src/main/java/dev/callmeecho/hollow/datagen/ModelProvider.java @@ -10,7 +10,10 @@ import java.util.Optional; +import static dev.callmeecho.hollow.main.Hollow.MODID; +import static dev.callmeecho.hollow.main.registry.HollowBlockRegistry.LOTUS_LILYPAD; import static net.minecraft.data.client.BlockStateModelGenerator.createAxisRotatedBlockState; +import static net.minecraft.data.client.BlockStateModelGenerator.createBlockStateWithRandomHorizontalRotations; public class ModelProvider extends FabricModelProvider { public static final Model HOLLOW_LOG = new Model(Optional.of(new Identifier("hollow", "block/" + "hollow_log_template")), Optional.empty(), TextureKey.SIDE, TextureKey.INSIDE, TextureKey.END); diff --git a/src/main/java/dev/callmeecho/hollow/main/Hollow.java b/src/main/java/dev/callmeecho/hollow/main/Hollow.java index d90aeb9..c004568 100644 --- a/src/main/java/dev/callmeecho/hollow/main/Hollow.java +++ b/src/main/java/dev/callmeecho/hollow/main/Hollow.java @@ -3,18 +3,10 @@ import dev.callmeecho.cabinetapi.item.CabinetItemGroup; import dev.callmeecho.cabinetapi.registry.RegistrarHandler; import dev.callmeecho.hollow.main.entity.FireflyEntity; -import dev.callmeecho.hollow.main.registry.HollowBlockRegistry; -import dev.callmeecho.hollow.main.registry.HollowEntityTypeRegistry; -import dev.callmeecho.hollow.main.registry.HollowItemRegistry; +import dev.callmeecho.hollow.main.registry.*; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.biome.v1.BiomeModifications; -import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.entity.SpawnRestriction; import net.minecraft.util.Identifier; -import net.minecraft.world.Heightmap; -import net.minecraft.world.biome.BiomeKeys; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,13 +21,12 @@ public void onInitialize() { RegistrarHandler.process(HollowBlockRegistry.class, MODID); RegistrarHandler.process(HollowItemRegistry.class, MODID); RegistrarHandler.process(HollowEntityTypeRegistry.class, MODID); + RegistrarHandler.process(HollowFeatureRegistry.class, MODID); + RegistrarHandler.process(HollowTreeDecoratorRegistry.class, MODID); FabricDefaultAttributeRegistry.register(HollowEntityTypeRegistry.FIREFLY, FireflyEntity.createFireflyAttributes()); - BiomeModifications.addSpawn(BiomeSelectors.includeByKey( - BiomeKeys.SWAMP, - BiomeKeys.MANGROVE_SWAMP - ), SpawnGroup.AMBIENT, HollowEntityTypeRegistry.FIREFLY, 20, 10, 30); - SpawnRestriction.register(HollowEntityTypeRegistry.FIREFLY, SpawnRestriction.Location.NO_RESTRICTIONS, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, FireflyEntity::canSpawn); + + HollowBiomeModifications.init(); GROUP.initialize(); } diff --git a/src/main/java/dev/callmeecho/hollow/main/HollowBiomeModifications.java b/src/main/java/dev/callmeecho/hollow/main/HollowBiomeModifications.java new file mode 100644 index 0000000..7d8f6d2 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/HollowBiomeModifications.java @@ -0,0 +1,71 @@ +package dev.callmeecho.hollow.main; + +import dev.callmeecho.hollow.main.entity.FireflyEntity; +import dev.callmeecho.hollow.main.registry.HollowEntityTypeRegistry; +import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext; +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; +import net.fabricmc.fabric.api.biome.v1.ModificationPhase; +import net.minecraft.entity.SpawnGroup; +import net.minecraft.entity.SpawnRestriction; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import net.minecraft.world.Heightmap; +import net.minecraft.world.biome.BiomeKeys; +import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.feature.PlacedFeature; +import net.minecraft.world.gen.feature.VegetationPlacedFeatures; + +public class HollowBiomeModifications { + public static void init() { + BiomeModifications.addSpawn(BiomeSelectors.includeByKey( + BiomeKeys.SWAMP, + BiomeKeys.MANGROVE_SWAMP + ), SpawnGroup.AMBIENT, HollowEntityTypeRegistry.FIREFLY, 5, 10, 15); + SpawnRestriction.register(HollowEntityTypeRegistry.FIREFLY, SpawnRestriction.Location.NO_RESTRICTIONS, Heightmap.Type.WORLD_SURFACE, FireflyEntity::canSpawn); + + BiomeModifications.addFeature(BiomeSelectors.includeByKey( + BiomeKeys.BIRCH_FOREST, + BiomeKeys.OLD_GROWTH_BIRCH_FOREST + ), GenerationStep.Feature.VEGETAL_DECORATION, getPlacedFeature("fallen_birch")); + + BiomeModifications.create(new Identifier(Hollow.MODID, "better_swamps_replace")).add(ModificationPhase.REPLACEMENTS, BiomeSelectors.includeByKey( + BiomeKeys.SWAMP, + BiomeKeys.MANGROVE_SWAMP + ), context -> { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); + + if (generationSettings.removeFeature(VegetationPlacedFeatures.PATCH_WATERLILY)) + generationSettings.addFeature(GenerationStep.Feature.VEGETAL_DECORATION, getPlacedFeature("patch_waterlily")); + }); + + BiomeModifications.create(new Identifier(Hollow.MODID, "better_birch_replace")).add(ModificationPhase.REPLACEMENTS, BiomeSelectors.includeByKey( + BiomeKeys.BIRCH_FOREST, + BiomeKeys.OLD_GROWTH_BIRCH_FOREST + ), context -> { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); + if (generationSettings.removeFeature(VegetationPlacedFeatures.TREES_BIRCH)) + generationSettings.addFeature(GenerationStep.Feature.VEGETAL_DECORATION, getPlacedFeature("trees_birch")); + + if (generationSettings.removeFeature(VegetationPlacedFeatures.BIRCH_TALL)) + generationSettings.addFeature(GenerationStep.Feature.VEGETAL_DECORATION, getPlacedFeature("birch_tall")); + + if (generationSettings.removeFeature(VegetationPlacedFeatures.FLOWER_DEFAULT) && generationSettings.removeFeature(VegetationPlacedFeatures.FOREST_FLOWERS)) + generationSettings.addFeature(GenerationStep.Feature.VEGETAL_DECORATION, getPlacedFeature("patch_lilac_birch")); + }); + + BiomeModifications.create(new Identifier(Hollow.MODID, "better_birch_remove")).add(ModificationPhase.REMOVALS, BiomeSelectors.includeByKey( + BiomeKeys.BIRCH_FOREST, + BiomeKeys.OLD_GROWTH_BIRCH_FOREST + ), context -> { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); + + generationSettings.removeFeature(VegetationPlacedFeatures.PATCH_PUMPKIN); + }); + } + + public static RegistryKey getPlacedFeature(String id) { + return RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(Hollow.MODID, id)); + } +} diff --git a/src/main/java/dev/callmeecho/hollow/main/entity/FireflyEntity.java b/src/main/java/dev/callmeecho/hollow/main/entity/FireflyEntity.java index f2185be..91b1474 100644 --- a/src/main/java/dev/callmeecho/hollow/main/entity/FireflyEntity.java +++ b/src/main/java/dev/callmeecho/hollow/main/entity/FireflyEntity.java @@ -1,10 +1,7 @@ package dev.callmeecho.hollow.main.entity; import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.Flutterer; -import net.minecraft.entity.SpawnReason; +import net.minecraft.entity.*; import net.minecraft.entity.ai.AboveGroundTargeting; import net.minecraft.entity.ai.NoPenaltySolidTargeting; import net.minecraft.entity.ai.control.FlightMoveControl; @@ -28,6 +25,7 @@ import net.minecraft.world.LightType; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; +import net.minecraft.world.WorldView; import java.util.EnumSet; @@ -94,16 +92,24 @@ public static DefaultAttributeContainer.Builder createFireflyAttributes() { public void tick() { super.tick(); - if (this.age % 5 == 0 && this.random.nextInt(5) == 0) { - this.setLightTicks(this.getLightTicks() - this.random.nextBetween(10, 15)); + if (getEntityWorld().isNight() || getEntityWorld().getLightLevel(this.getBlockPos()) < 5) { + if (this.age % 5 == 0 && this.random.nextInt(5) == 0) { + this.setLightTicks(this.getLightTicks() - this.random.nextBetween(10, 15)); + } else { + this.setLightTicks(this.getLightTicks() + 1); + } } else { - this.setLightTicks(this.getLightTicks() + 1); + if (this.age % 5 == 0 && this.random.nextInt(5) == 0) { + this.setLightTicks(this.getLightTicks() + this.random.nextBetween(5, 10)); + } else { + this.setLightTicks(this.getLightTicks() - 1); + } } - + if (this.getLightTicks() > 15) { this.setLightTicks(15); } - + if (this.getLightTicks() < 0 || this.isWet()) { this.setLightTicks(0); } @@ -138,6 +144,18 @@ public static boolean canSpawn(EntityType entityType, ServerWorld return FireflyEntity.canMobSpawn(entityType, worldAccess, spawnReason, pos, random); } + @Override + public float getPathfindingFavor(BlockPos pos, WorldView world) { + return world.getBlockState(pos).isAir() ? 10.0F : 0.0F; + } + + @Override + protected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions) { + return dimensions.height * 0.5F; + } + + + static class FlyRandomlyGoal extends Goal { private final FireflyEntity firefly; @@ -145,18 +163,19 @@ public FlyRandomlyGoal(FireflyEntity firefly) { this.firefly = firefly; this.setControls(EnumSet.of(Goal.Control.MOVE)); } - + + protected Vec3d getWanderTarget() { Vec3d rotation = firefly.getRotationVec(0.0F); - Vec3d target = AboveGroundTargeting.find(firefly, 8, 2, rotation.x, rotation.z, MathHelper.HALF_PI, 3, 1); + Vec3d target = AboveGroundTargeting.find(firefly, 8, 7, rotation.x, rotation.z, MathHelper.HALF_PI, 3, 1); if (target != null) return target; - return NoPenaltySolidTargeting.find(firefly, 8, 2, -2, rotation.x, rotation.z, MathHelper.HALF_PI); + return NoPenaltySolidTargeting.find(firefly, 8, 4, -2, rotation.x, rotation.z, MathHelper.HALF_PI); } @Override public boolean canStart() { - return firefly.navigation.isIdle() && firefly.random.nextInt(5) == 0; + return firefly.navigation.isIdle() && firefly.random.nextInt(10) == 0; } @Override diff --git a/src/main/java/dev/callmeecho/hollow/main/registry/HollowBlockRegistry.java b/src/main/java/dev/callmeecho/hollow/main/registry/HollowBlockRegistry.java index d4b7e87..119564b 100644 --- a/src/main/java/dev/callmeecho/hollow/main/registry/HollowBlockRegistry.java +++ b/src/main/java/dev/callmeecho/hollow/main/registry/HollowBlockRegistry.java @@ -6,6 +6,8 @@ import dev.callmeecho.cabinetapi.item.CabinetItemGroup; import dev.callmeecho.cabinetapi.registry.BlockRegistrar; import dev.callmeecho.hollow.main.block.HollowLogBlock; +import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; +import net.fabricmc.fabric.api.registry.StrippableBlockRegistry; import net.minecraft.block.*; import net.minecraft.block.piston.PistonBehavior; import net.minecraft.entity.effect.StatusEffects; @@ -16,37 +18,51 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.Identifier; +import java.lang.reflect.Field; + @SuppressWarnings("unused") public class HollowBlockRegistry implements BlockRegistrar { - public static final HollowLogBlock STRIPPED_OAK_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_OAK_LOG.settings, "stripped_oak_log", "stripped_oak_log", "stripped_oak_log_top"); - public static final HollowLogBlock OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.OAK_LOG.settings).strippedBlock(STRIPPED_OAK_HOLLOW_LOG), "oak_log", "stripped_oak_log", "oak_log_top"); + @Override + public void register(String name, String namespace, Block object, Field field) { + if (object.settings instanceof CabinetBlockSettings settings) { + if (settings.getStrippedBlock() != null) { StrippableBlockRegistry.register(object, settings.getStrippedBlock()); } + if (settings.isFlammable()) { FlammableBlockRegistry.getDefaultInstance().add(object, settings.getBurn(), settings.getSpread()); } + } + Registry.register(getRegistry(), new Identifier(namespace, name), object); + + if (field.isAnnotationPresent(NoBlockItem.class)) return; + registerBlockItem(object, namespace, name); + } + + public static final HollowLogBlock STRIPPED_OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_OAK_LOG.settings).flammable(), "stripped_oak_log", "stripped_oak_log", "stripped_oak_log_top"); + public static final HollowLogBlock OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.OAK_LOG.settings).strippedBlock(STRIPPED_OAK_HOLLOW_LOG).flammable(), "oak_log", "stripped_oak_log", "oak_log_top"); - public static final HollowLogBlock STRIPPED_SPRUCE_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_SPRUCE_LOG.settings, "stripped_spruce_log", "stripped_spruce_log", "stripped_spruce_log_top"); - public static final HollowLogBlock SPRUCE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.SPRUCE_LOG.settings).strippedBlock(STRIPPED_SPRUCE_HOLLOW_LOG), "spruce_log", "stripped_spruce_log", "spruce_log_top"); + public static final HollowLogBlock STRIPPED_SPRUCE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_SPRUCE_LOG.settings).flammable(), "stripped_spruce_log", "stripped_spruce_log", "stripped_spruce_log_top"); + public static final HollowLogBlock SPRUCE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.SPRUCE_LOG.settings).strippedBlock(STRIPPED_SPRUCE_HOLLOW_LOG).flammable(), "spruce_log", "stripped_spruce_log", "spruce_log_top"); - public static final HollowLogBlock STRIPPED_BIRCH_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_BIRCH_LOG.settings, "stripped_birch_log", "stripped_birch_log", "stripped_birch_log_top"); - public static final HollowLogBlock BIRCH_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.BIRCH_LOG.settings).strippedBlock(STRIPPED_BIRCH_HOLLOW_LOG), "birch_log", "stripped_birch_log", "birch_log_top"); + public static final HollowLogBlock STRIPPED_BIRCH_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_BIRCH_LOG.settings).flammable(), "stripped_birch_log", "stripped_birch_log", "stripped_birch_log_top"); + public static final HollowLogBlock BIRCH_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.BIRCH_LOG.settings).strippedBlock(STRIPPED_BIRCH_HOLLOW_LOG).flammable(), "birch_log", "stripped_birch_log", "birch_log_top"); - public static final HollowLogBlock STRIPPED_JUNGLE_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_JUNGLE_LOG.settings, "stripped_jungle_log", "stripped_jungle_log", "stripped_jungle_log_top"); - public static final HollowLogBlock JUNGLE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.JUNGLE_LOG.settings).strippedBlock(STRIPPED_JUNGLE_HOLLOW_LOG), "jungle_log", "stripped_jungle_log", "jungle_log_top"); + public static final HollowLogBlock STRIPPED_JUNGLE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_JUNGLE_LOG.settings).flammable(), "stripped_jungle_log", "stripped_jungle_log", "stripped_jungle_log_top"); + public static final HollowLogBlock JUNGLE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.JUNGLE_LOG.settings).strippedBlock(STRIPPED_JUNGLE_HOLLOW_LOG).flammable(), "jungle_log", "stripped_jungle_log", "jungle_log_top"); - public static final HollowLogBlock STRIPPED_ACACIA_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_ACACIA_LOG.settings, "stripped_acacia_log", "stripped_acacia_log", "stripped_acacia_log_top"); - public static final HollowLogBlock ACACIA_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.ACACIA_LOG.settings).strippedBlock(STRIPPED_ACACIA_HOLLOW_LOG), "acacia_log", "stripped_acacia_log", "acacia_log_top"); + public static final HollowLogBlock STRIPPED_ACACIA_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_ACACIA_LOG.settings).flammable(), "stripped_acacia_log", "stripped_acacia_log", "stripped_acacia_log_top"); + public static final HollowLogBlock ACACIA_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.ACACIA_LOG.settings).strippedBlock(STRIPPED_ACACIA_HOLLOW_LOG).flammable(), "acacia_log", "stripped_acacia_log", "acacia_log_top"); - public static final HollowLogBlock STRIPPED_DARK_OAK_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_DARK_OAK_LOG.settings, "stripped_dark_oak_log", "stripped_dark_oak_log", "stripped_dark_oak_log_top"); - public static final HollowLogBlock DARK_OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.DARK_OAK_LOG.settings).strippedBlock(STRIPPED_DARK_OAK_HOLLOW_LOG), "dark_oak_log", "stripped_dark_oak_log", "dark_oak_log_top"); + public static final HollowLogBlock STRIPPED_DARK_OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_DARK_OAK_LOG.settings).flammable(), "stripped_dark_oak_log", "stripped_dark_oak_log", "stripped_dark_oak_log_top"); + public static final HollowLogBlock DARK_OAK_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.DARK_OAK_LOG.settings).strippedBlock(STRIPPED_DARK_OAK_HOLLOW_LOG).flammable(), "dark_oak_log", "stripped_dark_oak_log", "dark_oak_log_top"); - public static final HollowLogBlock STRIPPED_CRIMSON_HOLLOW_STEM = new HollowLogBlock(Blocks.STRIPPED_CRIMSON_STEM.settings, "stripped_crimson_stem", "stripped_crimson_stem", "stripped_crimson_stem_top"); - public static final HollowLogBlock CRIMSON_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.CRIMSON_STEM.settings).strippedBlock(STRIPPED_CRIMSON_HOLLOW_STEM), "crimson_stem", "stripped_crimson_stem", "crimson_stem_top"); + public static final HollowLogBlock STRIPPED_CRIMSON_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_CRIMSON_STEM.settings).flammable(), "stripped_crimson_stem", "stripped_crimson_stem", "stripped_crimson_stem_top"); + public static final HollowLogBlock CRIMSON_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.CRIMSON_STEM.settings).strippedBlock(STRIPPED_CRIMSON_HOLLOW_STEM).flammable(), "crimson_stem", "stripped_crimson_stem", "crimson_stem_top"); - public static final HollowLogBlock STRIPPED_WARPED_HOLLOW_STEM = new HollowLogBlock(Blocks.STRIPPED_WARPED_STEM.settings, "stripped_warped_stem", "stripped_warped_stem", "stripped_warped_stem_top"); - public static final HollowLogBlock WARPED_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.WARPED_STEM.settings).strippedBlock(STRIPPED_WARPED_HOLLOW_STEM), "warped_stem", "stripped_warped_stem", "warped_stem_top"); + public static final HollowLogBlock STRIPPED_WARPED_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_WARPED_STEM.settings).flammable(), "stripped_warped_stem", "stripped_warped_stem", "stripped_warped_stem_top"); + public static final HollowLogBlock WARPED_HOLLOW_STEM = new HollowLogBlock(new CabinetBlockSettings(Blocks.WARPED_STEM.settings).strippedBlock(STRIPPED_WARPED_HOLLOW_STEM).flammable(), "warped_stem", "stripped_warped_stem", "warped_stem_top"); - public static final HollowLogBlock STRIPPED_MANGROVE_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_MANGROVE_LOG.settings, "stripped_mangrove_log", "stripped_mangrove_log", "stripped_mangrove_log_top"); - public static final HollowLogBlock MANGROVE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.MANGROVE_LOG.settings).strippedBlock(STRIPPED_MANGROVE_HOLLOW_LOG), "mangrove_log", "stripped_mangrove_log", "mangrove_log_top"); + public static final HollowLogBlock STRIPPED_MANGROVE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_MANGROVE_LOG.settings).flammable(), "stripped_mangrove_log", "stripped_mangrove_log", "stripped_mangrove_log_top"); + public static final HollowLogBlock MANGROVE_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.MANGROVE_LOG.settings).strippedBlock(STRIPPED_MANGROVE_HOLLOW_LOG).flammable(), "mangrove_log", "stripped_mangrove_log", "mangrove_log_top"); - public static final HollowLogBlock STRIPPED_CHERRY_HOLLOW_LOG = new HollowLogBlock(Blocks.STRIPPED_CHERRY_LOG.settings, "stripped_cherry_log", "stripped_cherry_log", "stripped_cherry_log_top"); - public static final HollowLogBlock CHERRY_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.CHERRY_LOG.settings).strippedBlock(STRIPPED_CHERRY_HOLLOW_LOG), "cherry_log", "stripped_cherry_log", "cherry_log_top"); + public static final HollowLogBlock STRIPPED_CHERRY_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.STRIPPED_CHERRY_LOG.settings).flammable(), "stripped_cherry_log", "stripped_cherry_log", "stripped_cherry_log_top"); + public static final HollowLogBlock CHERRY_HOLLOW_LOG = new HollowLogBlock(new CabinetBlockSettings(Blocks.CHERRY_LOG.settings).strippedBlock(STRIPPED_CHERRY_HOLLOW_LOG).flammable(), "cherry_log", "stripped_cherry_log", "cherry_log_top"); public static final FlowerBlock PINK_DAISY = new FlowerBlock( StatusEffects.REGENERATION, @@ -71,6 +87,16 @@ public class HollowBlockRegistry implements BlockRegistrar { .offset(AbstractBlock.OffsetType.XZ) .pistonBehavior(PistonBehavior.DESTROY) ); + + @NoBlockItem + public static final LilyPadBlock LOTUS_LILYPAD = new LilyPadBlock( + AbstractBlock.Settings.create() + .mapColor(MapColor.DARK_GREEN) + .breakInstantly() + .sounds(BlockSoundGroup.LILY_PAD) + .nonOpaque() + .pistonBehavior(PistonBehavior.DESTROY) + ); @Override public void registerBlockItem(Block block, String namespace, String name) { diff --git a/src/main/java/dev/callmeecho/hollow/main/registry/HollowFeatureRegistry.java b/src/main/java/dev/callmeecho/hollow/main/registry/HollowFeatureRegistry.java new file mode 100644 index 0000000..654fac6 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/registry/HollowFeatureRegistry.java @@ -0,0 +1,18 @@ +package dev.callmeecho.hollow.main.registry; + +import dev.callmeecho.cabinetapi.registry.Registrar; +import dev.callmeecho.hollow.main.worldgen.FallenTreeFeature; +import dev.callmeecho.hollow.main.worldgen.FallenTreeFeatureConfig; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.world.gen.feature.Feature; + +@SuppressWarnings("unused") +public class HollowFeatureRegistry implements Registrar> { + @Override + public Registry> getRegistry() { + return Registries.FEATURE; + } + + public static final Feature FALLEN_TREE = new FallenTreeFeature(FallenTreeFeatureConfig.CODEC); +} diff --git a/src/main/java/dev/callmeecho/hollow/main/registry/HollowItemRegistry.java b/src/main/java/dev/callmeecho/hollow/main/registry/HollowItemRegistry.java index 86520e2..e7887fc 100644 --- a/src/main/java/dev/callmeecho/hollow/main/registry/HollowItemRegistry.java +++ b/src/main/java/dev/callmeecho/hollow/main/registry/HollowItemRegistry.java @@ -3,6 +3,7 @@ import dev.callmeecho.cabinetapi.item.CabinetItemSettings; import dev.callmeecho.cabinetapi.registry.ItemRegistrar; import net.minecraft.item.Item; +import net.minecraft.item.PlaceableOnWaterItem; import net.minecraft.item.SpawnEggItem; import static dev.callmeecho.hollow.main.Hollow.GROUP; @@ -10,4 +11,6 @@ @SuppressWarnings("unused") public class HollowItemRegistry implements ItemRegistrar { public static Item FIREFLY_SPAWN_EGG = new SpawnEggItem(HollowEntityTypeRegistry.FIREFLY, 0x102F4E, 0xCAAF94, new CabinetItemSettings().group(GROUP)); + + public static Item LOTUS_LILYPAD = new PlaceableOnWaterItem(HollowBlockRegistry.LOTUS_LILYPAD, new CabinetItemSettings().group(GROUP)); } diff --git a/src/main/java/dev/callmeecho/hollow/main/registry/HollowTreeDecoratorRegistry.java b/src/main/java/dev/callmeecho/hollow/main/registry/HollowTreeDecoratorRegistry.java new file mode 100644 index 0000000..4e70ab4 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/registry/HollowTreeDecoratorRegistry.java @@ -0,0 +1,17 @@ +package dev.callmeecho.hollow.main.registry; + +import dev.callmeecho.cabinetapi.registry.Registrar; +import dev.callmeecho.hollow.main.worldgen.BranchTreeDecorator; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.world.gen.treedecorator.TreeDecoratorType; + +@SuppressWarnings("unused") +public class HollowTreeDecoratorRegistry implements Registrar> { + @Override + public Registry> getRegistry() { + return Registries.TREE_DECORATOR_TYPE; + } + + public static final TreeDecoratorType BRANCH_TREE_DECORATOR = new TreeDecoratorType<>(BranchTreeDecorator.CODEC); +} diff --git a/src/main/java/dev/callmeecho/hollow/main/worldgen/BranchTreeDecorator.java b/src/main/java/dev/callmeecho/hollow/main/worldgen/BranchTreeDecorator.java new file mode 100644 index 0000000..6bcdf75 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/worldgen/BranchTreeDecorator.java @@ -0,0 +1,79 @@ +package dev.callmeecho.hollow.main.worldgen; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.callmeecho.hollow.main.registry.HollowTreeDecoratorRegistry; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.block.BeehiveBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.state.property.Properties; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.gen.stateprovider.BlockStateProvider; +import net.minecraft.world.gen.treedecorator.TreeDecorator; +import net.minecraft.world.gen.treedecorator.TreeDecoratorType; + +public class BranchTreeDecorator extends TreeDecorator { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + BlockStateProvider.TYPE_CODEC.fieldOf("state_provider").forGetter(decorator -> decorator.stateProvider) + ).apply(instance, BranchTreeDecorator::new)); + + public BranchTreeDecorator(BlockStateProvider stateProvider) { + this.stateProvider = stateProvider; + } + + public final BlockStateProvider stateProvider; + + @Override + protected TreeDecoratorType getType() { + return HollowTreeDecoratorRegistry.BRANCH_TREE_DECORATOR; + } + + @Override + public void generate(Generator generator) { + Random random = generator.getRandom(); + ObjectArrayList logs = generator.getLogPositions(); + + if (random.nextBetween(0, 4) == 0) return; + + + boolean hasBranch = false; + for (BlockPos pos : logs) { + if (hasBranch) break; + if (pos.getY() < (logs.get(0).getY() + logs.get(logs.size() - 1).getY()) / 2) continue; + + Direction direction = Direction.fromHorizontal(random.nextInt(4)); + BlockPos branch = pos.offset(direction); + + if (!generator.isAir(branch)) continue; + + BlockState state = stateProvider.get(random, branch); + if (state.contains(Properties.AXIS)) state = state.with(Properties.AXIS, direction.getAxis()); + generator.replace(branch, state); + hasBranch = true; + + if (random.nextBetween(0, 32) != 0) continue; + + BlockPos beeHive = branch.down(); + if (!generator.isAir(beeHive)) continue; + + Direction hiveDirection = direction; + if (random.nextBoolean()) hiveDirection = random.nextBoolean() ? direction.rotateClockwise(Direction.Axis.Y) : direction.rotateCounterclockwise(Direction.Axis.Y); + + generator.replace(beeHive, Blocks.BEE_NEST.getDefaultState().with(BeehiveBlock.FACING, hiveDirection)); + generator.getWorld().getBlockEntity(beeHive, BlockEntityType.BEEHIVE).ifPresent(beehive -> { + int beeCount = 2 + random.nextInt(2); + + for (int i = 0; i < beeCount; i++) { + NbtCompound nbtCompound = new NbtCompound(); + nbtCompound.putString("id", "minecraft:bee"); + beehive.addBee(nbtCompound, random.nextInt(599), false); + } + }); + } + } +} diff --git a/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeature.java b/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeature.java new file mode 100644 index 0000000..13455b8 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeature.java @@ -0,0 +1,58 @@ +package dev.callmeecho.hollow.main.worldgen; + +import com.mojang.serialization.Codec; +import dev.callmeecho.hollow.main.Hollow; +import dev.callmeecho.hollow.main.block.HollowLogBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.state.property.Properties; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.util.FeatureContext; + +public class FallenTreeFeature extends Feature { + public FallenTreeFeature(Codec configCodec) { + super(configCodec); + } + + @Override + public boolean generate(FeatureContext context) { + BlockPos origin = context.getOrigin(); + Random random = context.getRandom(); + BlockState state = context.getConfig().stateProvider.get(random, origin); + + int size = random.nextBetween(3, 5); + Direction.Axis axis = random.nextBoolean() ? Direction.Axis.X : Direction.Axis.Z; + if (state.contains(Properties.AXIS)) state = state.with(HollowLogBlock.AXIS, axis); + + for (int i = 0; i < 10; i++) { + if (context.getWorld().isAir(origin.down())) { + origin = origin.down(); + } else { + break; + } + } + + boolean canPlace = true; + for (int i = 0; i < size; i++) { + BlockPos pos = origin.offset(axis, i); + canPlace = canPlace && (context.getWorld().isAir(pos) || context.getWorld().getBlockState(pos).isOf(Blocks.GRASS)) && context.getWorld().getBlockState(pos.down()).isSolidBlock(context.getWorld(), pos.down()); + } + + if (!canPlace) return false; + + for (int i = 0; i < size; i++) { + BlockPos pos = origin.offset(axis, i); + context.getWorld().setBlockState(pos, state, 2); + + if (context.getWorld().isAir(pos.up()) && random.nextInt(2) == 0) { + context.getWorld().setBlockState(pos.up(), Blocks.MOSS_CARPET.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeatureConfig.java b/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeatureConfig.java new file mode 100644 index 0000000..567eb92 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/main/worldgen/FallenTreeFeatureConfig.java @@ -0,0 +1,18 @@ +package dev.callmeecho.hollow.main.worldgen; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.world.gen.feature.FeatureConfig; +import net.minecraft.world.gen.stateprovider.BlockStateProvider; + +public class FallenTreeFeatureConfig implements FeatureConfig { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + BlockStateProvider.TYPE_CODEC.fieldOf("state_provider").forGetter(config -> config.stateProvider) + ).apply(instance, FallenTreeFeatureConfig::new)); + + public final BlockStateProvider stateProvider; + + public FallenTreeFeatureConfig(BlockStateProvider stateProvider) { + this.stateProvider = stateProvider; + } +} diff --git a/src/main/java/dev/callmeecho/hollow/mixin/BirchSaplingGeneratorMixin.java b/src/main/java/dev/callmeecho/hollow/mixin/BirchSaplingGeneratorMixin.java new file mode 100644 index 0000000..b78aea7 --- /dev/null +++ b/src/main/java/dev/callmeecho/hollow/mixin/BirchSaplingGeneratorMixin.java @@ -0,0 +1,22 @@ +package dev.callmeecho.hollow.mixin; + +import net.minecraft.block.sapling.BirchSaplingGenerator; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.gen.feature.ConfiguredFeature; +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 static dev.callmeecho.hollow.main.Hollow.MODID; + +@Mixin(BirchSaplingGenerator.class) +public class BirchSaplingGeneratorMixin { + @Inject(method = "getTreeFeature", at = @At("HEAD"), cancellable = true) + protected void getTreeFeature(Random random, boolean bees, CallbackInfoReturnable>> cir) { + cir.setReturnValue(RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(MODID, "birch_bees_0002"))); + } +} diff --git a/src/main/resources/assets/hollow/blockstates/lotus_lilypad.json b/src/main/resources/assets/hollow/blockstates/lotus_lilypad.json new file mode 100644 index 0000000..69003da --- /dev/null +++ b/src/main/resources/assets/hollow/blockstates/lotus_lilypad.json @@ -0,0 +1,21 @@ +{ + "variants": { + "": [ + { + "model": "hollow:block/lotus_lilypad" + }, + { + "model": "hollow:block/lotus_lilypad", + "y": 90 + }, + { + "model": "hollow:block/lotus_lilypad", + "y": 180 + }, + { + "model": "hollow:block/lotus_lilypad", + "y": 270 + } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/hollow/lang/en_us.json b/src/main/resources/assets/hollow/lang/en_us.json index 6cb108d..d8ca3bb 100644 --- a/src/main/resources/assets/hollow/lang/en_us.json +++ b/src/main/resources/assets/hollow/lang/en_us.json @@ -24,6 +24,7 @@ "block.hollow.pink_daisy": "Pink Daisy", "block.hollow.paeonia": "Paeonia", + "block.hollow.lotus_lilypad": "Flowering Lily Pad", "item.hollow.firefly_spawn_egg": "Firefly Spawn Egg" } \ No newline at end of file diff --git a/src/main/resources/assets/hollow/models/block/lotus_lilypad.json b/src/main/resources/assets/hollow/models/block/lotus_lilypad.json new file mode 100644 index 0000000..ba5b7ee --- /dev/null +++ b/src/main/resources/assets/hollow/models/block/lotus_lilypad.json @@ -0,0 +1,87 @@ +{ + "credit": "Made with Blockbench", + "ambientocclusion": false, + "textures": { + "1": "hollow:block/lotus_lilypad", + "particle": "block/lily_pad", + "texture": "block/lily_pad" + }, + "elements": [ + { + "from": [0, 0.25, 0], + "to": [16, 0.25, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0.25, 8]}, + "faces": { + "up": {"uv": [0, 0, 16, 16], "texture": "#texture", "tintindex": 0}, + "down": {"uv": [0, 16, 16, 0], "texture": "#texture", "tintindex": 0} + } + }, + { + "from": [7, 0.5, 7], + "to": [10, 0.5, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [8.5, 0.5, 8.5]}, + "faces": { + "up": {"uv": [0, 6, 3, 9], "texture": "#1"}, + "down": {"uv": [0, 6, 3, 9], "texture": "#1"} + } + }, + { + "from": [8, 0.5, 8.5], + "to": [9, 1.5, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8.5, 1, 8.75]}, + "faces": { + "north": {"uv": [1, 9, 2, 11], "texture": "#1"}, + "east": {"uv": [0, 0, 0, 2], "texture": "#1"}, + "south": {"uv": [1, 9, 2, 11], "texture": "#1"}, + "west": {"uv": [0, 0, 0, 2], "texture": "#1"} + } + }, + { + "from": [8.5, 0.5, 8], + "to": [8.5, 1.5, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8.5, 1, 8.5]}, + "faces": { + "north": {"uv": [0, 0, 0, 2], "texture": "#1"}, + "east": {"uv": [1, 9, 2, 11], "texture": "#1"}, + "south": {"uv": [0, 0, 0, 2], "texture": "#1"}, + "west": {"uv": [1, 9, 2, 11], "texture": "#1"} + } + }, + { + "from": [7, 1.64813, 1.22798], + "to": [10, 1.64813, 7.22798], + "rotation": {"angle": 22.5, "axis": "x", "origin": [8.5, 1.64813, 4.22798]}, + "faces": { + "up": {"uv": [0, 0, 3, 6], "texture": "#1"}, + "down": {"uv": [0, 0, 3, 6], "rotation": 180, "texture": "#1"} + } + }, + { + "from": [1.22798, 1.64813, 7], + "to": [7.22798, 1.64813, 10], + "rotation": {"angle": -22.5, "axis": "z", "origin": [4.22798, 1.64813, 8.5]}, + "faces": { + "up": {"uv": [0, 0, 3, 6], "rotation": 270, "texture": "#1"}, + "down": {"uv": [0, 0, 3, 6], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [7, 1.64813, 9.77202], + "to": [10, 1.64813, 15.77202], + "rotation": {"angle": -22.5, "axis": "x", "origin": [8.5, 1.64813, 12.77202]}, + "faces": { + "up": {"uv": [3, 6, 0, 0], "texture": "#1"}, + "down": {"uv": [3, 0, 0, 6], "texture": "#1"} + } + }, + { + "from": [9.77202, 1.64813, 7], + "to": [15.77202, 1.64813, 10], + "rotation": {"angle": 22.5, "axis": "z", "origin": [12.77202, 1.64813, 8.5]}, + "faces": { + "up": {"uv": [3, 6, 0, 0], "rotation": 270, "texture": "#1"}, + "down": {"uv": [0, 6, 3, 0], "rotation": 270, "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/hollow/models/item/lotus_lilypad.json b/src/main/resources/assets/hollow/models/item/lotus_lilypad.json new file mode 100644 index 0000000..ccb82dd --- /dev/null +++ b/src/main/resources/assets/hollow/models/item/lotus_lilypad.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:block/lily_pad", + "layer1": "hollow:item/lotus_lilypad" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/hollow/textures/block/lotus_lilypad.png b/src/main/resources/assets/hollow/textures/block/lotus_lilypad.png new file mode 100644 index 0000000..30b55df Binary files /dev/null and b/src/main/resources/assets/hollow/textures/block/lotus_lilypad.png differ diff --git a/src/main/resources/assets/hollow/textures/block/moss_overlay.aseprite b/src/main/resources/assets/hollow/textures/block/moss_overlay.aseprite new file mode 100644 index 0000000..eec9fe5 Binary files /dev/null and b/src/main/resources/assets/hollow/textures/block/moss_overlay.aseprite differ diff --git a/src/main/resources/assets/hollow/textures/item/lotus_lilypad.png b/src/main/resources/assets/hollow/textures/item/lotus_lilypad.png new file mode 100644 index 0000000..7eea5f8 Binary files /dev/null and b/src/main/resources/assets/hollow/textures/item/lotus_lilypad.png differ diff --git a/src/main/resources/data/hollow/loot_tables/entities/firefly.json b/src/main/resources/data/hollow/loot_tables/entities/firefly.json new file mode 100644 index 0000000..19c74de --- /dev/null +++ b/src/main/resources/data/hollow/loot_tables/entities/firefly.json @@ -0,0 +1,87 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:damage_source_properties", + "predicate": { + "source_entity": { + "type": "minecraft:frog", + "type_specific": { + "type": "frog", + "variant": "minecraft:warm" + } + } + } + } + ], + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:pearlescent_froglight" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:damage_source_properties", + "predicate": { + "source_entity": { + "type": "minecraft:frog", + "type_specific": { + "type": "frog", + "variant": "minecraft:cold" + } + } + } + } + ], + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:verdant_froglight" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:damage_source_properties", + "predicate": { + "source_entity": { + "type": "minecraft:frog", + "type_specific": { + "type": "frog", + "variant": "minecraft:temperate" + } + } + } + } + ], + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:ochre_froglight" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "hollow:entities/firefly" +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/birch_bees_0002.json b/src/main/resources/data/hollow/worldgen/configured_feature/birch_bees_0002.json new file mode 100644 index 0000000..859ff39 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/birch_bees_0002.json @@ -0,0 +1,62 @@ +{ + "type": "minecraft:tree", + "config": { + "decorators": [ + { + "type": "hollow:branch_tree_decorator", + "state_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_log" + } + } + } + ], + "dirt_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:dirt" + } + }, + "foliage_placer": { + "type": "minecraft:blob_foliage_placer", + "height": 3, + "offset": 0, + "radius": 2 + }, + "foliage_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_leaves", + "Properties": { + "distance": "7", + "persistent": "false", + "waterlogged": "false" + } + } + }, + "force_dirt": false, + "ignore_vines": true, + "minimum_size": { + "type": "minecraft:two_layers_feature_size", + "limit": 1, + "lower_size": 0, + "upper_size": 1 + }, + "trunk_placer": { + "type": "minecraft:straight_trunk_placer", + "base_height": 8, + "height_rand_a": 5, + "height_rand_b": 0 + }, + "trunk_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_log", + "Properties": { + "axis": "y" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/birch_tall.json b/src/main/resources/data/hollow/worldgen/configured_feature/birch_tall.json new file mode 100644 index 0000000..c01763d --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/birch_tall.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:random_selector", + "config": { + "default": "hollow:birch_bees_0002", + "features": [ + { + "chance": 0.5, + "feature": "hollow:super_birch_bees_0002" + } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/fallen_birch.json b/src/main/resources/data/hollow/worldgen/configured_feature/fallen_birch.json new file mode 100644 index 0000000..8a8f74e --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/fallen_birch.json @@ -0,0 +1,11 @@ +{ + "type": "hollow:fallen_tree", + "config": { + "state_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "hollow:birch_hollow_log" + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/patch_lilac.json b/src/main/resources/data/hollow/worldgen/configured_feature/patch_lilac.json new file mode 100644 index 0000000..7dc954f --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/patch_lilac.json @@ -0,0 +1,37 @@ +{ + "type": "minecraft:random_patch", + "config": { + "feature": { + "feature": { + "type": "minecraft:simple_block", + "config": { + "to_place": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:lilac", + "Properties": { + "half": "lower" + } + } + } + } + }, + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:all_of", + "predicates": [ + { + "type": "minecraft:matching_blocks", + "blocks": "minecraft:air" + } + ] + } + } + ] + }, + "tries": 10, + "xz_spread": 7 + } +} diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/patch_waterlily.json b/src/main/resources/data/hollow/worldgen/configured_feature/patch_waterlily.json new file mode 100644 index 0000000..df73e78 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/patch_waterlily.json @@ -0,0 +1,41 @@ +{ + "type": "minecraft:random_patch", + "config": { + "tries": 10, + "xz_spread": 7, + "y_spread": 3, + "feature": { + "feature": { + "type": "minecraft:simple_block", + "config": { + "to_place": { + "type": "minecraft:weighted_state_provider", + "entries": [ + { + "weight": 4, + "data": { + "Name": "minecraft:lily_pad" + } + }, + { + "weight": 1, + "data": { + "Name": "hollow:lotus_lilypad" + } + } + ] + } + } + }, + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:matching_blocks", + "blocks": "minecraft:air" + } + } + ] + } + } +} diff --git a/src/main/resources/data/hollow/worldgen/configured_feature/super_birch_bees_0002.json b/src/main/resources/data/hollow/worldgen/configured_feature/super_birch_bees_0002.json new file mode 100644 index 0000000..ab9e617 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/configured_feature/super_birch_bees_0002.json @@ -0,0 +1,62 @@ +{ + "type": "minecraft:tree", + "config": { + "decorators": [ + { + "type": "hollow:branch_tree_decorator", + "state_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_log" + } + } + } + ], + "dirt_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:dirt" + } + }, + "foliage_placer": { + "type": "minecraft:blob_foliage_placer", + "height": 3, + "offset": 0, + "radius": 2 + }, + "foliage_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_leaves", + "Properties": { + "distance": "7", + "persistent": "false", + "waterlogged": "false" + } + } + }, + "force_dirt": false, + "ignore_vines": true, + "minimum_size": { + "type": "minecraft:two_layers_feature_size", + "limit": 1, + "lower_size": 0, + "upper_size": 1 + }, + "trunk_placer": { + "type": "minecraft:straight_trunk_placer", + "base_height": 8, + "height_rand_a": 5, + "height_rand_b": 6 + }, + "trunk_provider": { + "type": "minecraft:simple_state_provider", + "state": { + "Name": "minecraft:birch_log", + "Properties": { + "axis": "y" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/birch_bees_0002.json b/src/main/resources/data/hollow/worldgen/placed_feature/birch_bees_0002.json new file mode 100644 index 0000000..4e9abbf --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/birch_bees_0002.json @@ -0,0 +1,17 @@ +{ + "feature": "hollow:birch_bees_0002", + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "minecraft:birch_sapling", + "Properties": { + "stage": "0" + } + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/birch_tall.json b/src/main/resources/data/hollow/worldgen/placed_feature/birch_tall.json new file mode 100644 index 0000000..0a37165 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/birch_tall.json @@ -0,0 +1,35 @@ +{ + "feature": "hollow:birch_tall", + "placement": [ + { + "type": "minecraft:count", + "count": { + "type": "minecraft:weighted_list", + "distribution": [ + { + "data": 10, + "weight": 9 + }, + { + "data": 11, + "weight": 1 + } + ] + } + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:surface_water_depth_filter", + "max_water_depth": 0 + }, + { + "type": "minecraft:heightmap", + "heightmap": "OCEAN_FLOOR" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/fallen_birch.json b/src/main/resources/data/hollow/worldgen/placed_feature/fallen_birch.json new file mode 100644 index 0000000..6f97a37 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/fallen_birch.json @@ -0,0 +1,28 @@ +{ + "feature": "hollow:fallen_birch", + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "hollow:birch_hollow_log" + } + } + }, + { + "type": "minecraft:count", + "count": 1 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "WORLD_SURFACE_WG" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/patch_lilac_birch.json b/src/main/resources/data/hollow/worldgen/placed_feature/patch_lilac_birch.json new file mode 100644 index 0000000..30d2ba3 --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/patch_lilac_birch.json @@ -0,0 +1,23 @@ +{ + "feature": "hollow:patch_lilac", + "placement": [ + { + "type": "minecraft:count", + "count": 10 + }, + { + "type": "minecraft:rarity_filter", + "chance": 2 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "MOTION_BLOCKING" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/patch_waterlily.json b/src/main/resources/data/hollow/worldgen/placed_feature/patch_waterlily.json new file mode 100644 index 0000000..ecc7a9a --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/patch_waterlily.json @@ -0,0 +1,19 @@ +{ + "feature": "hollow:patch_waterlily", + "placement": [ + { + "type": "minecraft:count", + "count": 4 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "WORLD_SURFACE_WG" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/super_birch_bees_0002.json b/src/main/resources/data/hollow/worldgen/placed_feature/super_birch_bees_0002.json new file mode 100644 index 0000000..33ea79f --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/super_birch_bees_0002.json @@ -0,0 +1,17 @@ +{ + "feature": "hollow:super_birch_bees_0002", + "placement": [ + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "minecraft:birch_sapling", + "Properties": { + "stage": "0" + } + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/hollow/worldgen/placed_feature/trees_birch.json b/src/main/resources/data/hollow/worldgen/placed_feature/trees_birch.json new file mode 100644 index 0000000..9a54c7c --- /dev/null +++ b/src/main/resources/data/hollow/worldgen/placed_feature/trees_birch.json @@ -0,0 +1,47 @@ +{ + "feature": "hollow:birch_bees_0002", + "placement": [ + { + "type": "minecraft:count", + "count": { + "type": "minecraft:weighted_list", + "distribution": [ + { + "data": 10, + "weight": 9 + }, + { + "data": 11, + "weight": 1 + } + ] + } + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:surface_water_depth_filter", + "max_water_depth": 0 + }, + { + "type": "minecraft:heightmap", + "heightmap": "OCEAN_FLOOR" + }, + { + "type": "minecraft:biome" + }, + { + "type": "minecraft:block_predicate_filter", + "predicate": { + "type": "minecraft:would_survive", + "state": { + "Name": "minecraft:birch_sapling", + "Properties": { + "stage": "0" + } + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/hollow.mixins.json b/src/main/resources/hollow.mixins.json index b22e92a..2578d47 100644 --- a/src/main/resources/hollow.mixins.json +++ b/src/main/resources/hollow.mixins.json @@ -4,7 +4,7 @@ "package": "dev.callmeecho.hollow.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - + "BirchSaplingGeneratorMixin" ], "client": [ ],