Jump to content

Recommended Posts

Posted

I encountered difficulty when trying to make a blockstate for a block with rotation like a log, or a hay bale. I've read this and this, and I know that `hay_bale` has an `axis` property with three values `x`, `y`, and `z`. I haven't been able to make the rotations work (the block shows up as a blank texture in world). If I leave off the `axis` property entirely, the block renders properly (just, without rotation). 

 

When I looked around at other mods (botania, harvestcraft) for examples of blocks with rotation, they are using minecraft blockstates (like, `"axis=x": {}`) rather than forge blockstates. I also poked through the blockstates folders of some jabelar's mods, but without knowing exactly what I'm looking for it's like...

 

looking for a needle in a hay stack?

 

My class is very simple and just extends `HayBlock`. My blockstate looks like this:

 

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "tutorial:blocks/tatami"
    },
    "uvlock": true,
    "model": "cube_all"
  },
  "variants": {
    "normal": [{ }],
    "inventory": [{ }],
    "axis": {
      "x": { "y": 0 },
      "y": { },
      "z": { "y": 90 }
    }
  }
}

 

What is my misconception?

 

Thanks for your advice in advance!

Posted
34 minutes ago, Zeigfreid said:

"y": { },

Don't have empty variants. It isn't supposed to be empty anyway - if the X axis is the default one and the Z is rotated by 90 degrees on the Y axis then the Y variant should be rotated by 90 degrees on either X or Z axis. 

34 minutes ago, Zeigfreid said:

examples of blocks with rotation, they are using minecraft blockstates (like, `"axis=x": {}`) rather than forge blockstates. I also poked through the blockstates folders of some jabelar's mods, but without knowing exactly what I'm looking for it's like...

Here is my example of using a blockstate with rotation.

 

34 minutes ago, Zeigfreid said:

If I leave off the `axis` property entirely, the block renders properly (just, without rotation). 

This actually means that your block doesn't have the rotation property at all, since if it had a property that wasn't specified in it's blockstate file it would have a missing model since it's blockstate file is invalid. Either you are not relaying the correct information or you don't have the property in your BlockStateContainer.

 

34 minutes ago, Zeigfreid said:

My class is very simple and just extends `HayBlock`.

Show it anyway, you have some conflicting information here.

  • Like 1
Posted (edited)

Thanks! Here's the class, but it is honestly just HayBlock.

 

package net.shadowfacts.tutorial;

import net.minecraft.block.BlockHay;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class BlockTatami extends BlockHay implements ItemModelProvider {

	public BlockTatami () {
		super();

		setUnlocalizedName("tatami");
		setRegistryName("tatami");
	}
	
	@Override
	public void registerItemModel(Item item) {
		TutorialMod.proxy.registerItemRenderer(item, 0, "tatami");
	}
	
	/* unfortunately, tatami will not save you from a fall */
    public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
    {
    	// NO-OP
    }
}

 

(oh I just noticed that I missed an @Override ? )

 

(also, I realize that repeating hard coded strings is a bad idea, I'm just trying to get it working)

Edited by Zeigfreid
Posted (edited)

Hmm yeah definitely not working. I changed the json to this: 

 

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "tutorial:blocks/tatami"
    },
    "uvlock": true,
    "model": "cube_all"
  },
  "variants": {
    "normal": [
      {}
    ],
    "inventory": [
      {}
    ],
    "axis": {
      "x": {
        "textures": {
          "all": "tutorial:blocks/orecopper"
        },
        "model": "cube_all",
        "x": 90,
        "y": 90
      },
      "y": {
        "model": "cube_all"
      },
      "z": {
        "model": "cube_all",
        "x": 90
      }
    }
  }
}

 

In the hopes. When I place a block on the x axis I should get an oreCopper, but I don't! So there must be something I'm missing elsewhere.

 

I extend from BayHale and when I use the minecraft blockstates like "axis=x" and "axis=y" in my json I get the default texture, but the texture has "tatami#axis=z" or "tatami#axis=y" written on it, so in that case I know that the rotation is working. When I use the forge blockstates though, I just see the blank texture, or (once I added those `model: cube_all` lines, which I had assumed would be redundant) I get just the default tatami model. So... so something's up.

 

