mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 08:29:33 -05:00
Compare commits
40 commits
Author | SHA1 | Date | |
---|---|---|---|
|
68c4c9bb50 | ||
|
092a473abd | ||
|
3085bd5d92 | ||
|
5a27c4ab2e | ||
|
bcd5a40813 | ||
|
15b1027f9b | ||
|
059f2d881b | ||
|
7547f751e2 | ||
|
89cff4ca48 | ||
|
f7777980c3 | ||
|
a9303a44cb | ||
|
c1e69d76a5 | ||
|
a8d47d1845 | ||
|
e632fbe891 | ||
|
02d4df7c55 | ||
|
c4cacd402b | ||
|
79949bc13b | ||
|
ede9ae1339 | ||
|
1289e20bc0 | ||
|
8a422e725f | ||
|
9cad3a926e | ||
|
afc8ae209e | ||
|
a540f3bf60 | ||
|
ef61988f61 | ||
|
bcf7cbd7d1 | ||
|
8de9596a60 | ||
|
9281cf5c65 | ||
|
d962b7d8b7 | ||
|
c43a75739f | ||
|
748ab1b988 | ||
|
249c235220 | ||
|
5b390d20c6 | ||
|
0c0a9c5998 | ||
|
670cd542c9 | ||
|
73d41b9179 | ||
|
44581d576f | ||
|
6915d2ae90 | ||
|
d7c9678147 | ||
|
c06d73ebff | ||
|
8f94831df0 |
34 changed files with 825 additions and 218 deletions
|
@ -31,6 +31,7 @@ minecraft {
|
||||||
// Use non-default mappings at your own risk. They may not always work.
|
// 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.
|
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||||
mappings channel: mapping_channel, version: mapping_version
|
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.
|
// 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.
|
// In most cases, it is not necessary to enable.
|
||||||
|
@ -141,7 +142,7 @@ tasks.named('processResources', ProcessResources).configure {
|
||||||
forge_version : forge_version, forge_version_range: forge_version_range,
|
forge_version : forge_version, forge_version_range: forge_version_range,
|
||||||
loader_version_range: loader_version_range,
|
loader_version_range: loader_version_range,
|
||||||
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||||
mod_authors : mod_authors, mod_description: mod_description,]
|
mod_authors : mod_authors, credits:credits, mod_description: mod_description,]
|
||||||
|
|
||||||
inputs.properties replaceProperties
|
inputs.properties replaceProperties
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=flase
|
||||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||||
minecraft_version=1.16.5
|
minecraft_version=1.16.5
|
||||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
|
@ -38,12 +38,14 @@ mod_name=Hdm Mod
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.1
|
mod_version=1.2.3
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
mod_group_id=us.minecraftchest2
|
mod_group_id=us.minecraftchest2
|
||||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||||
mod_authors=Minecraftchest2
|
mod_authors=Minecraftchest2
|
||||||
|
# The mod credits.
|
||||||
|
credits=Everyone on the Tardis Mod Discord and on the hackclub slack that helped me debug my mod
|
||||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||||
mod_description=A Mod Inspired by "His Dark Materials" By Philip Pullman
|
mod_description=A Mod Inspired by "His Dark Materials" By Philip Pullman
|
||||||
|
|
|
@ -2,12 +2,16 @@ package us.minecraftchest2.hdm_mod;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
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.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.InterModComms;
|
import net.minecraftforge.fml.InterModComms;
|
||||||
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||||
|
@ -18,6 +22,7 @@ import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
import us.minecraftchest2.hdm_mod.item.ModItems;
|
import us.minecraftchest2.hdm_mod.item.ModItems;
|
||||||
|
import us.minecraftchest2.hdm_mod.world.structure.ModStructures;
|
||||||
//import us.minecraftchest2.hdm_mod.init.ItemInit;
|
//import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -37,6 +42,8 @@ public class Hdm_mod {
|
||||||
ModItems.register(modEventBus1);
|
ModItems.register(modEventBus1);
|
||||||
ModBlocks.register(modEventBus1);
|
ModBlocks.register(modEventBus1);
|
||||||
|
|
||||||
|
ModStructures.register(modEventBus1);
|
||||||
|
|
||||||
modEventBus1.addListener(this::setup);
|
modEventBus1.addListener(this::setup);
|
||||||
// Register the enqueueIMC method for modloading
|
// Register the enqueueIMC method for modloading
|
||||||
modEventBus1.addListener(this::enqueueIMC);
|
modEventBus1.addListener(this::enqueueIMC);
|
||||||
|
@ -44,6 +51,7 @@ public class Hdm_mod {
|
||||||
modEventBus1.addListener(this::processIMC);
|
modEventBus1.addListener(this::processIMC);
|
||||||
// Register the doClientStuff method for modloading
|
// Register the doClientStuff method for modloading
|
||||||
modEventBus1.addListener(this::doClientStuff);
|
modEventBus1.addListener(this::doClientStuff);
|
||||||
|
// ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ModConfig.GENERAL_SPEC, "modconfig.toml");
|
||||||
|
|
||||||
// Register ourselves for server and other game events we are interested in
|
// Register ourselves for server and other game events we are interested in
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
@ -59,10 +67,16 @@ public class Hdm_mod {
|
||||||
// some preinit code
|
// some preinit code
|
||||||
LOGGER.info("HELLO FROM PREINIT");
|
LOGGER.info("HELLO FROM PREINIT");
|
||||||
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
|
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
|
||||||
|
|
||||||
|
event.enqueueWork(() ->{
|
||||||
|
ModStructures.setupStructures();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doClientStuff(final FMLClientSetupEvent event) {
|
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||||
// do something that can only be done on the client
|
// do something that can only be done on the client
|
||||||
|
event.enqueueWork(() -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueIMC(final InterModEnqueueEvent event) {
|
private void enqueueIMC(final InterModEnqueueEvent event) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package us.minecraftchest2.hdm_mod.block;
|
||||||
import net.minecraft.block.AbstractBlock;
|
import net.minecraft.block.AbstractBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -11,6 +12,7 @@ import net.minecraftforge.fml.RegistryObject;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||||
|
import us.minecraftchest2.hdm_mod.block.custom.Window;
|
||||||
import us.minecraftchest2.hdm_mod.item.ModItems;
|
import us.minecraftchest2.hdm_mod.item.ModItems;
|
||||||
import us.minecraftchest2.hdm_mod.item.ModItemGroup;
|
import us.minecraftchest2.hdm_mod.item.ModItemGroup;
|
||||||
|
|
||||||
|
@ -18,33 +20,54 @@ import java.util.function.Supplier;
|
||||||
import java.util.function.ToIntFunction;
|
import java.util.function.ToIntFunction;
|
||||||
|
|
||||||
public class ModBlocks {
|
public class ModBlocks {
|
||||||
public static ToIntFunction<BlockState> dustLightLevel = BlockState -> 10; // Dust Light Level
|
// Function to determine the light level for the "dust" block
|
||||||
public static ToIntFunction<BlockState> PORTAL_LIGHT_LEVEL = BlockState ->15;
|
public static ToIntFunction<BlockState> dustLightLevel = BlockState -> 10; // Fixed value of 10
|
||||||
|
|
||||||
|
// Function to set the light level for the "portal" block
|
||||||
|
public static ToIntFunction<BlockState> PORTAL_LIGHT_LEVEL = BlockState -> 15; // Fixed value of 15
|
||||||
|
|
||||||
|
// DeferredRegister to register blocks with Forge, using your mod ID
|
||||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Hdm_mod.MOD_ID);
|
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Hdm_mod.MOD_ID);
|
||||||
|
|
||||||
|
// Registering a "block of dust" with specific properties
|
||||||
public static final RegistryObject<Block> DUST_BLOCK = registerBlock("block_of_dust",
|
public static final RegistryObject<Block> DUST_BLOCK = registerBlock("block_of_dust",
|
||||||
() -> new Block(AbstractBlock.Properties.create(Material.ROCK).doesNotBlockMovement().harvestLevel(0)
|
() -> new Block(
|
||||||
.hardnessAndResistance(500f, 100f).setLightLevel(dustLightLevel)));
|
AbstractBlock.Properties.create(Material.ROCK) // Base material is rock
|
||||||
|
.doesNotBlockMovement() // Entities can move through this block
|
||||||
|
.harvestLevel(0) // Harvest level
|
||||||
|
.hardnessAndResistance(500f, 100f) // Hardness and blast resistance
|
||||||
|
.setLightLevel(dustLightLevel) // Provides light using the dustLightLevel function
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Registering a "portal" block called "window" with different properties
|
||||||
public static final RegistryObject<Block> PORTAL_BLOCK = registerBlock("window",
|
public static final RegistryObject<Block> PORTAL_BLOCK = registerBlock("window",
|
||||||
() -> new Block(AbstractBlock.Properties.create(Material.PORTAL).doesNotBlockMovement().harvestLevel(10)
|
() -> new Window(
|
||||||
.hardnessAndResistance(1000f, 1000f).setLightLevel(PORTAL_LIGHT_LEVEL)));
|
AbstractBlock.Properties.create(Material.PORTAL) // Base material is portal
|
||||||
|
.doesNotBlockMovement() // Entities can move through this block
|
||||||
|
.harvestLevel(10) // High harvest level
|
||||||
|
.hardnessAndResistance(1000f, 1000f) // Very hard and blast resistant
|
||||||
|
.setLightLevel(PORTAL_LIGHT_LEVEL) // Maximum light level
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Helper method to register a block and its corresponding BlockItem at once
|
||||||
private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) {
|
private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) {
|
||||||
RegistryObject<T> toReturn = BLOCKS.register(name, block);
|
RegistryObject<T> toReturn = BLOCKS.register(name, block); // Register the block itself
|
||||||
registerBlockItem(name, toReturn);
|
registerBlockItem(name, toReturn); // Register the block as an item
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper method to register the item form of a block, belonging to a custom item group
|
||||||
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
|
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
|
||||||
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
ModItems.ITEMS.register(name, () -> new BlockItem(
|
||||||
new Item.Properties().group(ModItemGroup.HDM_BLOCK_GROUP)));
|
block.get(),
|
||||||
|
new Item.Properties().group(ModItemGroup.HDM_BLOCK_GROUP) // Assigns to the HDM block group
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is called to register all blocks with the mod event bus
|
||||||
public static void register(IEventBus eventBus){
|
public static void register(IEventBus eventBus){
|
||||||
BLOCKS.register(eventBus);
|
BLOCKS.register(eventBus);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package us.minecraftchest2.hdm_mod.block.custom;
|
package us.minecraftchest2.hdm_mod.block.custom;
|
||||||
|
|
||||||
|
// Import statements...
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.HorizontalBlock;
|
import net.minecraft.block.HorizontalBlock;
|
||||||
|
@ -9,12 +11,14 @@ import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.state.StateContainer;
|
import net.minecraft.state.StateContainer;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
@ -24,22 +28,34 @@ import us.minecraftchest2.hdm_mod.world.dimension.SimpleTeleporter;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom window block class, serving as a dimensional portal between worlds.
|
||||||
|
* Inherits directional placement capabilities from HorizontalBlock.
|
||||||
|
*/
|
||||||
public class Window extends HorizontalBlock {
|
public class Window extends HorizontalBlock {
|
||||||
|
/**
|
||||||
|
* Constructor for Window block; forwards the properties to the parent constructor.
|
||||||
|
*/
|
||||||
public Window(Properties builder) {
|
public Window(Properties builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VoxelShapes for visually and physically shaping the block based on orientation.
|
||||||
|
// Each direction (N/E/S/W) has a custom composition of rectangular regions.
|
||||||
|
|
||||||
|
/** Shape for the block facing NORTH. */
|
||||||
private static final VoxelShape SHAPE_N = Stream.of(
|
private static final VoxelShape SHAPE_N = Stream.of(
|
||||||
Block.makeCuboidShape(5, 11, 5, 6, 13, 11),
|
Block.makeCuboidShape(5, 11, 5, 6, 13, 11), // Window frame elements (left, etc.)
|
||||||
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
Block.makeCuboidShape(4, 0, 4, 12, 1, 12), // Base of window
|
||||||
Block.makeCuboidShape(5, 1, 5, 11, 2, 11),
|
Block.makeCuboidShape(5, 1, 5, 11, 2, 11), // Lower window frame
|
||||||
Block.makeCuboidShape(6, 2, 6, 10, 10, 10),
|
Block.makeCuboidShape(6, 2, 6, 10, 10, 10), // Glass pane
|
||||||
Block.makeCuboidShape(5, 10, 4, 11, 11, 12),
|
Block.makeCuboidShape(5, 10, 4, 11, 11, 12), // Top frame
|
||||||
Block.makeCuboidShape(5, 11, 4, 11, 12, 5),
|
Block.makeCuboidShape(5, 11, 4, 11, 12, 5), // Decorative details
|
||||||
Block.makeCuboidShape(5, 11, 11, 11, 14, 12),
|
Block.makeCuboidShape(5, 11, 11, 11, 14, 12),// Upper right details
|
||||||
Block.makeCuboidShape(10, 11, 5, 11, 13, 11)
|
Block.makeCuboidShape(10, 11, 5, 11, 13, 11) // Right vertical side
|
||||||
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
|
||||||
|
/** Shape for the block facing EAST (rotated). */
|
||||||
private static final VoxelShape SHAPE_E = Stream.of(
|
private static final VoxelShape SHAPE_E = Stream.of(
|
||||||
Block.makeCuboidShape(5, 11, 5, 11, 13, 6),
|
Block.makeCuboidShape(5, 11, 5, 11, 13, 6),
|
||||||
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
||||||
|
@ -51,6 +67,7 @@ public class Window extends HorizontalBlock {
|
||||||
Block.makeCuboidShape(5, 11, 10, 11, 13, 11)
|
Block.makeCuboidShape(5, 11, 10, 11, 13, 11)
|
||||||
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
|
||||||
|
/** Shape for the block facing SOUTH. */
|
||||||
private static final VoxelShape SHAPE_S = Stream.of(
|
private static final VoxelShape SHAPE_S = Stream.of(
|
||||||
Block.makeCuboidShape(10, 11, 5, 11, 13, 11),
|
Block.makeCuboidShape(10, 11, 5, 11, 13, 11),
|
||||||
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
||||||
|
@ -62,6 +79,7 @@ public class Window extends HorizontalBlock {
|
||||||
Block.makeCuboidShape(5, 11, 5, 6, 13, 11)
|
Block.makeCuboidShape(5, 11, 5, 6, 13, 11)
|
||||||
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
|
||||||
|
/** Shape for the block facing WEST. */
|
||||||
private static final VoxelShape SHAPE_W = Stream.of(
|
private static final VoxelShape SHAPE_W = Stream.of(
|
||||||
Block.makeCuboidShape(5, 11, 10, 11, 13, 11),
|
Block.makeCuboidShape(5, 11, 10, 11, 13, 11),
|
||||||
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
Block.makeCuboidShape(4, 0, 4, 12, 1, 12),
|
||||||
|
@ -73,33 +91,51 @@ public class Window extends HorizontalBlock {
|
||||||
Block.makeCuboidShape(5, 11, 5, 11, 13, 6)
|
Block.makeCuboidShape(5, 11, 5, 11, 13, 6)
|
||||||
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles when a player right-clicks/interacts with this block.
|
||||||
|
* Triggers portal teleportation if conditions are met.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos,
|
public ActionResultType onBlockActivated(
|
||||||
PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
BlockState state,
|
||||||
if (!worldIn.isRemote()) {
|
World worldIn,
|
||||||
if (!player.isCrouching()) {
|
BlockPos pos,
|
||||||
|
PlayerEntity player,
|
||||||
|
Hand handIn,
|
||||||
|
BlockRayTraceResult hit
|
||||||
|
) {
|
||||||
|
if (!worldIn.isRemote() && !player.isCrouching()) {
|
||||||
MinecraftServer server = worldIn.getServer();
|
MinecraftServer server = worldIn.getServer();
|
||||||
|
if (server == null) return ActionResultType.PASS;
|
||||||
|
|
||||||
|
boolean goingToCustom = worldIn.getDimensionKey() != ModDimensions.World1;
|
||||||
|
|
||||||
|
ServerWorld targetWorld = (worldIn.getDimensionKey() == ModDimensions.World1)
|
||||||
|
? server.getWorld(World.OVERWORLD)
|
||||||
|
: server.getWorld(ModDimensions.World1);
|
||||||
|
|
||||||
if (server != null) {
|
|
||||||
if (worldIn.getDimensionKey() == ModDimensions.World1) {
|
if (worldIn.getDimensionKey() == ModDimensions.World1) {
|
||||||
ServerWorld overWorld = server.getWorld(World.OVERWORLD);
|
ServerWorld overWorld = server.getWorld(World.OVERWORLD);
|
||||||
if (overWorld != null) {
|
if (overWorld != null) {
|
||||||
player.changeDimension(overWorld, new SimpleTeleporter(pos, false));
|
player.changeDimension(overWorld, new SimpleTeleporter(pos, false));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ServerWorld kjDim = server.getWorld(ModDimensions.World1);
|
|
||||||
if (kjDim != null) {
|
|
||||||
player.changeDimension(kjDim, new SimpleTeleporter(pos, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ActionResultType.SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetWorld != null) {
|
||||||
|
SimpleTeleporter teleporter = new SimpleTeleporter(pos, goingToCustom);
|
||||||
|
player.changeDimension(targetWorld, teleporter);
|
||||||
|
}
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the block's physical outline for rendering and collision.
|
||||||
|
* The shape depends on the current facing direction of the block.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
switch (state.get(HORIZONTAL_FACING)) {
|
switch (state.get(HORIZONTAL_FACING)) {
|
||||||
|
@ -116,16 +152,22 @@ public class Window extends HorizontalBlock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the horizontal facing property with the block state container,
|
||||||
|
* enabling the block to store which direction it is facing.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||||
builder.add(HORIZONTAL_FACING);
|
builder.add(HORIZONTAL_FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the block's initial facing based on the placement context.
|
||||||
|
* The block will face opposite to the player's direction when placed.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
//package us.minecraftchest2.hdm_mod.config;
|
||||||
|
//
|
||||||
|
//import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
//
|
||||||
|
//public class ModConfig {
|
||||||
|
//public static final ForgeConfigSpec GENERAL_SPEC;
|
||||||
|
//
|
||||||
|
//static {
|
||||||
|
// ForgeConfigSpec.Builder configBuilder = new ForgeConfigSpec.Builder();
|
||||||
|
// setupConfig(configBuilder);
|
||||||
|
// GENERAL_SPEC = configBuilder.build();
|
||||||
|
//}
|
||||||
|
//public static ForgeConfigSpec.IntValue exampleIntConfigEntry;
|
||||||
|
//
|
||||||
|
//private static void setupConfig(ForgeConfigSpec.Builder builder) {
|
||||||
|
// exampleIntConfigEntry = builder.defineInRange("exampleIntConfigEntry", 5, 2, 50);
|
||||||
|
//}
|
||||||
|
//}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package us.minecraftchest2.hdm_mod.config;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
|
public class ModConfig {
|
||||||
|
public static final ForgeConfigSpec GENERAL_SPEC;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ForgeConfigSpec.Builder configBuilder = new ForgeConfigSpec.Builder();
|
||||||
|
setupConfig(configBuilder);
|
||||||
|
GENERAL_SPEC = configBuilder.build();
|
||||||
|
}
|
||||||
|
public static ForgeConfigSpec.IntValue exampleIntConfigEntry;
|
||||||
|
|
||||||
|
private static void setupConfig(ForgeConfigSpec.Builder builder) {
|
||||||
|
exampleIntConfigEntry = builder.defineInRange("exampleIntConfigEntry", 5, 2, 50);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,17 @@
|
||||||
package us.minecraftchest2.hdm_mod.item;
|
package us.minecraftchest2.hdm_mod.item;
|
||||||
|
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Food;
|
||||||
import net.minecraft.item.Item;
|
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.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.RegistryObject;
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||||
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
import us.minecraftchest2.hdm_mod.item.custom.SubtleKnife;
|
import us.minecraftchest2.hdm_mod.item.custom.SubtleKnife;
|
||||||
|
|
||||||
public class ModItems {
|
public class ModItems {
|
||||||
|
@ -18,12 +24,13 @@ public class ModItems {
|
||||||
|
|
||||||
|
|
||||||
public static final RegistryObject<Item> OMELET = ITEMS.register("omelet",
|
public static final RegistryObject<Item> 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<Item> KNIFE = ITEMS.register("subtle_knife",
|
public static final RegistryObject<Item> KNIFE = ITEMS.register("subtle_knife",
|
||||||
() -> new SubtleKnife(new Item.Properties().maxStackSize(1).group(ModItemGroup.HDM_ITEM_GROUP).maxDamage(2000)));
|
() -> new SubtleKnife(new Item.Properties().maxStackSize(1).group(ModItemGroup.HDM_ITEM_GROUP).maxDamage(2000)));
|
||||||
|
public static final RegistryObject<Item> 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) {
|
public static void register(IEventBus eventBus) {
|
||||||
ITEMS.register(eventBus);
|
ITEMS.register(eventBus);
|
||||||
|
|
|
@ -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<ItemStack> 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));
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -1,7 +1,5 @@
|
||||||
package us.minecraftchest2.hdm_mod.item.custom;
|
package us.minecraftchest2.hdm_mod.item.custom;
|
||||||
|
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -9,13 +7,7 @@ import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.ITextComponent;
|
|
||||||
import net.minecraft.util.text.ScoreTextComponent;
|
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
|
||||||
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
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<? extends ChunkGenerator>)GETCODEC_METHOD.invoke(serverWorld.getChunkProvider().generator));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +1,62 @@
|
||||||
package us.minecraftchest2.hdm_mod.world.dimension;
|
package us.minecraftchest2.hdm_mod.world.dimension;
|
||||||
|
|
||||||
|
// Imports omitted for brevity
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.util.ITeleporter;
|
import net.minecraftforge.common.util.ITeleporter;
|
||||||
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
import us.minecraftchest2.hdm_mod.block.ModBlocks;
|
||||||
import us.minecraftchest2.hdm_mod.block.custom.Window;
|
import us.minecraftchest2.hdm_mod.block.custom.Window;
|
||||||
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles teleportation of entities between dimensions, with custom logic for portals and safety.
|
||||||
|
*/
|
||||||
public class SimpleTeleporter implements ITeleporter {
|
public class SimpleTeleporter implements ITeleporter {
|
||||||
|
// The destination position for the teleport
|
||||||
public static BlockPos thisPos = BlockPos.ZERO;
|
public static BlockPos thisPos = BlockPos.ZERO;
|
||||||
|
|
||||||
|
// True if teleporting into the custom dimension, false if to overworld
|
||||||
public static boolean insideDimension = true;
|
public static boolean insideDimension = true;
|
||||||
|
|
||||||
|
// Records if the most recent teleport was successful
|
||||||
|
private boolean success = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return True if the last teleportation was successful (a safe landing spot found), false otherwise
|
||||||
|
*/
|
||||||
|
public boolean wasSuccessful() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor sets the target position and whether we're inside our custom dimension.
|
||||||
|
* @param pos Destination position
|
||||||
|
* @param insideDim Are we inside the custom dimension after teleport?
|
||||||
|
*/
|
||||||
public SimpleTeleporter(BlockPos pos, boolean insideDim) {
|
public SimpleTeleporter(BlockPos pos, boolean insideDim) {
|
||||||
thisPos = pos;
|
thisPos = pos;
|
||||||
insideDimension = insideDim;
|
insideDimension = insideDim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a block position is unsafe (solid, unreplaceable, lava, or fire).
|
||||||
|
* @param world The world to check in
|
||||||
|
* @param pos The position to check
|
||||||
|
* @return True if the position is unsafe, false if safe
|
||||||
|
*/
|
||||||
private boolean isUnsafe(ServerWorld world, BlockPos pos){
|
private boolean isUnsafe(ServerWorld world, BlockPos pos){
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
Material material = state.getMaterial();
|
Material material = state.getMaterial();
|
||||||
|
// Not air AND not easily replaced (by water/etc) OR is lava or fire is considered unsafe
|
||||||
return material != Material.AIR &&
|
return material != Material.AIR &&
|
||||||
!state.isReplaceable(Fluids.WATER) &&
|
!state.isReplaceable(Fluids.WATER) &&
|
||||||
!material.isReplaceable() ||
|
!material.isReplaceable() ||
|
||||||
|
@ -32,26 +64,46 @@ public class SimpleTeleporter implements ITeleporter {
|
||||||
material == Material.FIRE;
|
material == Material.FIRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the actual placing of the entity when teleporting between dimensions.
|
||||||
|
* Will try to find a safe spot upwards, up to 25 tries.
|
||||||
|
* Also, optionally places a portal block at the destination.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destinationWorld,
|
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destinationWorld,
|
||||||
float yaw, Function<Boolean, Entity> repositionEntity) {
|
float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||||
|
// Move entity to the origin position
|
||||||
entity = repositionEntity.apply(false);
|
entity = repositionEntity.apply(false);
|
||||||
|
|
||||||
|
// Default target y coordinate for the destination
|
||||||
double y = 61;
|
double y = 61;
|
||||||
|
|
||||||
|
// If not going inside the custom dimension, use the saved Y
|
||||||
if (!insideDimension) {
|
if (!insideDimension) {
|
||||||
y = thisPos.getY();
|
y = thisPos.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate the intended destination block position
|
||||||
BlockPos destinationPos = new BlockPos(thisPos.getX(), y, thisPos.getZ());
|
BlockPos destinationPos = new BlockPos(thisPos.getX(), y, thisPos.getZ());
|
||||||
|
|
||||||
|
// Try to find a safe spot (air, replaceable, not lava/fire) by moving up, max 25 attempts
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
while ((isUnsafe(destinationWorld, destinationPos) || isUnsafe(destinationWorld, destinationPos.up())) && tries < 25) {
|
while ((isUnsafe(destinationWorld, destinationPos) || isUnsafe(destinationWorld, destinationPos.up())) && tries < 25) {
|
||||||
destinationPos = destinationPos.up(2);
|
destinationPos = destinationPos.up(2);
|
||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setPositionAndUpdate(destinationPos.getX(), destinationPos.getY(), destinationPos.getZ());
|
// If it couldn't find a safe spot after 25 attempts, fail teleport
|
||||||
|
if (tries >= 25) {
|
||||||
|
this.success = false;
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move entity to found safe location
|
||||||
|
entity.setPositionAndUpdate(destinationPos.getX(), destinationPos.getY(), destinationPos.getZ());
|
||||||
|
this.success = true;
|
||||||
|
|
||||||
|
// When entering a custom dimension, make a portal block at the destination unless one already exists nearby
|
||||||
if (insideDimension) {
|
if (insideDimension) {
|
||||||
boolean doSetBlock = true;
|
boolean doSetBlock = true;
|
||||||
for (BlockPos checkPos : BlockPos.getAllInBoxMutable(destinationPos.down(10).west(10), destinationPos.up(10).east(10))) {
|
for (BlockPos checkPos : BlockPos.getAllInBoxMutable(destinationPos.down(10).west(10), destinationPos.up(10).east(10))) {
|
||||||
|
@ -65,6 +117,33 @@ public class SimpleTeleporter implements ITeleporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity instanceof PlayerEntity) {
|
||||||
|
PlayerEntity player = (PlayerEntity) entity;
|
||||||
|
ResourceLocation dimensionKey = destinationWorld.getDimensionKey().getLocation();
|
||||||
|
// Only send the welcome message if NOT the overworld
|
||||||
|
if (!dimensionKey.getPath().equals("overworld")) {
|
||||||
|
// (Same nice formatting as before)
|
||||||
|
String path = dimensionKey.getPath();
|
||||||
|
String dimensionName;
|
||||||
|
switch (path) {
|
||||||
|
case "the_nether":
|
||||||
|
dimensionName = "the Nether";
|
||||||
|
break;
|
||||||
|
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);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
player.sendMessage(new StringTextComponent("Welcome to " + dimensionName + "!"), player.getUniqueID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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<Biome> key = RegistryKey.getOrCreateKey(Registry.BIOME_KEY, event.getName());
|
||||||
|
Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(key);
|
||||||
|
|
||||||
|
if(types.contains(BiomeDictionary.Type.PLAINS)) {
|
||||||
|
List<Supplier<StructureFeature<?, ?>>> structures = event.getGeneration().getStructures();
|
||||||
|
|
||||||
|
structures.add(() -> ModStructures.HOUSE.get().withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.HouseStructure;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ModStructures {
|
||||||
|
public static final DeferredRegister<Structure<?>> STRUCTURES =
|
||||||
|
DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Hdm_mod.MOD_ID);
|
||||||
|
|
||||||
|
public static final RegistryObject<Structure<NoFeatureConfig>> HOUSE =
|
||||||
|
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*/
|
||||||
|
/* 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 <F extends Structure<?>> 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.<Structure<?>>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.<Structure<?>, 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<Structure<?>, 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<Structure<?>, 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
public class HouseStructure extends Structure<NoFeatureConfig> {
|
||||||
|
public HouseStructure() {
|
||||||
|
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<NoFeatureConfig> getStartFactory() {
|
||||||
|
return HouseStructure.Start::new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Start extends StructureStart<NoFeatureConfig> {
|
||||||
|
public Start(Structure<NoFeatureConfig> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
src/main/resources/META-INF/accesstransformer.cfg
Normal file
4
src/main/resources/META-INF/accesstransformer.cfg
Normal file
|
@ -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
|
|
@ -30,6 +30,7 @@ displayName = "${mod_name}" #mandatory
|
||||||
#credits="Thanks for this example mod goes to Java" #optional
|
#credits="Thanks for this example mod goes to Java" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
authors = "${mod_authors}" #optional
|
authors = "${mod_authors}" #optional
|
||||||
|
credits="${credits}"
|
||||||
# The description text for the mod (multi line!) (#mandatory)
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
description = '''${mod_description}'''
|
description = '''${mod_description}'''
|
||||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"main": {"model": "hdm_mod:block/block_of_dust" }
|
"":[
|
||||||
|
{"model": "hdm_mod:block/block_of_dust" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": [
|
||||||
|
{"model": "hdm_mod:block/window" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
"item.hdm_mod.subtle_knife": "Subtle Knife",
|
"item.hdm_mod.subtle_knife": "Subtle Knife",
|
||||||
"item.hdm_mod.omelet": "Omelet",
|
"item.hdm_mod.omelet": "Omelet",
|
||||||
|
"item.hdm_mod.omelet-cooked": "Omelet",
|
||||||
"item.hdm_mod.dust": "Dust",
|
"item.hdm_mod.dust": "Dust",
|
||||||
"block.hdm_mod.block_of_dust": "Block of Dust"
|
"block.hdm_mod.block_of_dust": "Block of Dust",
|
||||||
|
"block.hdm_mod.window": "Window"
|
||||||
}
|
}
|
|
@ -1,151 +1,6 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"parent": "block/cube_all",
|
||||||
"textures" : {
|
"textures" : {
|
||||||
"1": "hdm_mod:block/brown",
|
"all": "hdm_mod:block/portalblock"
|
||||||
"2": "hdm_mod:block/grey",
|
|
||||||
"particle": "hdm_mod:block/red"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"from": [5, 11, 5],
|
|
||||||
"to": [6, 13, 11],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"east": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"south": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"west": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"up": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"down": {"uv": [0, 0, 1, 6], "texture": "#2"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [4, 0, 4],
|
|
||||||
"to": [12, 1, 12],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
|
||||||
"east": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
|
||||||
"south": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
|
||||||
"west": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
|
||||||
"up": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
|
||||||
"down": {"uv": [0, 0, 8, 8], "texture": "#1"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [5, 1, 5],
|
|
||||||
"to": [11, 2, 11],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
|
||||||
"east": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
|
||||||
"south": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
|
||||||
"west": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
|
||||||
"up": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
|
||||||
"down": {"uv": [0, 0, 6, 1], "texture": "#1"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [6, 2, 6],
|
|
||||||
"to": [10, 10, 10],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
|
||||||
"east": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
|
||||||
"south": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
|
||||||
"west": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
|
||||||
"up": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
|
||||||
"down": {"uv": [0, 0, 4, 8], "texture": "#1"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [5, 10, 4],
|
|
||||||
"to": [11, 11, 12],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
|
||||||
"east": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
|
||||||
"south": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
|
||||||
"west": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
|
||||||
"up": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
|
||||||
"down": {"uv": [0, 0, 6, 8], "texture": "#2"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [5, 11, 4],
|
|
||||||
"to": [11, 12, 5],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"south": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"up": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"down": {"uv": [0, 0, 6, 1], "texture": "#2"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [5, 11, 11],
|
|
||||||
"to": [11, 14, 12],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"south": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"up": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
|
||||||
"down": {"uv": [0, 0, 6, 1], "texture": "#2"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": [10, 11, 5],
|
|
||||||
"to": [11, 13, 11],
|
|
||||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"east": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"south": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"west": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"up": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
|
||||||
"down": {"uv": [0, 0, 1, 6], "texture": "#2"}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"display": {
|
|
||||||
"thirdperson_righthand": {
|
|
||||||
"rotation": [0, -180, 0],
|
|
||||||
"scale": [0.5, 0.69, 0.5]
|
|
||||||
},
|
|
||||||
"thirdperson_lefthand": {
|
|
||||||
"rotation": [0, -180, 0],
|
|
||||||
"scale": [0.5, 0.69, 0.5]
|
|
||||||
},
|
|
||||||
"firstperson_righthand": {
|
|
||||||
"translation": [0, 4, 2.5],
|
|
||||||
"scale": [0.5, 0.5, 0.5]
|
|
||||||
},
|
|
||||||
"firstperson_lefthand": {
|
|
||||||
"translation": [0, 4, 2.5],
|
|
||||||
"scale": [0.5, 0.5, 0.5]
|
|
||||||
},
|
|
||||||
"ground": {
|
|
||||||
"translation": [0, 2.25, 0],
|
|
||||||
"scale": [0.75, 0.75, 0.75]
|
|
||||||
},
|
|
||||||
"gui": {
|
|
||||||
"rotation": [55, -125, 0],
|
|
||||||
"scale": [0.75, 0.75, 0.75]
|
|
||||||
},
|
|
||||||
"head": {
|
|
||||||
"translation": [0, 14, 0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"name": "VoxelShapes",
|
|
||||||
"origin": [8, 8, 8],
|
|
||||||
"color": 0,
|
|
||||||
"children": [0, 1, 2, 3, 4, 5, 6, 7]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
151
src/main/resources/assets/hdm_mod/models/block/window1.json
Normal file
151
src/main/resources/assets/hdm_mod/models/block/window1.json
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
{
|
||||||
|
"credit": "Made with Blockbench",
|
||||||
|
"textures": {
|
||||||
|
"1": "hdm_mod:block/brown",
|
||||||
|
"2": "hdm_mod:block/grey",
|
||||||
|
"particle": "hdm_mod:block/red"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [5, 11, 5],
|
||||||
|
"to": [6, 13, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"east": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"south": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"west": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"up": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"down": {"uv": [0, 0, 1, 6], "texture": "#2"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [4, 0, 4],
|
||||||
|
"to": [12, 1, 12],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
||||||
|
"east": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
||||||
|
"south": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
||||||
|
"west": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
||||||
|
"up": {"uv": [0, 0, 8, 8], "texture": "#1"},
|
||||||
|
"down": {"uv": [0, 0, 8, 8], "texture": "#1"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [5, 1, 5],
|
||||||
|
"to": [11, 2, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
||||||
|
"east": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
||||||
|
"south": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
||||||
|
"west": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
||||||
|
"up": {"uv": [0, 0, 6, 1], "texture": "#1"},
|
||||||
|
"down": {"uv": [0, 0, 6, 1], "texture": "#1"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [6, 2, 6],
|
||||||
|
"to": [10, 10, 10],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
||||||
|
"east": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
||||||
|
"south": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
||||||
|
"west": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
||||||
|
"up": {"uv": [0, 0, 4, 8], "texture": "#1"},
|
||||||
|
"down": {"uv": [0, 0, 4, 8], "texture": "#1"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [5, 10, 4],
|
||||||
|
"to": [11, 11, 12],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
||||||
|
"east": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
||||||
|
"south": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
||||||
|
"west": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
||||||
|
"up": {"uv": [0, 0, 6, 8], "texture": "#2"},
|
||||||
|
"down": {"uv": [0, 0, 6, 8], "texture": "#2"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [5, 11, 4],
|
||||||
|
"to": [11, 12, 5],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"south": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"up": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"down": {"uv": [0, 0, 6, 1], "texture": "#2"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [5, 11, 11],
|
||||||
|
"to": [11, 14, 12],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"south": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"up": {"uv": [0, 0, 6, 1], "texture": "#2"},
|
||||||
|
"down": {"uv": [0, 0, 6, 1], "texture": "#2"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [10, 11, 5],
|
||||||
|
"to": [11, 13, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8.3125, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"east": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"south": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"west": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"up": {"uv": [0, 0, 1, 6], "texture": "#2"},
|
||||||
|
"down": {"uv": [0, 0, 1, 6], "texture": "#2"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [0, -180, 0],
|
||||||
|
"scale": [0.5, 0.69, 0.5]
|
||||||
|
},
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [0, -180, 0],
|
||||||
|
"scale": [0.5, 0.69, 0.5]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"translation": [0, 4, 2.5],
|
||||||
|
"scale": [0.5, 0.5, 0.5]
|
||||||
|
},
|
||||||
|
"firstperson_lefthand": {
|
||||||
|
"translation": [0, 4, 2.5],
|
||||||
|
"scale": [0.5, 0.5, 0.5]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"translation": [0, 2.25, 0],
|
||||||
|
"scale": [0.75, 0.75, 0.75]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [55, -125, 0],
|
||||||
|
"scale": [0.75, 0.75, 0.75]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"translation": [0, 14, 0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "VoxelShapes",
|
||||||
|
"origin": [8, 8, 8],
|
||||||
|
"color": 0,
|
||||||
|
"children": [0, 1, 2, 3, 4, 5, 6, 7]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "hdm_mod:item/omelet"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "hdm_mod:block/window"
|
||||||
|
}
|
BIN
src/main/resources/assets/hdm_mod/textures/block/portalblock.png
Normal file
BIN
src/main/resources/assets/hdm_mod/textures/block/portalblock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 B |
Binary file not shown.
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 308 B |
Binary file not shown.
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 230 B |
15
src/main/resources/data/hdm_mod/dimension_type/world1.json
Normal file
15
src/main/resources/data/hdm_mod/dimension_type/world1.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"logical_height": 256,
|
||||||
|
"infiniburn": "minecraft:infiniburn_overworld",
|
||||||
|
"effects": "minecraft:overworld",
|
||||||
|
"ambient_light": 0,
|
||||||
|
"bed_works": true,
|
||||||
|
"respawn_anchor_works": false,
|
||||||
|
"has_raids": true,
|
||||||
|
"ultrawarm": false,
|
||||||
|
"natural": true,
|
||||||
|
"coordinate_scale": 1,
|
||||||
|
"piglin_safe": false,
|
||||||
|
"has_skylight": true,
|
||||||
|
"has_ceiling": false
|
||||||
|
}
|
|
@ -6,7 +6,9 @@
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"type": "minecraft:item",
|
"type": "minecraft:item",
|
||||||
"name": "hdm_mod:dust"
|
"name": "hdm_mod:dust",
|
||||||
|
"weight": 4,
|
||||||
|
"quality": 9
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
},
|
},
|
||||||
"result": "minecraft:red_wool",
|
"result": "minecraft:red_wool",
|
||||||
"experience": 10000000,
|
"experience": 10000000,
|
||||||
"cookingtime": 200
|
"cookingtime": 100
|
||||||
}
|
}
|
23
src/main/resources/data/hdm_mod/recipes/omelet.json
Normal file
23
src/main/resources/data/hdm_mod/recipes/omelet.json
Normal file
|
@ -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"
|
||||||
|
}
|
11
src/main/resources/data/hdm_mod/recipes/omelet_cooked.json
Normal file
11
src/main/resources/data/hdm_mod/recipes/omelet_cooked.json
Normal file
|
@ -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"
|
||||||
|
}
|
BIN
src/main/resources/data/hdm_mod/structures/dust_house.nbt
Normal file
BIN
src/main/resources/data/hdm_mod/structures/dust_house.nbt
Normal file
Binary file not shown.
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "hdm_mod:house/start_pool",
|
||||||
|
"fallback": "minecraft:empty",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"weight": 1,
|
||||||
|
"element": {
|
||||||
|
"location": "hdm_mod:house",
|
||||||
|
"processors": "minecraft:empty",
|
||||||
|
"projection": "rigid",
|
||||||
|
"element_type": "minecraft:single_pool_element"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue