Jump to content

Recommended Posts

Posted
11 minutes ago, Mintry said:

i’m on 1.12.2 and i’ll share my code tomorrow after school

You'll have to create a custom JSon model or if you want to be fancy like Ore Spawn and make it all smooth you can use an obj file.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
9 hours ago, Animefan8888 said:

You'll have to create a custom JSon model or if you want to be fancy like Ore Spawn and make it all smooth you can use an obj file.

How would I create a custom json? Using something like blockbench? And how would I replace the json I have with the newly made one

Posted
3 hours ago, Mintry said:

How would I create a custom json? Using something like blockbench?

If you want you can or you can write it yourself.

 

3 hours ago, Mintry said:

And how would I replace the json I have with the newly made one

Switch the files.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I switched the jsons but i get this message, when i load the game, my sword is not visible, not even the black and pink thing.

[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: The following texture errors were found.
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   DOMAIN minecraft
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: --------------------------------------------------
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   domain minecraft is missing 2 textures
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     domain minecraft has 3 locations:
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.DefaultResourcePack : Default
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Forge Mod Loader
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Minecraft Forge
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain minecraft are:
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/linarite_block.png
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/block/linarite_block.png
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     No other errors exist for domain minecraft

 

json

{
    "credit": "Made with Blockbench",
    "parent": "item/handheld",
    "textures": {
        "1": "linarite_block",
        "2": "block/linarite_block",
        "particle": "block/linarite_block"
    },
    "elements": [
        {
            "from": [7, 0, 7],
            "to": [10, 8, 8],
            "faces": {
                "north": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "east": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "south": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "west": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "up": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "down": {"uv": [0, 0, 3, 8], "texture": "#1"}
            }
        },
        {
            "from": [2, 8, 7],
            "to": [15, 9, 8],
            "faces": {
                "north": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 13, 1], "texture": "#2"}
            }
        },
        {
            "from": [5, 8.9, 6],
            "to": [12, 29, 9],
            "faces": {
                "north": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "east": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "south": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "west": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "up": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "down": {"uv": [0, 0, 7, 16], "texture": "#1"}
            }
        },
        {
            "from": [5, 28.9, 6],
            "to": [12, 30, 9],
            "faces": {
                "north": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "down": {"uv": [0, 0, 5, 1.1], "texture": "#1"}
            }
        },
        {
            "from": [6, 29.9, 7],
            "to": [11, 31, 8],
            "faces": {
                "north": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 5, 1], "texture": "#1"},
                "down": {"uv": [0, 0, 5, 1], "texture": "#1"}
            }
        },
        {
            "from": [7, 30.9, 7],
            "to": [10, 32, 8],
            "faces": {
                "north": {"uv": [0, 0, 3, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 3, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 3, 1], "texture": "#1"},
                "down": {"uv": [0, 0, 3, 1], "texture": "#1"}
            }
        },
        {
            "from": [2, 9, 7],
            "to": [3, 12, 8],
            "faces": {
                "north": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "south": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "up": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 1, 1], "texture": "#2"}
            }
        },
        {
            "from": [14, 9, 7],
            "to": [15, 12, 8],
            "faces": {
                "north": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "south": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "up": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 1, 1], "texture": "#2"}
            }
        },
        {
            "from": [2, 12, 7],
            "to": [4, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        },
        {
            "from": [2, 12, 7],
            "to": [4, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        },
        {
            "from": [13, 12, 7],
            "to": [15, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        }
    ]
}

Posted

The texture file locations in the Json are wrong. Specifically, they're missing a domain, which means that "minecraft" is defaulted to. Since your textures aren't located in "minecraft", you need to prefix the texture locations with their proper domain, which is probably your modId. You should also make sure that the paths correspond to actual file paths and locations.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
2 minutes ago, SerpentDagger said:

The texture file locations in the Json are wrong. Specifically, they're missing a domain, which means that "minecraft" is defaulted to. Since your textures aren't located in "minecraft", you need to prefix the texture locations with their proper domain, which is probably your modId. You should also make sure that the paths correspond to actual file paths and locations.

How would i prefix the texture locations with my modid?

and also, how can i use an obj model for my mod

Posted
9 minutes ago, Mintry said:

How would i prefix the texture locations with my modid?

For example, instead of "block/linarite_block", you would write "modidinsteadofthistext:block/linarite_block". Also, "block" there should be "blocks" if it's meant to reference a texture at modidinsteadofthistext/textures/blocks/linarite_block, and ditto for the others.

 

14 minutes ago, Mintry said:

how can i use an obj model for my mod

I haven't used obj models myself, since I like the blocky look, but this topic might be helpful to you.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
8 minutes ago, SerpentDagger said:

For example, instead of "block/linarite_block", you would write "modidinsteadofthistext:block/linarite_block". Also, "block" there should be "blocks" if it's meant to reference a texture at modidinsteadofthistext/textures/blocks/linarite_block, and ditto for the others.

 

I haven't used obj models myself, since I like the blocky look, but this topic might be helpful to you.

thanks, but i still get an error and my item still doesnt have its model working

 

The following texture errors were found.
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   DOMAIN rotbm
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: --------------------------------------------------
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   domain rotbm is missing 1 texture
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     domain rotbm has 1 location:
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       mod rotbm resources at C:\Users\Kiren\Desktop\Minecraft Modding\RuinsOfTime\bin
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain rotbm are:
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/linarite_block.png
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     No other errors exist for domain rotbm
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

Posted

{
    "credit": "Made with Blockbench",
    "parent": "item/handheld",
    "textures": {
        "1": "rotbm:linarite_block",
        "2": "rotbm:blocks/linarite_block",
        "particle": "rotbm:blocks/linarite_block"
    },
    "elements": [
        {
            "from": [7, 0, 7],
            "to": [10, 8, 8],
            "faces": {
                "north": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "east": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "south": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "west": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "up": {"uv": [0, 0, 3, 8], "texture": "#1"},
                "down": {"uv": [0, 0, 3, 8], "texture": "#1"}
            }
        },
        {
            "from": [2, 8, 7],
            "to": [15, 9, 8],
            "faces": {
                "north": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 13, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 13, 1], "texture": "#2"}
            }
        },
        {
            "from": [5, 8.9, 6],
            "to": [12, 29, 9],
            "faces": {
                "north": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "east": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "south": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "west": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "up": {"uv": [0, 0, 7, 16], "texture": "#1"},
                "down": {"uv": [0, 0, 7, 16], "texture": "#1"}
            }
        },
        {
            "from": [5, 28.9, 6],
            "to": [12, 30, 9],
            "faces": {
                "north": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "down": {"uv": [0, 0, 5, 1.1], "texture": "#1"}
            }
        },
        {
            "from": [6, 29.9, 7],
            "to": [11, 31, 8],
            "faces": {
                "north": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 5, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 5, 1], "texture": "#1"},
                "down": {"uv": [0, 0, 5, 1], "texture": "#1"}
            }
        },
        {
            "from": [7, 30.9, 7],
            "to": [10, 32, 8],
            "faces": {
                "north": {"uv": [0, 0, 3, 1.1], "texture": "#1"},
                "east": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "south": {"uv": [0, 0, 3, 1.1], "texture": "#1"},
                "west": {"uv": [0, 0, 1, 1.1], "texture": "#1"},
                "up": {"uv": [0, 0, 3, 1], "texture": "#1"},
                "down": {"uv": [0, 0, 3, 1], "texture": "#1"}
            }
        },
        {
            "from": [2, 9, 7],
            "to": [3, 12, 8],
            "faces": {
                "north": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "south": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "up": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 1, 1], "texture": "#2"}
            }
        },
        {
            "from": [14, 9, 7],
            "to": [15, 12, 8],
            "faces": {
                "north": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "south": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 3], "texture": "#2"},
                "up": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 1, 1], "texture": "#2"}
            }
        },
        {
            "from": [2, 12, 7],
            "to": [4, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        },
        {
            "from": [2, 12, 7],
            "to": [4, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        },
        {
            "from": [13, 12, 7],
            "to": [15, 13, 8],
            "faces": {
                "north": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "south": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
                "up": {"uv": [0, 0, 2, 1], "texture": "#2"},
                "down": {"uv": [0, 0, 2, 1], "texture": "#2"}
            }
        }
    ]
}

 