Your `BlockLog` class extends BlockRotatedPillar directly, where as I was extending BlockHay (which is a really simple class that adds very little, and I figure a tatami mat is very close to a bale of hay in principle). Maybe I will try to extend BlockRotatePillar instead.

 

Anyway, I have your repo to dig around in now (thanks) so I'm sure I will be able to figure it out!

 

Thanks!

Edited by Zeigfreid
Posted

Don’t use IHasModel (or something similar I.e. ItemModelProvider). Nothing to do with model registration requires private/protected access. You can register all your models in 3 lines of code. Also don’t implement it on a Block. Also interface names should start with “I”.

 

Did you try looking at the vanilla hay blockstate?

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Thanks for the lint Cadiboo ;) I did in fact try looking at the `hay_block.json` file in `assets.mincraft.blockstats`, but I received an error :( "Problems opening editor for hay_block.json: System editor can only open file base resources".

Posted

JSON is just a glorified text file. If your using Eclipse you can install a JSON plugin or you can install some other text editor. I suggest Sublime Text as it has amazing text highlighting and even some syntax highlighting. It’s very intuitive and built for programmers and I’ve never had a single issue with it. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Hmm, Cadiboo it isn't that I am unable to edit JSON files at all (I edited the one above, right?) it's that when I try to open a JSON file in assets.minecraft.blockstates I get an error. I get a similar error if I try to open a png from assets.minecraft.textures.blocks. I think it is because these files are in a jar? It's weird though because I can open a .class file from net.minecraft.client.main so...

Posted

What OS are you on? I know that native editors on OSX restrict editing in /Library/, and I assume other operating systems might do something similar. But reading and copying shouldn’t be restricted

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

Ah problem solved! I am now able to view JSON files. The key was I had so far been using an external editor to work with my own JSON files (vscode). An external editor isn't allowed to open files from inside a jar maybe? Anyway, when I set the default open with to eclipse's internal generic text editor I was then able to open hay_bale.json. However, as expected, it is a minecraft blockstate not a forge blockstate...

 

{
    "variants": {
        "axis=y": { "model": "hay" },
        "axis=z": { "model": "hay", "x": 90 },
        "axis=x": { "model": "hay", "x": 90, "y": 90 }
    }
}

 

(but I'm glad to have the correct rotations)

Edited by Zeigfreid
Posted

You really don’t need forges blockstate, it’s meant for more complicated stuff. Use that blockstate and just substitute in your block & mod and your done

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
3 minutes ago, Zeigfreid said:

I'm going to copy/paste the implementation of `BlockRotatedPillar` and fill it with `println` statements to get a sense of what is and isn't happening.

This is a good idea in general, however it probably won’t really help as models aren’t handled in your block’s code.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Hmm if I define separate textures for each facing I am able to get those separate textures to show. For example:

 

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "tutorial:blocks/tatami"
    },
    "uvlock": true,
    "model": "cube_all",
    "transform": "forge:default-block"
  },
  "variants": {
    "normal": [
      {}
    ],
    "inventory": [
      {}
    ],
    "axis": {
      "y": { 
        "textures": {
          "all": "tutorial:blocks/orecopper"
        },
        "model": "cube_all"
      },
      "z": {
        "model": "cube_all",
        "x": 90
      },
      "x": {
        "model": "cube_all",
        "x": 90,
        "y": 90
      }
    }
  }
}

 

In this case, the orecopper texture shows when I place the block against the y axis. In addition, when I view the debug info with F3 I am able to see that the blocks variant is being chosen correctly. So the correct variant is being chosen based on the property value. It's the rotation that isn't happening.

 

I've double checked my rotation values against the hay_block.json values, and then I also took time to "figure out" an intuition for which rotation corresponds which which action on the block in the world (I was kind of flying blind). If I click against the a block face that lies in a plane normal to the x axis, then I am selecting axis=x. With a bale of hey I see a rotation of the block 90 degrees around the x axis and then 90 degrees around the y axis (which is vertical). I've convinced myself that if the rotations were happening, I would definitely be seeing the orientations that I want to see.

 

That being said: looks like its back to the tutorial mines for me!

Posted
7 hours ago, Cadiboo said:

You really don’t need forges blockstate, it’s meant for much more complicated stuff. Use the vanilla hay_bale blockstate and just substitute in your block & mod and your done!

 

  • Thanks 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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