Jump to content

Recommended Posts

Posted

Hello! I'm currently trying to make a custom ladder, and well, I can get 90% of it to work. The only part I cant do is actually making it function as a ladder. In the

Block Ladder

class of minecraft. It has the override method of

isLadder

. But when I try to apply it in my block class. It doesn't work. Also extending my class to BlockLadder causes my block to have the same properties as a ladder. The placement rules, block bound, etc. I just want the isLadder method to work in my class.

 

isLadder method

    @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }

 

If more code is needed. Please feel free to ask.

Posted

Don't have access to the code right now, but you may want to take a look at the other methods in the BlockLadder class, specifically the two #onEntityCollidedWithBlock methods. I believe that is where motionY is added the climbing entity, but if not, then you can use your IDE's search function to find the locations of BlockLadder and Blocks.ladder (or whatever it is called) in the code and inspect those to find out how ladders function.

Posted

So now I'm trying to make a custom ladder model when the ladder is by itself and one when its connected to another texture. I've looked at the cobblestone wall code and did pretty much what it said. But in the blockstates file for it. It had this

{
    "variants": {
        "east=false,north=false,south=false,up=false,west=false": { "model": "cobblestone_wall_post" },
        "east=false,north=true,south=false,up=false,west=false":  { "model": "cobblestone_wall_n" },
        "east=true,north=false,south=false,up=false,west=false":  { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=false":  { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=false,west=true":  { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=false":   { "model": "cobblestone_wall_ne" },
        "east=true,north=false,south=true,up=false,west=false":   { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=true":   { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=false,west=true":   { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=false":   { "model": "cobblestone_wall_ns" },
        "east=true,north=false,south=false,up=false,west=true":   { "model": "cobblestone_wall_ns", "y": 90, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=false":    { "model": "cobblestone_wall_nse" },
        "east=true,north=false,south=true,up=false,west=true":    { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=true":    { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=true":    { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=true":     { "model": "cobblestone_wall_nsew" },
        "east=false,north=false,south=false,up=true,west=false":  { "model": "cobblestone_wall_post" },
        "east=false,north=true,south=false,up=true,west=false":   { "model": "cobblestone_wall_n" },
        "east=true,north=false,south=false,up=true,west=false":   { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=false":   { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=true,west=true":   { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=false":    { "model": "cobblestone_wall_ne" },
        "east=true,north=false,south=true,up=true,west=false":    { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=true":    { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=true,west=true":    { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=false":    { "model": "cobblestone_wall_ns_above" },
        "east=true,north=false,south=false,up=true,west=true":    { "model": "cobblestone_wall_ns_above", "y": 90, "uvlock": true },
        "east=true,north=true,south=true,up=true,west=false":     { "model": "cobblestone_wall_nse" },
        "east=true,north=false,south=true,up=true,west=true":     { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=true":     { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=true":     { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=true,west=true":      { "model": "cobblestone_wall_nsew" }
    }
}

So I tried this for myself. But the in-game model wont load. Here is the error I get.

[16:11:25] [Client thread/ERROR] [FML]: Model definition for location scm:scaffolding_ladderr#east=false,facing=west,north=true,south=true,up=false,west=false not found
[16:11:25] [Client thread/ERROR] [FML]: Model definition for location scm:scaffolding_ladderr#east=false,facing=south,north=true,south=false,up=false,west=true not found
[16:11:25] [Client thread/ERROR] [FML]: Model definition for location scm:scaffolding_ladderr#east=true,facing=east,north=false,south=true,up=false,west=true not found
[16:11:25] [Client thread/ERROR] [FML]: Model definition for location scm:scaffolding_ladderr#east=true,facing=south,north=false,south=true,up=false,west=false not found

 

 

Here is my blockstate code.

{
    "variants":  {
    "east=false,north=false,south=true,up=false,west=false": { "model": "scm:scaffolding_ladderr_regular", "y": 90},
    "east=false,north=false,south=false,up=false,west=true": { "model": "scm:scaffolding_ladderr_regular", "y": 180},
    "east=false,north=true,south=false,up=false,west=false": { "model": "scm:scaffolding_ladderr_regular", "y": 270},  
    "east=false,north=false,south=false,up=false,west=false": { "model": "scm:scaffolding_ladderr_regular"},
    "east=true,north=false,south=false,up=false,west=false": { "model": "scm:scaffolding_ladderr_regular"}, 
    "east=false,north=false,south=false,up=true,west=false": {"model": "scm:scaffolding_ladderr"},
    "east=true,north=false,south=false,up=true,west=false": {"model": "scm:scaffolding_ladderr"},
    "east=false,north=false,south=true,up=true,west=false": { "model": "scm:scaffolding_ladderr", "y": 90},
    "east=false,north=false,south=false,up=true,west=true": { "model": "scm:scaffolding_ladderr", "y": 180},
    "east=false,north=true,south=false,up=true,west=false": { "model": "scm:scaffolding_ladderr", "y": 270}  
    }
}

 

I don't know what to do!

Posted

And your BlockState enum?

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

And your BlockState enum?

 

What is that? :P I'm having a huge brainfart right now :P

 

Here is my block class for the custom ladder:

 

public class scaffolding_ladderr extends Block
{
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool WEST = PropertyBool.create("west");



public scaffolding_ladderr(Material materialIn) {
	super(Material.wood);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
//		this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F);
	this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.4F);

}

@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
	IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, placer);
	state = state.withProperty(FACING, placer.getHorizontalFacing());
	return state;
}

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
	return state.withProperty(UP, Boolean.valueOf(!world.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(isScaffoldingLadder(world, pos.north()))).withProperty(EAST, Boolean.valueOf(isScaffoldingLadder(world, pos.east()))).withProperty(SOUTH, Boolean.valueOf(isScaffoldingLadder(world, pos.south()))).withProperty(WEST, Boolean.valueOf(isScaffoldingLadder(world, pos.west())));
}


@Override
protected BlockState createBlockState()
{
	return new BlockState(this, new IProperty[] { NORTH, EAST, SOUTH, WEST, FACING, UP });
}

public boolean isScaffoldingLadder(IBlockAccess world, BlockPos pos)
{
	return world.getBlockState(pos).getBlock() == this;
}

 public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (iblockstate.getBlock() == this)
        {
            float f = 0.125F;

            switch ((EnumFacing)iblockstate.getValue(FACING))
            {
                case NORTH:
                    this.setBlockBounds(0.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.2F);
                    break;
                case SOUTH:
            		this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.2F);
//	                    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                    break;
                case WEST:
                    this.setBlockBounds(0.8F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                    break;
                case EAST:
                default:
                    this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.2F, 1.0F, 1.0F);
            }
        }
    }


@Override
public int getMetaFromState(IBlockState state)
{
	return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex();
}

  @Override
public boolean isOpaqueCube() {
	  return false;
}
  
  @Override
public boolean isFullCube() {
	  return false;
}
  
  @Override
public boolean isLadder(IBlockAccess world, BlockPos pos,
		EntityLivingBase entity) {
	return true;
}

}

Posted

You might be having issues because you created your own Boolean values for each of the directions, when those already exist as EnumFacing. Delete these lines:

public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool WEST = PropertyBool.create("west");

And change any references to them to use EnumFacing.WHATEVER_DIRECTION instead.

Posted

ladders don't work as you might expect.

 

what you need to do is to override isLadder method on the block and return true, and then your block will behave like vanilla ladder.... if it is so small that the player is inside the block space. that lame thing is hardcoded into mc code. by inside i mean player's x,z coordinate being the same as the block's.

 

you said "this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.4F);"... that's almost half the block. maybe that's small enough, i don't know... but you can't climb from sides...

 

you can even do full side ladder - i made a 0.8 wide tree log climbable from all 4 sides with no code except the isLadder override  - but the thing is, user needs to enable that behavior in forge settings (it can be done in game (from the main menu -> mods button), no need to edit config files). oh well.

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.