Posted
57 minutes ago, Mintry said:

[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain minecraft are:
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/linarite_block.png
[18:02:34] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/block/linarite_block.png

 

11 minutes ago, Mintry said:

[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain rotbm are:
[18:49:50] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/linarite_block.png

You've cleared up one of them, as you can see in the error log, but it's still missing the texture at textures/linarite_block.png. That's the location referred to by the line here:

12 minutes ago, Mintry said:

"1": "rotbm:linarite_block",

It's looking in the domain "rotbm", but there are no subfolders specified. I'm not sure what the path you mean to be pointing to is, but if it's the same linarite_block.png as the other one, the path should probably look more like blocks/linarite_block, as with the others.

 

Each of the lines like the one above is specifying a ResourceLocation, and ResourceLocations are of the form domain:path. The domain is the folder within assets, and the path is the file path from a context-specific location to the proper file. In the case of textures, that context-specific location is the textures file within domain. Therefore, when you provide a location domain:filename, in the case of textures it looks for the file filename.png in the path domain/textures/filename.png.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
6 minutes ago, SerpentDagger said:

 

You've cleared up one of them, as you can see in the error log, but it's still missing the texture at textures/linarite_block.png. That's the location referred to by the line here:

It's looking in the domain "rotbm", but there are no subfolders specified. I'm not sure what the path you mean to be pointing to is, but if it's the same linarite_block.png as the other one, the path should probably look more like blocks/linarite_block, as with the others.

 

Each of the lines like the one above is specifying a ResourceLocation, and ResourceLocations are of the form domain:path. The domain is the folder within assets, and the path is the file path from a context-specific location to the proper file. In the case of textures, that context-specific location is the textures file within domain. Therefore, when you provide a location domain:filename, in the case of textures it looks for the file filename.png in the path domain/textures/filename.png.

thanks, but im just wandering if there is an easier way to make my sword reaaaally big

Posted
4 minutes ago, Mintry said:

im just wandering if there is an easier way to make my sword reaaaally big

Well, once the Json is working, then you can alter its scale however you want.

For example, in my wand's model file I have these custom scales to keep it looking the right size from different viewpoints, but I could alter them just to make the wand huge too.

Spoiler

"display": {
        "gui": {
            "rotation": [ 36, 232, 37 ],
            "translation": [ 0, 0.5, 0 ],
            "scale": [ 1.125, 1.125, 1.125 ]
        },
        "ground": {
            "rotation": [ 90, 0, 0 ],
            "translation": [ 0, 3, 0 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        },
        "fixed": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 1, 1, 1 ]
        },
        "head": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 12, 0 ],
            "scale": [ 2, 2, 2 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, 302, 0 ],
            "translation": [ -1, 1, 0 ],
            "scale": [ 1.1, 1.1, 1.1 ]
        },
        "thirdperson_righthand": {
            "rotation": [ 342, 296, 13 ],
            "translation": [ 0, 2.5, -2 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        }
    }

