From 89cff4ca48314a7b48d0a40801a19c034e5d082c Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Tue, 27 May 2025 10:13:53 -0500 Subject: [PATCH 1/7] fixed tetures for the block of dust and window blocks --- gradle.properties | 2 +- .../resources/assets/hdm_mod/blockstates/block_of_dust.json | 4 +++- src/main/resources/assets/hdm_mod/blockstates/window.json | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 635380c..99d1277 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=Hdm Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.2.1 +mod_version=1.2.2 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/resources/assets/hdm_mod/blockstates/block_of_dust.json b/src/main/resources/assets/hdm_mod/blockstates/block_of_dust.json index 7f816ed..2e143c2 100644 --- a/src/main/resources/assets/hdm_mod/blockstates/block_of_dust.json +++ b/src/main/resources/assets/hdm_mod/blockstates/block_of_dust.json @@ -1,5 +1,7 @@ { "variants": { - "main": {"model": "hdm_mod:block/block_of_dust" } + "":[ + {"model": "hdm_mod:block/block_of_dust" } + ] } } \ No newline at end of file diff --git a/src/main/resources/assets/hdm_mod/blockstates/window.json b/src/main/resources/assets/hdm_mod/blockstates/window.json index 5bd80c6..5741ab8 100644 --- a/src/main/resources/assets/hdm_mod/blockstates/window.json +++ b/src/main/resources/assets/hdm_mod/blockstates/window.json @@ -1,5 +1,7 @@ { "variants": { - "main": {"model": "hdm_mod:block/window" } + "": [ + {"model": "hdm_mod:block/window" } + ] } } \ No newline at end of file From 059f2d881bddc1091edf8f98540a74636e209ec7 Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Wed, 28 May 2025 11:14:13 -0500 Subject: [PATCH 2/7] Add cooked omelet item, recipe, and HDM dimension support Introduced the cooked omelet item with functionality and crafting recipe. Added recognition for the "HDM Dimension" in teleportation logic. Updated gradle settings to enable daemon for faster builds. Signed-off-by: dragonruler1000 --- gradle.properties | 2 +- .../us/minecraftchest2/hdm_mod/Hdm_mod.java | 4 ++++ .../hdm_mod/block/ModBlocks.java | 1 + .../hdm_mod/item/ModItems.java | 13 ++++++++--- .../world/dimension/SimpleTeleporter.java | 3 +++ .../resources/assets/hdm_mod/lang/en_us.json | 1 + .../hdm_mod/models/item/omelet-cooked.json | 6 +++++ .../data/hdm_mod/recipes/omelet.json | 23 +++++++++++++++++++ 8 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/assets/hdm_mod/models/item/omelet-cooked.json create mode 100644 src/main/resources/data/hdm_mod/recipes/omelet.json diff --git a/gradle.properties b/gradle.properties index 99d1277..6d71518 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false +org.gradle.daemon=true # The Minecraft version must agree with the Forge version to get a valid artifact minecraft_version=1.16.5 # The Minecraft version range can use any release version of Minecraft as bounds. diff --git a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java index 1a2092e..9a829ce 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java @@ -2,6 +2,8 @@ package us.minecraftchest2.hdm_mod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.IEventBus; @@ -66,6 +68,8 @@ public class Hdm_mod { private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client + event.enqueueWork(() -> { + }); } private void enqueueIMC(final InterModEnqueueEvent event) { diff --git a/src/main/java/us/minecraftchest2/hdm_mod/block/ModBlocks.java b/src/main/java/us/minecraftchest2/hdm_mod/block/ModBlocks.java index 5c7d76f..6849074 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/block/ModBlocks.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/block/ModBlocks.java @@ -3,6 +3,7 @@ package us.minecraftchest2.hdm_mod.block; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; diff --git a/src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java b/src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java index f7b0f54..21d7357 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java @@ -1,11 +1,17 @@ package us.minecraftchest2.hdm_mod.item; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Food; import net.minecraft.item.Item; +import net.minecraft.potion.Effect; +import net.minecraft.potion.EffectInstance; +import net.minecraft.potion.Effects; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import us.minecraftchest2.hdm_mod.Hdm_mod; +import us.minecraftchest2.hdm_mod.block.ModBlocks; import us.minecraftchest2.hdm_mod.item.custom.SubtleKnife; public class ModItems { @@ -18,12 +24,13 @@ public class ModItems { public static final RegistryObject OMELET = ITEMS.register("omelet", - () -> new Item(new Item.Properties().group(ModItemGroup.HDM_ITEM_GROUP))); + () -> new Item(new Item.Properties().food(new Food.Builder().hunger(5).fastToEat().saturation(20) + .effect(() -> new EffectInstance(Effects.HUNGER, 40, 4), 0.75f).build()).group(ModItemGroup.HDM_ITEM_GROUP))); public static final RegistryObject KNIFE = ITEMS.register("subtle_knife", () -> new SubtleKnife(new Item.Properties().maxStackSize(1).group(ModItemGroup.HDM_ITEM_GROUP).maxDamage(2000))); - - + public static final RegistryObject OMELET_COOKED = ITEMS.register("omelet-cooked", + () -> new Item(new Item.Properties().food(new Food.Builder().hunger(5).fastToEat().saturation(20).build()).group(ModItemGroup.HDM_ITEM_GROUP))); public static void register(IEventBus eventBus) { ITEMS.register(eventBus); diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/dimension/SimpleTeleporter.java b/src/main/java/us/minecraftchest2/hdm_mod/world/dimension/SimpleTeleporter.java index 2579e20..9337c1f 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/world/dimension/SimpleTeleporter.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/dimension/SimpleTeleporter.java @@ -132,6 +132,9 @@ public class SimpleTeleporter implements ITeleporter { case "the_end": dimensionName = "the End"; break; + case "hdm_dimension": + dimensionName = "HDM Dimension"; + break; default: dimensionName = path.replace('_', ' '); dimensionName = dimensionName.substring(0, 1).toUpperCase() + dimensionName.substring(1); diff --git a/src/main/resources/assets/hdm_mod/lang/en_us.json b/src/main/resources/assets/hdm_mod/lang/en_us.json index efdaf9b..30eb76e 100644 --- a/src/main/resources/assets/hdm_mod/lang/en_us.json +++ b/src/main/resources/assets/hdm_mod/lang/en_us.json @@ -4,6 +4,7 @@ "item.hdm_mod.subtle_knife": "Subtle Knife", "item.hdm_mod.omelet": "Omelet", + "item.hdm_mod.omelet-cooked": "Omelet", "item.hdm_mod.dust": "Dust", "block.hdm_mod.block_of_dust": "Block of Dust", "block.hdm_mod.window": "Window" diff --git a/src/main/resources/assets/hdm_mod/models/item/omelet-cooked.json b/src/main/resources/assets/hdm_mod/models/item/omelet-cooked.json new file mode 100644 index 0000000..2dccee3 --- /dev/null +++ b/src/main/resources/assets/hdm_mod/models/item/omelet-cooked.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "hdm_mod:item/omelet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/hdm_mod/recipes/omelet.json b/src/main/resources/data/hdm_mod/recipes/omelet.json new file mode 100644 index 0000000..491aaec --- /dev/null +++ b/src/main/resources/data/hdm_mod/recipes/omelet.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "#B", + "E " + ], + "key": { + "#": { + "item": "minecraft:porkchop" + }, + "B": { + "item": "minecraft:brown_mushroom" + }, + "E": { + "item": "minecraft:egg" + } + }, + "result": { + "item": "hdm_mod:omelet", + "count": 1 + }, + "group": "omelets" +} \ No newline at end of file From 15b1027f9bccf8021501a6b9534ecd5f23d184ac Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Wed, 28 May 2025 11:15:15 -0500 Subject: [PATCH 3/7] Add smelting recipe for cooked omelet to the mod Signed-off-by: dragonruler1000 --- .../resources/data/hdm_mod/recipes/omelet_cooked.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/resources/data/hdm_mod/recipes/omelet_cooked.json diff --git a/src/main/resources/data/hdm_mod/recipes/omelet_cooked.json b/src/main/resources/data/hdm_mod/recipes/omelet_cooked.json new file mode 100644 index 0000000..1a11c97 --- /dev/null +++ b/src/main/resources/data/hdm_mod/recipes/omelet_cooked.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:smelting", + "category": "food", + "ingredient": { + "item": "hdm_mod:omelet" + }, + "result": "hdm_mod:omelet-cooked", + "experience": 1, + "cookingtime": 200, + "group": "omelets" +} \ No newline at end of file From bcd5a4081351e2f43ee52119e7ed0c2c1c8ad335 Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Wed, 28 May 2025 12:29:12 -0500 Subject: [PATCH 4/7] Introduce custom DustHouse structure and update mod configuration Added a new DustHouse structure with associated registration logic and configuration settings. Updated `gradle.properties`, introduced `accesstransformer.cfg`, and added JSON and NBT files for structure generation. Fixed typo in gradle daemon setting. Signed-off-by: dragonruler1000 --- gradle.properties | 2 +- .../us/minecraftchest2/hdm_mod/Hdm_mod.java | 3 + .../world/structure/ModStructures.java | 113 ++++++++++++++++++ .../structures/DustHouseStructure.java | 90 ++++++++++++++ .../resources/META-INF/accesstransformer.cfg | 4 + .../data/hdm_mod/structures/dust_house.nbt | Bin 0 -> 1465 bytes .../template_pool/house/start_pool.json | 15 +++ 7 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java create mode 100644 src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java create mode 100644 src/main/resources/META-INF/accesstransformer.cfg create mode 100644 src/main/resources/data/hdm_mod/structures/dust_house.nbt create mode 100644 src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json diff --git a/gradle.properties b/gradle.properties index 6d71518..dd48fb0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=true +org.gradle.daemon=flase # The Minecraft version must agree with the Forge version to get a valid artifact minecraft_version=1.16.5 # The Minecraft version range can use any release version of Minecraft as bounds. diff --git a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java index 9a829ce..4032970 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java @@ -22,6 +22,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import us.minecraftchest2.hdm_mod.block.ModBlocks; import us.minecraftchest2.hdm_mod.item.ModItems; +import us.minecraftchest2.hdm_mod.world.structure.ModStructures; //import us.minecraftchest2.hdm_mod.init.ItemInit; import java.util.stream.Collectors; @@ -41,6 +42,8 @@ public class Hdm_mod { ModItems.register(modEventBus1); ModBlocks.register(modEventBus1); + ModStructures.register(modEventBus1); + modEventBus1.addListener(this::setup); // Register the enqueueIMC method for modloading modEventBus1.addListener(this::enqueueIMC); diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java new file mode 100644 index 0000000..415c9bd --- /dev/null +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java @@ -0,0 +1,113 @@ +package us.minecraftchest2.hdm_mod.world.structure; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import net.minecraft.util.registry.WorldGenRegistries; +import net.minecraft.world.gen.feature.NoFeatureConfig; +import net.minecraft.world.gen.feature.structure.Structure; +import net.minecraft.world.gen.settings.DimensionStructuresSettings; +import net.minecraft.world.gen.settings.StructureSeparationSettings; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import us.minecraftchest2.hdm_mod.Hdm_mod; +import us.minecraftchest2.hdm_mod.world.structure.structures.DustHouseStructure; + +import java.util.HashMap; +import java.util.Map; + +public class ModStructures { + public static final DeferredRegister> STRUCTURES = + DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Hdm_mod.MOD_ID); + + public static final RegistryObject> HOUSE = + STRUCTURES.register("house", DustHouseStructure::new); + + /* average distance apart in chunks between spawn attempts */ + /* minimum distance apart in chunks between spawn attempts. MUST BE LESS THAN ABOVE VALUE*/ + /* this modifies the seed of the structure so no two structures always spawn over each-other. + Make this large and unique. */ + public static void setupStructures() { + setupMapSpacingAndLand(HOUSE.get(), + new StructureSeparationSettings(100,50, 1234567890), + true); + } + + /** + * Adds the provided structure to the registry, and adds the separation settings. + * The rarity of the structure is determined based on the values passed into + * this method in the structureSeparationSettings argument. + * This method is called by setupStructures above. + **/ + public static > void setupMapSpacingAndLand(F structure, StructureSeparationSettings structureSeparationSettings, + boolean transformSurroundingLand) { + //add our structures into the map in Structure class + Structure.NAME_STRUCTURE_BIMAP.put(structure.getRegistryName().toString(), structure); + + /* + * Whether surrounding land will be modified automatically to conform to the bottom of the structure. + * Basically, it adds land at the base of the structure like it does for Villages and Outposts. + * Doesn't work well on structure that have pieces stacked vertically or change in heights. + * + */ + if (transformSurroundingLand) { + Structure.field_236384_t_ = ImmutableList.>builder() + .addAll(Structure.field_236384_t_) + .add(structure) + .build(); + } + + /* + * This is the map that holds the default spacing of all structures. + * Always add your structure to here so that other mods can utilize it if needed. + * + * However, while it does propagate the spacing to some correct dimensions from this map, + * it seems it doesn't always work for code made dimensions as they read from this list beforehand. + * + * Instead, we will use the WorldEvent.Load event in ModWorldEvents to add the structure + * spacing from this list into that dimension or to do dimension blacklisting properly. + * We also use our entry in DimensionStructuresSettings.DEFAULTS in WorldEvent.Load as well. + * + * DEFAULTS requires AccessTransformer (See resources/META-INF/accesstransformer.cfg) + */ + DimensionStructuresSettings.field_236191_b_ = + ImmutableMap., StructureSeparationSettings>builder() + .putAll(DimensionStructuresSettings.field_236191_b_) + .put(structure, structureSeparationSettings) + .build(); + + /* + * There are very few mods that relies on seeing your structure in the + * noise settings registry before the world is made. + * + * You may see some mods add their spacings to DimensionSettings.BUILTIN_OVERWORLD instead of the + * NOISE_GENERATOR_SETTINGS loop below but that field only applies for the default overworld and + * won't add to other worldtypes or dimensions (like amplified or Nether). + * So yeah, don't do DimensionSettings.BUILTIN_OVERWORLD. Use the NOISE_GENERATOR_SETTINGS loop + * below instead if you must. + */ + WorldGenRegistries.NOISE_SETTINGS.getEntries().forEach(settings -> { + Map, StructureSeparationSettings> structureMap = + settings.getValue().getStructures().func_236195_a_(); + /* + * Pre-caution in case a mod makes the structure map immutable like datapacks do. + * I take no chances myself. You never know what another mods does... + * + * structureConfig requires AccessTransformer (See resources/META-INF/accesstransformer.cfg) + */ + if (structureMap instanceof ImmutableMap) { + Map, StructureSeparationSettings> tempMap = new HashMap<>(structureMap); + tempMap.put(structure, structureSeparationSettings); + settings.getValue().getStructures().func_236195_a_(); + + } else { + structureMap.put(structure, structureSeparationSettings); + } + }); + } + + public static void register(IEventBus eventBus) { + STRUCTURES.register(eventBus); + } +} \ No newline at end of file diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java new file mode 100644 index 0000000..64a5cb0 --- /dev/null +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java @@ -0,0 +1,90 @@ +package us.minecraftchest2.hdm_mod.world.structure.structures; + +import net.minecraft.block.BlockState; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SharedSeedRandom; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.MutableBoundingBox; +import net.minecraft.util.registry.DynamicRegistries; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.provider.BiomeProvider; +import net.minecraft.world.gen.ChunkGenerator; +import net.minecraft.world.gen.GenerationStage; +import net.minecraft.world.gen.Heightmap; +import net.minecraft.world.gen.feature.NoFeatureConfig; +import net.minecraft.world.gen.feature.jigsaw.JigsawManager; +import net.minecraft.world.gen.feature.structure.AbstractVillagePiece; +import net.minecraft.world.gen.feature.structure.Structure; +import net.minecraft.world.gen.feature.structure.StructureStart; +import net.minecraft.world.gen.feature.structure.VillageConfig; +import net.minecraft.world.gen.feature.template.TemplateManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import us.minecraftchest2.hdm_mod.Hdm_mod; + +public class DustHouseStructure extends Structure { + public DustHouseStructure() { + super(NoFeatureConfig.CODEC); + } + + @Override + public GenerationStage.Decoration getDecorationStage() { + return GenerationStage.Decoration.SURFACE_STRUCTURES; + } + + @Override + protected boolean func_230363_a_(ChunkGenerator chunkGenerator, BiomeProvider biomeSource, + long seed, SharedSeedRandom chunkRandom, int chunkX, int chunkZ, + Biome biome, ChunkPos chunkPos, NoFeatureConfig featureConfig) { + BlockPos centerOfChunk = new BlockPos((chunkX << 4) + 7, 0, (chunkZ << 4) + 7); + int landHeight = chunkGenerator.getHeight(centerOfChunk.getX(), centerOfChunk.getZ(), + Heightmap.Type.WORLD_SURFACE_WG); + + IBlockReader columnOfBlocks = chunkGenerator.func_230348_a_(centerOfChunk.getX(), centerOfChunk.getZ()); + BlockState topBlock = columnOfBlocks.getBlockState(centerOfChunk.up(landHeight)); + + return topBlock.getFluidState().isEmpty(); + } + + @Override + public IStartFactory getStartFactory() { + return DustHouseStructure.Start::new; + } + + public static class Start extends StructureStart { + public Start(Structure structureIn, int chunkX, int chunkZ, + MutableBoundingBox mutableBoundingBox, int referenceIn, long seedIn) { + super(structureIn, chunkX, chunkZ, mutableBoundingBox, referenceIn, seedIn); + } + + @Override // generatePieces + public void func_230364_a_(DynamicRegistries dynamicRegistryManager, ChunkGenerator chunkGenerator, + TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn, + NoFeatureConfig config) { + // Turns the chunk coordinates into actual coordinates we can use. (Gets center of that chunk) + int x = (chunkX << 4) + 7; + int z = (chunkZ << 4) + 7; + BlockPos blockpos = new BlockPos(x, 0, z); + + //addpieces() + JigsawManager.func_242837_a(dynamicRegistryManager, + new VillageConfig(() -> dynamicRegistryManager.getRegistry(Registry.JIGSAW_POOL_KEY) + .getOrDefault(new ResourceLocation(Hdm_mod.MOD_ID, "house/start_pool")), + 10), AbstractVillagePiece::new, chunkGenerator, templateManagerIn, + blockpos, this.components, this.rand,false,true); + + this.components.forEach(piece -> piece.offset(0, 1, 0)); + this.components.forEach(piece -> piece.getBoundingBox().minY -= 1); + + this.recalculateStructureSize(); + + LogManager.getLogger().log(Level.DEBUG, "House at " + + this.components.get(0).getBoundingBox().minX + " " + + this.components.get(0).getBoundingBox().minY + " " + + this.components.get(0).getBoundingBox().minZ); + } + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg new file mode 100644 index 0000000..b134280 --- /dev/null +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -0,0 +1,4 @@ +public-f net.minecraft.world.gen.feature.structure.Structure field_236384_t_ #LAND_TRANSFORMING_STRUCTURES +public-f net.minecraft.world.gen.settings.DimensionStructuresSettings field_236191_b_ #DEFAULT_STRUCTURE_CONFIGS +public-f net.minecraft.world.gen.FlatGenerationSettings field_202247_j #STRUCTURES +public-f net.minecraft.world.gen.settings.DimensionStructuresSettings field_236193_d_ #structures \ No newline at end of file diff --git a/src/main/resources/data/hdm_mod/structures/dust_house.nbt b/src/main/resources/data/hdm_mod/structures/dust_house.nbt new file mode 100644 index 0000000000000000000000000000000000000000..049ae74de81a1370a9a09e9a4fcab36d97f71854 GIT binary patch literal 1465 zcmb2|=3sz;qqBYUZ@WpfO#kh9)3;f!OYE|?qh!jy_bNl_;d#7Av z>WNBr-6ku6o{0YT-#yc3KV{ojocHii<@a>yImOejCsizc7^)w0SMFEr{_OMT_U@Y~ z|LyLpmo?90w#M!#cysQ@ve)hfFYlPw{{AK#?4xQBmvD$T_^d%-!lZ(=ItHx&@Pwz6pHR`J36oprC_NETTrO60 zV8c(IwzKI5jtPsv=75Z=ld+S|b}Fc`Wl8?~Th8t88N(bP^Q~~x=I@*bZ~kUkJ>ToZ zN2fmVqNWMLEps%UxG1V~T6&&1>EtI?)HNZvWlq!yMxgRFznOZr`fqs0ZE(%*;4b|G z5x-k3UZrQ{cAmSZ?sEKks6kFF>)~sm2G{D8t*ZA6&fR-|12Fi`sUFx+Y!7tLjh(y_ zWqMp~w&l$mzXgWb149vkZtP?Mg?M&-##dk{GPljW9do@(u^q@d3y#Zc`>wwNr-9i> znt%qZ`Mc*TJi7QL%HFYqbbn<&R^_)5WV!1>U$d!2 zOtuY=0>vBREfgywN^uus!*laCPU$$e5Xldk(NPb}~(7Q4>DK9T)fEQ`2UNSPgs8K>PN{pGRbQ{ zKmK^e@S2sqUGv;1V_kjyipqnhA+`gpYI-2b0<%5vLswI{2+Ve%Rh)62aNAke>r|w| zZ5Q0r^&pf5YJ1#|{ga~C@0L6k^}P8ZD}+>=Z1|gV{mRm-pJ1L;-?QwR&uN4wfi@#~ z5@<8BCpl3(sZ%kPbN$C#L2wIG553O&AUsu-7TbEy3zxaZ!%^UXacNgNc{=B^+ zd;9WJ@$#(c+jbvLe*I|Q-7kmB^Jf1&wzT&9rFpLoKKryYcK4RdZ_l@tRbF1hcIW6e z%lH?H&pv#6_H~o}of~G$m#1F0(Y+p9K5J)z)mypk@jp*7*zI9Ho0sSCKj+csk3Z~9 zKZdTWnJaz!>*r59qwA~w_O4Cc9=Xn*e{zkD>`}pydukp98zy4k?WB4um rk9hg{{d{$QGtWF{EB{}7*?j-@<)7DC^SnOn|4#o|)b`9xW(*7f{Mgav literal 0 HcmV?d00001 diff --git a/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json b/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json new file mode 100644 index 0000000..1fd8cd4 --- /dev/null +++ b/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json @@ -0,0 +1,15 @@ +{ + "name": "tutorialmod:house/start_pool", + "fallback": "minecraft:empty", + "elements": [ + { + "weight": 1, + "element": { + "location": "tutorialmod:house", + "processors": "minecraft:empty", + "projection": "rigid", + "element_type": "minecraft:single_pool_element" + } + } + ] +} \ No newline at end of file From 5a27c4ab2e1666822dc5bace1b0ce24549cd035f Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Wed, 28 May 2025 17:43:08 -0500 Subject: [PATCH 5/7] Introduce dimensional event handling and improve loot table configuration Added `ModWorldEvents` class to manage custom dimensional events and ensure proper spacing in server world generation. Enhanced block_of_dust loot table with weighted drop chances and refined access transformer configuration in `build.gradle`. Integrated structure setup initialization in pre-loading event. Signed-off-by: dragonruler1000 --- build.gradle | 1 + .../us/minecraftchest2/hdm_mod/Hdm_mod.java | 4 +++ .../hdm_mod/world/ModWorldEvents.java | 31 +++++++++++++++++++ .../loot_tables/blocks/block_of_dust.json | 6 ++-- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java diff --git a/build.gradle b/build.gradle index a0ab1e4..816dfc4 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ minecraft { // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. // In most cases, it is not necessary to enable. diff --git a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java index 4032970..d9e4bea 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/Hdm_mod.java @@ -67,6 +67,10 @@ public class Hdm_mod { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + + event.enqueueWork(() ->{ + ModStructures.setupStructures(); + }); } private void doClientStuff(final FMLClientSetupEvent event) { diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java b/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java new file mode 100644 index 0000000..5497ffe --- /dev/null +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java @@ -0,0 +1,31 @@ +package us.minecraftchest2.hdm_mod.world; + +import com.mojang.serialization.Codec; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.gen.ChunkGenerator; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import us.minecraftchest2.hdm_mod.Hdm_mod; + +import java.lang.reflect.Method; + +@Mod.EventBusSubscriber(modid = Hdm_mod.MOD_ID) +public class ModWorldEvents { + @SubscribeEvent + public static void addDimensinalSpacing(final WorldEvent.Load event) { + if(event.getWorld() instanceof ServerWorld) { + ServerWorld serverWorld = (ServerWorld) event.getWorld(); + + try { + Method GETCODEC_METHOD = + ObfuscationReflectionHelper.findMethod(ChunkGenerator.class, "func_230347_a_"); + ResourceLocation cgRL = Registry.CHUNK_GENERATOR_CODEC.getKey( + (Codec)GETCODEC_METHOD.invoke(serverWorld.getChunkProvider().generator)); + } + } + } +} diff --git a/src/main/resources/data/hdm_mod/loot_tables/blocks/block_of_dust.json b/src/main/resources/data/hdm_mod/loot_tables/blocks/block_of_dust.json index 3424ef6..a333168 100644 --- a/src/main/resources/data/hdm_mod/loot_tables/blocks/block_of_dust.json +++ b/src/main/resources/data/hdm_mod/loot_tables/blocks/block_of_dust.json @@ -3,10 +3,12 @@ "pools": [ { "rolls": 1, - "entries":[ + "entries": [ { "type": "minecraft:item", - "name": "hdm_mod:dust" + "name": "hdm_mod:dust", + "weight": 4, + "quality": 9 } ] } From 3085bd5d920416724c0b891d5089f34e1f748cf7 Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Thu, 26 Jun 2025 20:19:03 -0500 Subject: [PATCH 6/7] Update mod version to 1.2.3, rename DustHouseStructure to HouseStructure, and implement structure generation for plains biomes. Updated textures for the subtle knife and omelet items and the house structure should now generate. Signed-off-by: dragonruler1000 --- gradle.properties | 2 +- .../hdm_mod/item/custom/StructureLocator.java | 51 ++++++++++++++++++ .../hdm_mod/world/ModWorldEvents.java | 2 + .../world/gen/ModStructureGeneration.java | 27 ++++++++++ .../world/structure/ModStructures.java | 4 +- ...ouseStructure.java => HouseStructure.java} | 8 +-- .../assets/hdm_mod/textures/item/knife.png | Bin 108 -> 308 bytes .../assets/hdm_mod/textures/item/omelet.png | Bin 136 -> 230 bytes .../template_pool/house/start_pool.json | 4 +- 9 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 src/main/java/us/minecraftchest2/hdm_mod/item/custom/StructureLocator.java create mode 100644 src/main/java/us/minecraftchest2/hdm_mod/world/gen/ModStructureGeneration.java rename src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/{DustHouseStructure.java => HouseStructure.java} (96%) diff --git a/gradle.properties b/gradle.properties index dd48fb0..0213130 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=Hdm Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.2.2 +mod_version=1.2.3 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/us/minecraftchest2/hdm_mod/item/custom/StructureLocator.java b/src/main/java/us/minecraftchest2/hdm_mod/item/custom/StructureLocator.java new file mode 100644 index 0000000..bab98f8 --- /dev/null +++ b/src/main/java/us/minecraftchest2/hdm_mod/item/custom/StructureLocator.java @@ -0,0 +1,51 @@ +//package us.minecraftchest2.hdm_mod.item.custom; +// +//import net.minecraft.entity.player.PlayerEntity; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemStack; +//import net.minecraft.util.*; +//import net.minecraft.util.text.StringTextComponent; +//import net.minecraft.world.World; +//import net.minecraft.world.gen.feature.structure.Structure; +////import net.minecraft.world.gen.feature.structure.StructureFeature; +//import net.minecraft.util.math.BlockPos; +//import net.minecraft.world.server.ServerWorld; +// +//public class StructureLocatorItem extends Item { +// +// public StructureLocatorItem(Properties properties) { +// super(properties); +// } +// +// @Override +// public ActionResult use(World world, PlayerEntity player, Hand hand) { +// if (!world.isClientSide && world instanceof ServerWorld) { +// ServerWorld serverWorld = (ServerWorld) world; +// BlockPos playerPos = player.blockPosition(); +// +// // Replace this with your own structure, or any StructureFeature +// Structure structureToFind = Structure.STRONGHOLD; +// +// BlockPos structurePos = serverWorld.getStructureLocation( +// structureToFind, +// playerPos, +// 100, // search radius in chunks +// false +// ); +// +// if (structurePos != null) { +// player.sendMessage( +// new StringTextComponent("Nearest structure at: " + structurePos.getX() + ", " + structurePos.getY() + ", " + structurePos.getZ()), +// player.getUUID() +// ); +// } else { +// player.sendMessage( +// new StringTextComponent("No structure found nearby."), +// player.getUUID() +// ); +// } +// } +// +// return ActionResult.resultSuccess(player.getItemInHand(hand)); +// } +//} diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java b/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java index 5497ffe..2c7dd3f 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/ModWorldEvents.java @@ -25,6 +25,8 @@ public class ModWorldEvents { ObfuscationReflectionHelper.findMethod(ChunkGenerator.class, "func_230347_a_"); ResourceLocation cgRL = Registry.CHUNK_GENERATOR_CODEC.getKey( (Codec)GETCODEC_METHOD.invoke(serverWorld.getChunkProvider().generator)); + } catch (Exception e) { + e.printStackTrace(); } } } diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/gen/ModStructureGeneration.java b/src/main/java/us/minecraftchest2/hdm_mod/world/gen/ModStructureGeneration.java new file mode 100644 index 0000000..e083aa1 --- /dev/null +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/gen/ModStructureGeneration.java @@ -0,0 +1,27 @@ +package us.minecraftchest2.hdm_mod.world.gen; + +import net.minecraft.util.RegistryKey; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.StructureFeature; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.event.world.BiomeLoadingEvent; +import us.minecraftchest2.hdm_mod.world.structure.ModStructures; + +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; + +public class ModStructureGeneration { + public static void generateStructures(final BiomeLoadingEvent event) { + RegistryKey key = RegistryKey.getOrCreateKey(Registry.BIOME_KEY, event.getName()); + Set types = BiomeDictionary.getTypes(key); + + if(types.contains(BiomeDictionary.Type.PLAINS)) { + List>> structures = event.getGeneration().getStructures(); + + structures.add(() -> ModStructures.HOUSE.get().withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + } + } +} \ No newline at end of file diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java index 415c9bd..a7927f5 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/ModStructures.java @@ -12,7 +12,7 @@ import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import us.minecraftchest2.hdm_mod.Hdm_mod; -import us.minecraftchest2.hdm_mod.world.structure.structures.DustHouseStructure; +import us.minecraftchest2.hdm_mod.world.structure.structures.HouseStructure; import java.util.HashMap; import java.util.Map; @@ -22,7 +22,7 @@ public class ModStructures { DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Hdm_mod.MOD_ID); public static final RegistryObject> HOUSE = - STRUCTURES.register("house", DustHouseStructure::new); + STRUCTURES.register("house", HouseStructure::new); /* average distance apart in chunks between spawn attempts */ /* minimum distance apart in chunks between spawn attempts. MUST BE LESS THAN ABOVE VALUE*/ diff --git a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/HouseStructure.java similarity index 96% rename from src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java rename to src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/HouseStructure.java index 64a5cb0..9a65477 100644 --- a/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/DustHouseStructure.java +++ b/src/main/java/us/minecraftchest2/hdm_mod/world/structure/structures/HouseStructure.java @@ -21,12 +21,12 @@ import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.feature.structure.StructureStart; import net.minecraft.world.gen.feature.structure.VillageConfig; import net.minecraft.world.gen.feature.template.TemplateManager; +import us.minecraftchest2.hdm_mod.Hdm_mod; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; -import us.minecraftchest2.hdm_mod.Hdm_mod; -public class DustHouseStructure extends Structure { - public DustHouseStructure() { +public class HouseStructure extends Structure { + public HouseStructure() { super(NoFeatureConfig.CODEC); } @@ -51,7 +51,7 @@ public class DustHouseStructure extends Structure { @Override public IStartFactory getStartFactory() { - return DustHouseStructure.Start::new; + return HouseStructure.Start::new; } public static class Start extends StructureStart { diff --git a/src/main/resources/assets/hdm_mod/textures/item/knife.png b/src/main/resources/assets/hdm_mod/textures/item/knife.png index 859a66dd3a8d102cda4661fac0818bd00290be23..01538f80d4c36d7fb88e16901e2ab23e6f801a1b 100644 GIT binary patch delta 267 zcmV+m0rdWCv;vSZf9^>{K~y-6V_+BsjKnD7vp4$>V}Ck$iYPrOnwR|j@L&7*n*YcK z5v|$y_38iG$JhKfetr5shpGa81NiLC;IYAwxujj8};82lg zxM~&3@ZS;vpnf!a%n%Pk&wW^aEpzZ Ur8{ETJ_aE0boFyt=akR{0Kx$k8~^|S diff --git a/src/main/resources/assets/hdm_mod/textures/item/omelet.png b/src/main/resources/assets/hdm_mod/textures/item/omelet.png index edf0513db1c0fb036a94f0e6f95ebd023de1534e..ca90c3f7b483059212c1eae3a79e281b4d3afac5 100644 GIT binary patch delta 189 zcmV;u07CzW0pW92)ARV{`fHqH19VIoE| zE8i)c@^AytB?HQTA{&g;5)>C8Yu?bwj$+8XPg2;FLc#!>(*nwWGHjiG5yJ)ZK1ng8 z%WQy$1&Rw`eq~@_VA#;f&hYz_8HQ$bz=Ui&vSM^F?~@cm5;os6OfTSzHe_32n$e>Y rs{yQhr?9$)U^;*SVl^``FfafBC=pE;=qi`%00000NkvXXu0mjfI516} delta 94 zcmaFH*ugl#Fx<)0#WBR9H#tFq^|0ihe<|PQOO*QTFtK0x+hK~L1RF@i{{0t!wwY>- xZF?@;cb0LsDSqd^@^A7|$(sV3O#2NO7%Ih;-d@@_eKP|Pc)I$ztaD0e0sw*#C&>T+ diff --git a/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json b/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json index 1fd8cd4..b805d55 100644 --- a/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json +++ b/src/main/resources/data/hdm_mod/worldgen/template_pool/house/start_pool.json @@ -1,11 +1,11 @@ { - "name": "tutorialmod:house/start_pool", + "name": "hdm_mod:house/start_pool", "fallback": "minecraft:empty", "elements": [ { "weight": 1, "element": { - "location": "tutorialmod:house", + "location": "hdm_mod:house", "processors": "minecraft:empty", "projection": "rigid", "element_type": "minecraft:single_pool_element" From 092a473abd328196fae5f82217e5fd7f748b99c9 Mon Sep 17 00:00:00 2001 From: dragonruler1000 Date: Fri, 27 Jun 2025 20:34:31 -0500 Subject: [PATCH 7/7] Updated the portal block texture Signed-off-by: dragonruler1000 --- .../assets/hdm_mod/models/block/window.json | 2 +- .../assets/hdm_mod/textures/block/portalblock.png | Bin 0 -> 228 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/main/resources/assets/hdm_mod/textures/block/portalblock.png diff --git a/src/main/resources/assets/hdm_mod/models/block/window.json b/src/main/resources/assets/hdm_mod/models/block/window.json index 43306a9..f302f99 100644 --- a/src/main/resources/assets/hdm_mod/models/block/window.json +++ b/src/main/resources/assets/hdm_mod/models/block/window.json @@ -1,6 +1,6 @@ { "parent": "block/cube_all", "textures" : { - "all": "hdm_mod:block/grey" + "all": "hdm_mod:block/portalblock" } } \ No newline at end of file diff --git a/src/main/resources/assets/hdm_mod/textures/block/portalblock.png b/src/main/resources/assets/hdm_mod/textures/block/portalblock.png new file mode 100644 index 0000000000000000000000000000000000000000..29a83400e80eaf2e85aff707a3c1670f026d1ae2 GIT binary patch literal 228 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|=6Sj}hFJ6_ zhfFd5dEPMrDwulxP* zYR`3sBt}Q(4?pKOGP+9~U|2Un{S-q^q2Ct97ALv&j4gja3jXw5W=Q(m!zXd_$W-So+_$0QrN#)78&qol`;+06>aXeE