Jump to content

[SOLVED] [1.8.9] Wrong texture variant when placing log horizontally


Recommended Posts

Posted

I'm trying to create custom logs. The overall goal is that if you sneak while breaking a log, it drops bark and gets replaced with a stripped log. I've created a custom block class for the properties and a corresponding item class. I have two variants so far, oak and birch. Everything is working fine, except that when I place the stripped oak horizontally, it uses the birch texture instead. Any idea what's going on?

 

My custom log block class:

 

  Reveal hidden contents

 

My log item class:

 

  Reveal hidden contents

 

The block register class:

 

  Reveal hidden contents

 

JSON files for stripped oak variant:

 

  Reveal hidden contents

 

Posted

Your getMetaFromState is fucked up.

 

 int i = b0 | ((PrimalBlockLog.EnumWoodType)state.getValue(VARIANT)).getMetadata();

 

Well, b0 was already 0, so I don't see what the point was.

 

            case 1:
                i = 4;
                break;

 

You know what, fuck it, just overwrite the value, we didn't need it.

 

Not actually a problem, but in your getStateFromMeta:

 

((meta & 3) % 4))

 

(meta & 3) already returns a value, [0-3] so why the %4?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well, that was dumb of me. New getMetaFromState:

 

   public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((PrimalBlockStrippedLog.EnumWoodType)state.getValue(VARIANT)).getMetadata();
    	
        switch (PrimalBlockStrippedLog.SwitchEnumAxis.AXIS_LOOKUP[((PrimalBlockStrippedLog.EnumAxis)state.getValue(LOG_AXIS)).ordinal()])
        {
            case 1:
                i |= 4;
                break;
            case 2:
                i |= 8;
                break;
            case 3:
                i |= 12;
        }

        return i;
    }

 

Seems to be working great so far. Thanks for the tip.

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



×
×
  • Create New...

Important Information

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