2019-10-09_16_43_16.thumb.png.6903c3f6ab726d5d79482f5e0b5b51f3.png2019-10-09_16_37_28.thumb.png.bf0f0c0c100ac78986602af89b149cf0.png

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
1 hour ago, SerpentDagger said:

 

You've cleared up one of them, as you can see in the error log, but it's still missing the texture at textures/linarite_block.png. That's the location referred to by the line here:

It's looking in the domain "rotbm", but there are no subfolders specified. I'm not sure what the path you mean to be pointing to is, but if it's the same linarite_block.png as the other one, the path should probably look more like blocks/linarite_block, as with the others.

 

Each of the lines like the one above is specifying a ResourceLocation, and ResourceLocations are of the form domain:path. The domain is the folder within assets, and the path is the file path from a context-specific location to the proper file. In the case of textures, that context-specific location is the textures file within domain. Therefore, when you provide a location domain:filename, in the case of textures it looks for the file filename.png in the path domain/textures/filename.png.

can i use the same block(lyranite block) for all 3(1,2 particles)

Posted
1 hour ago, Mintry said:

can i use the same block(lyranite block) for all 3(1,2 particles)

If it's the same texture, then you can definitely use the same file, and should.

 

32 minutes ago, Mintry said:

could you please show me a screenshot of your json

Spoiler

