mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 16:39:32 -05:00
Compare commits
No commits in common. "c1e69d76a56c30aaef153b2bd0ce79912f02ed3e" and "c4cacd402b2cf0e820ff597b33cf7f0a62607b3c" have entirely different histories.
c1e69d76a5
...
c4cacd402b
6 changed files with 193 additions and 201 deletions
|
@ -104,35 +104,56 @@ public class Window extends HorizontalBlock {
|
||||||
Hand handIn,
|
Hand handIn,
|
||||||
BlockRayTraceResult hit
|
BlockRayTraceResult hit
|
||||||
) {
|
) {
|
||||||
if (!worldIn.isRemote() && !player.isCrouching()) {
|
// Only process on the server side, avoid duplicating logic on client
|
||||||
MinecraftServer server = worldIn.getServer();
|
if (worldIn.isRemote()) return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||||
if (server == null) return ActionResultType.PASS;
|
// Do nothing if the player is crouching (commonly used for alternative interactions)
|
||||||
|
if (player.isCrouching()) return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||||
|
|
||||||
boolean goingToCustom = worldIn.getDimensionKey() != ModDimensions.World1;
|
// Get the server instance safely
|
||||||
|
if (worldIn.getServer() == null) return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||||
|
MinecraftServer server = worldIn.getServer();
|
||||||
|
|
||||||
ServerWorld targetWorld = (worldIn.getDimensionKey() == ModDimensions.World1)
|
// Check if in custom dimension; if so, teleport to Overworld
|
||||||
? server.getWorld(World.OVERWORLD)
|
if (worldIn.getDimensionKey() == ModDimensions.World1) {
|
||||||
: server.getWorld(ModDimensions.World1);
|
ServerWorld overWorld = server.getWorld(World.OVERWORLD);
|
||||||
|
if (overWorld != null) {
|
||||||
|
player.changeDimension(overWorld, new SimpleTeleporter(pos, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (worldIn.getDimensionKey() == ModDimensions.World1) {
|
// Set up for teleportation based on current dimension
|
||||||
ServerWorld overWorld = server.getWorld(World.OVERWORLD);
|
ServerWorld targetWorld;
|
||||||
if (overWorld != null) {
|
boolean goingToCustom = worldIn.getDimensionKey() != ModDimensions.World1;
|
||||||
player.changeDimension(overWorld, new SimpleTeleporter(pos, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetWorld != null) {
|
if (goingToCustom) {
|
||||||
SimpleTeleporter teleporter = new SimpleTeleporter(pos, goingToCustom);
|
// Teleporting from Overworld to custom dimension
|
||||||
player.changeDimension(targetWorld, teleporter);
|
targetWorld = server.getWorld(ModDimensions.World1);
|
||||||
}
|
} else {
|
||||||
|
// From custom dimension, teleport to Overworld
|
||||||
|
ServerWorld world1 = server.getWorld(ModDimensions.World1);
|
||||||
|
if (world1 != null) {
|
||||||
|
player.changeDimension(world1, new SimpleTeleporter(pos, true));
|
||||||
|
}
|
||||||
|
targetWorld = server.getWorld(World.OVERWORLD);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("[DEBUG] Portal activated on server!");
|
// Attempt teleport if a valid world was found
|
||||||
player.sendMessage(new StringTextComponent("Teleport logic running!"), player.getUniqueID());
|
if (targetWorld != null) {
|
||||||
player.sendMessage(new StringTextComponent("Teleport attempted!"), player.getUniqueID());
|
SimpleTeleporter teleporter = new SimpleTeleporter(pos, goingToCustom);
|
||||||
return ActionResultType.SUCCESS;
|
player.changeDimension(targetWorld, teleporter);
|
||||||
|
|
||||||
}
|
// Notify the player about the result
|
||||||
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
if (teleporter.wasSuccessful()) {
|
||||||
|
player.sendMessage(new StringTextComponent("Teleportation successful!"), player.getUniqueID());
|
||||||
|
} else {
|
||||||
|
player.sendMessage(new StringTextComponent("Teleportation failed: no safe location found."), player.getUniqueID());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to default processing if teleportation did not occur
|
||||||
|
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"variants": {
|
|
||||||
"main": {"model": "hdm_mod:block/window" }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,151 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"credit": "Made with Blockbench",
|
||||||
"textures" : {
|
"textures": {
|
||||||
"all": "hdm_mod:block/grey"
|
"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]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -1,151 +0,0 @@
|
||||||
{
|
|
||||||
"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]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "hdm_mod:block/window"
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue