Jump to content

Recommended Posts

Posted

Hey guys,

 

So I was wondering if there is an easy/simple way to use the cobblestone wall model for my own custom walls. I would like to use the vanilla model, so that my mod is compatible with resource packs that change the 3D model. At the moment I'm still in the process of figuring out what kinds of stuff my mod needs, and how to go about doing it. So I haven't looked much into it code wise yet. But to my knowledge I will need a lot of .json files per new wall block. Something like 8 .json files, I think.

So I would basically just want to know if there is a way to make it easier, so I maybe only need a couple of .json files per block, but I somehow doubt it's possible.

 

I have made this code for the new wall blocks to use, still a lot of stuff I need to add, but this is good enough for now.

public class BlockWall2 extends BlockWall
{

public BlockWall2(Block modelBlock)
{
	super(modelBlock);
	this.setResistance(10.0F);
	this.setHardness(1.5F);
	this.setCreativeTab(CreativeTabs.tabDecorations);
}

public int damageDropped(int meta)
{
	return meta;
}

public boolean canPlaceTorchOnTop(World world, int x, int y, int z)
    {
	return true;
}
}

 

I have make a quick and dirty blockstate

{
    "variants": {
        "east=false,north=false,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_post" },
        "east=false,north=true,south=false,up=false,west=false":  { "model": "hawm:wall_stonebrick_n" },
        "east=true,north=false,south=false,up=false,west=false":  { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=false":  { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=false,west=true":  { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=false":   { "model": "hawm:wall_stonebrick_ne" },
        "east=true,north=false,south=true,up=false,west=false":   { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=true":   { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=false,west=true":   { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=false":   { "model": "hawm:wall_stonebrick_ns" },
        "east=true,north=false,south=false,up=false,west=true":   { "model": "hawm:wall_stonebrick_ns", "y": 90, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=false":    { "model": "hawm:wall_stonebrick_nse" },
        "east=true,north=false,south=true,up=false,west=true":    { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=true":    { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=true":    { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=true":     { "model": "hawm:wall_stonebrick_nsew" },
        "east=false,north=false,south=false,up=true,west=false":  { "model": "hawm:wall_stonebrick_post" },
        "east=false,north=true,south=false,up=true,west=false":   { "model": "hawm:wall_stonebrick_n" },
        "east=true,north=false,south=false,up=true,west=false":   { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=false":   { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=true,west=true":   { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=false":    { "model": "hawm:wall_stonebrick_ne" },
        "east=true,north=false,south=true,up=true,west=false":    { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=true":    { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=true,west=true":    { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=false":    { "model": "hawm:wall_stonebrick_ns_above" },
        "east=true,north=false,south=false,up=true,west=true":    { "model": "hawm:wall_stonebrick_ns_above", "y": 90, "uvlock": true },
        "east=true,north=true,south=true,up=true,west=false":     { "model": "hawm:wall_stonebrick_nse" },
        "east=true,north=false,south=true,up=true,west=true":     { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=true":     { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=true":     { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=true,west=true":      { "model": "hawm:wall_stonebrick_nsew" }
    }
}

 

And for the rest of the .json files the code looks somewhat the same as this

{
    "parent": "block/wall_n",
    "textures": {
        "wall": "blocks/stonebrick"
    }
}

 

Basically the code is modified vanilla code, but for some reason it doesn't work.

 

If anyone can see why this isn't working I would love to know what I have done wrong.

Posted

You can use Forge's blockstate format to condense the number of JSONs required.

 

What exactly is not working? Are you getting the purple and black texture, or is something else wrong? Check your console log output for texture errors.

Good to know.

 

The only error message I get is this.

[17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true not found
[17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=false,up=false,variant=cobblestone,west=true not found
[17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=true,up=true,variant=cobblestone,west=true not found
[17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=true,south=true,up=false,variant=mossy_cobblestone,west=true not found
[17:34:42] [Client thread/ERROR] [FML]: Supressed additional 71 model loading errors for domain hawm

My problem is that it doesn't have the correct render. And is showing up as black and purple.

Posted

That's because your blockstate file does not include all of the block variants:

 

hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true

 

You can either use an UnlistedProperty for the stone type, or you need to include that variant in your blockstate file. I recommend using the Forge syntax - it will greatly reduce the number of files and lines you need to use.

Posted

That's because your blockstate file does not include all of the block variants:

 

hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true

 

You can either use an UnlistedProperty for the stone type, or you need to include that variant in your blockstate file. I recommend using the Forge syntax - it will greatly reduce the number of files and lines you need to use.

 

Yeah, I don't fully know why it want 'variant=cobblestone' because I don't have it listed in my code, I can only see it coming from the original BlockWall class. But I'm not sure. Anyway, I will look into the Forge syntax, and se if I can learn something new there.

 

Thanks for your help :)

Posted

Yes, it's from BlockWall. If you are not using it, you should override #createBlockState, #getStateFromMeta, and #getMetaFromState.

 

However, since the default state + properties are usually set in the constructor, you should check BlockWall's constructor and make sure it is not setting that property; if it is, you are probably better off just extending Block instead of BlockWall, though I'm not sure how much of an impact that will have on your custom wall's compatibility with other walls.

 

Another option would be to use a custom state mapper and ignore the variant state:

ModelLoader.setCustomStateMapper(yourBlock, (new StateMap.Builder()).addPropertiesToIgnore(VARIANT).build());

 

Posted

Yes, it's from BlockWall. If you are not using it, you should override #createBlockState, #getStateFromMeta, and #getMetaFromState.

 

However, since the default state + properties are usually set in the constructor, you should check BlockWall's constructor and make sure it is not setting that property; if it is, you are probably better off just extending Block instead of BlockWall, though I'm not sure how much of an impact that will have on your custom wall's compatibility with other walls.

 

Another option would be to use a custom state mapper and ignore the variant state:

ModelLoader.setCustomStateMapper(yourBlock, (new StateMap.Builder()).addPropertiesToIgnore(VARIANT).build());

 

I have tried most of the things you suggested, however none seems to work for me for some reason. I haven't tried using a custom state mapper, because I'm not familiar with how or where to use it correctly. Is it in class for itself, or is it somewhere in my block class?

Posted

You set custom state mappers at the same time you register your block models, typically from the ClientProxy (or a method call originating from there). You don't have to implement anything special in your Block class to do so.

 

Everything is working as intended now :)

 

Thanks a lot!

 

Now I just need to figure out how to make the block connect to vanilla walls, and vice versa. Also some minor bugs I have :)

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

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

×
×
  • Create New...

Important Information

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