{
    "__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
    "textures": {
        "redstone_block": "minecraft:blocks/redstone_block",
        "planks_big_oak": "minecraft:blocks/planks_big_oak",
        "glass_red": "minecraft:blocks/glass_red"
    },
    "display": {
        "gui": {
            "rotation": [ 36, 232, 37 ],
            "translation": [ 0, 0.5, 0 ],
            "scale": [ 1.125, 1.125, 1.125 ]
        },
        "ground": {
            "rotation": [ 90, 0, 0 ],
            "translation": [ 0, 3, 0 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        },
        "fixed": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 1, 1, 1 ]
        },
        "head": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 12, 0 ],
            "scale": [ 2, 2, 2 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, 302, 0 ],
            "translation": [ -1, 1, 0 ],
            "scale": [ 1.1, 1.1, 1.1 ]
        },
        "thirdperson_righthand": {
            "rotation": [ 342, 296, 13 ],
            "translation": [ 0, 2.5, -2 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        }
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 7.5, 0, 7.5 ], 
            "to": [ 8.5, 13.75, 8.5 ], 
            "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#planks_big_oak", "uv": [ 12, 1, 13, 14.75 ] },
                "east": { "texture": "#planks_big_oak", "uv": [ 8, 2, 9, 15.75 ] },
                "south": { "texture": "#planks_big_oak", "uv": [ 3, 3, 4, 16 ] },
                "west": { "texture": "#planks_big_oak", "uv": [ 10, 1, 11, 14.75 ] },
                "up": { "texture": "#planks_big_oak", "uv": [ 2, 3, 3, 4 ] },
                "down": { "texture": "#planks_big_oak", "uv": [ 7, 2, 8, 3 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "z", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "x", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "y", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7.25, -0.25, 7.25 ], 
            "to": [ 8.75, 1.25, 8.75 ], 
            "faces": {
                "north": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "east": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "south": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "west": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "up": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "down": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] }
            }
        }
    ]
}

Basically, it just defines some texture references, lists the display properties, then supplies a list of elements that use the texture references.

There's a link to the generator at the top of the file. It doesn't work with custom texture locations, but you can just use random textures while creating the model and then change the references once it's generated by using find and replace.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
18 hours ago, SerpentDagger said:

If it's the same texture, then you can definitely use the same file, and should.

 

  Hide contents

{
    "__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
    "textures": {
        "redstone_block": "minecraft:blocks/redstone_block",
        "planks_big_oak": "minecraft:blocks/planks_big_oak",
        "glass_red": "minecraft:blocks/glass_red"
    },
    "display": {
        "gui": {
            "rotation": [ 36, 232, 37 ],
            "translation": [ 0, 0.5, 0 ],
            "scale": [ 1.125, 1.125, 1.125 ]
        },
        "ground": {
            "rotation": [ 90, 0, 0 ],
            "translation": [ 0, 3, 0 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        },
        "fixed": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 1, 1, 1 ]
        },
        "head": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ 0, 12, 0 ],
            "scale": [ 2, 2, 2 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, 302, 0 ],
            "translation": [ -1, 1, 0 ],
            "scale": [ 1.1, 1.1, 1.1 ]
        },
        "thirdperson_righthand": {
            "rotation": [ 342, 296, 13 ],
            "translation": [ 0, 2.5, -2 ],
            "scale": [ 0.775, 0.775, 0.775 ]
        }
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 7.5, 0, 7.5 ], 
            "to": [ 8.5, 13.75, 8.5 ], 
            "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#planks_big_oak", "uv": [ 12, 1, 13, 14.75 ] },
                "east": { "texture": "#planks_big_oak", "uv": [ 8, 2, 9, 15.75 ] },
                "south": { "texture": "#planks_big_oak", "uv": [ 3, 3, 4, 16 ] },
                "west": { "texture": "#planks_big_oak", "uv": [ 10, 1, 11, 14.75 ] },
                "up": { "texture": "#planks_big_oak", "uv": [ 2, 3, 3, 4 ] },
                "down": { "texture": "#planks_big_oak", "uv": [ 7, 2, 8, 3 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "z", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "x", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7, 13, 7 ], 
            "to": [ 9, 15, 9 ], 
            "rotation": { "origin": [ 8, 14, 8 ], "axis": "y", "angle": -45.0 },
            "faces": {
                "north": { "texture": "#glass_red", "uv": [ 12, 1, 14, 3 ] },
                "east": { "texture": "#glass_red", "uv": [ 8, 2, 10, 4 ] },
                "south": { "texture": "#glass_red", "uv": [ 3, 3, 5, 5 ] },
                "west": { "texture": "#glass_red", "uv": [ 10, 1, 12, 3 ] },
                "up": { "texture": "#glass_red", "uv": [ 2, 3, 4, 5 ] },
                "down": { "texture": "#glass_red", "uv": [ 7, 2, 9, 4 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7.25, -0.25, 7.25 ], 
            "to": [ 8.75, 1.25, 8.75 ], 
            "faces": {
                "north": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "east": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "south": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "west": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "up": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] },
                "down": { "texture": "#redstone_block", "uv": [ 0, 0, 16, 16 ] }
            }
        }
    ]
}

Basically, it just defines some texture references, lists the display properties, then supplies a list of elements that use the texture references.

There's a link to the generator at the top of the file. It doesn't work with custom texture locations, but you can just use random textures while creating the model and then change the references once it's generated by using find and replace.

Oh, so I can use vanilla items/blocks for the textures. It doesn’t have to be custom textures?

Posted
32 minutes ago, Mintry said:

so I can use vanilla items/blocks for the textures. It doesn’t have to be custom textures?

That's correct. Just so long as the references defined at the top within the "textures" section point to valid locations within your assets folder, the textures will work fine. The trouble you were having was simply that the locations you defined in the json didn't correspond with the actual locations of the file.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
9 minutes ago, SerpentDagger said:

That's correct. Just so long as the references defined at the top within the "textures" section point to valid locations within your assets folder, the textures will work fine. The trouble you were having was simply that the locations you defined in the json didn't correspond with the actual locations of the file.

So I have to put the textures in textures folder? Or do I just write the name of the block in the json

Posted (edited)
21 minutes ago, Mintry said:

So I have to put the textures in textures folder? Or do I just write the name of the block in the json

"1": "rotbm:linarite_block",

21 hours ago, SerpentDagger said:

Each of the lines like the one above is specifying a ResourceLocation, and ResourceLocations are of the form domain:path. The domain is the folder within assets, and the path is the file path from a context-specific location to the proper file. In the case of textures, that context-specific location is the textures file within domain. Therefore, when you provide a location domain:filename, in the case of textures it looks for the file filename.png in the path domain/textures/filename.png.

For custom textures:

    You should store block textures in textures/blocks/block_texture_file_here.png.

    You should store item textures in textures/items/item_texture_file_here.png.

    Since the custom texture does not exist in the domain "minecraft", as it is not a Minecraft texture, you use the domain that it does exist in instead when

      specifying the location within the json file. In your case that would be the domain "rotbm". The path from that domain's textures folder follows the

      domain, as explained above.

For vanilla textures:

    They already exist, you shouldn't store them because they're already there.

    Since the vanilla texture already exists in the domain "minecraft", you use the domain "minecraft" when specifying the location within the json file. The

      path from the domain's textures folder follows the domain, as explained above.

    Alternatively, if no domain is specified, the default is "minecraft" already. You still need to supply the path though.

Edited by SerpentDagger

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
1 hour ago, SerpentDagger said:

"1": "rotbm:linarite_block",

For custom textures:

    You should store block textures in textures/blocks/block_texture_file_here.png.

    You should store item textures in textures/items/item_texture_file_here.png.

    Since the custom texture does not exist in the domain "minecraft", as it is not a Minecraft texture, you use the domain that it does exist in instead when

      specifying the location within the json file. In your case that would be the domain "rotbm". The path from that domain's textures folder follows the

      domain, as explained above.

For vanilla textures:

    They already exist, you shouldn't store them because they're already there.

    Since the vanilla texture already exists in the domain "minecraft", you use the domain "minecraft" when specifying the location within the json file. The

      path from the domain's textures folder follows the domain, as explained above.

    Alternatively, if no domain is specified, the default is "minecraft" already. You still need to supply the path though.

i made the domain minecraft because i decided im gonna use vanilla textures. but i get this error

13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   DOMAIN minecraft
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: --------------------------------------------------
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:   domain minecraft is missing 3 textures
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     domain minecraft has 3 locations:
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.DefaultResourcePack : Default
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Forge Mod Loader
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Minecraft Forge
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain minecraft are:
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/iron_block.png
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/lapis_block.png
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:       textures/gold_block.png
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]:     No other errors exist for domain minecraft
[19:02:13] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ==================================================

Posted
44 minutes ago, Animefan8888 said:

This needs to be textures/block/iron_block

yea i fixed that, but when i load my game, the model is black and purple and has a weird texture

 

Captdsure.PNG

Posted
1 hour ago, Mintry said:

 yea i fixed that, but when i load my game, the model is black and purple and has a weird texture

What does it say in the console? My guess is that your blockstate is missing the inventory variant.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.