Jump to content

[1.8.9] Custom ladder?


DuckCreeper

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
}

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

    • This is a MacOs related issue: https://bugs.mojang.com/browse/MC-118506     Download this lib: https://libraries.minecraft.net/ca/weblite/java-objc-bridge/1.0.0/java-objc-bridge-1.0.0.jar and put it into ~/Library/Application Support/minecraft/libraries/ca/weblite/java-objc-bridge/1.0.0  
    • I use Bisect-Hosting, and I host a relatively modded server.  There is a mod I desperately want to have in a server. https://www.curseforge.com/minecraft/mc-mods/minehoplite This is MineHop. It's a mod that replicates the movement capabilities seen in Source Engine games, such as Half-Life, and such.  https://youtu.be/SbtLo7VbOvk - A video explaining the mod, if anyone is interested.  It is a clientside mod, meaning whoever is using it can change anything about the mod that they want, with no restrictions, even when they join a server with the same mod. They can change it to where they can go infinitely fast, or do some other overpowered thing. I don't want that to happen. So I just want to know if there is some way to force the SERVER'S configuration file, onto whoever is joining.  I'm not very savvy with all this modding stuff. There are two config files: minehop-common.txt, and minehop.txt I don't really know much about how each are different. I just know what the commands relating to acceleration and stuff mean.    
    • My journey into crypto trading began tentatively, with me dipping my toes into the waters by purchasing my first Bitcoin through a seasoned trader. With an initial investment of $5,000, I watched as my investment grew, proving to be both fruitful and lucrative. Encouraged by this success, I decided to increase my investment to $150,000, eager to capitalize on the growing popularity of cryptocurrency, However, as cryptocurrency gained mainstream attention, so too did the number of self-proclaimed "experts" in the field. Suddenly, everyone seemed to be a crypto guru, and more and more people were eager to jump on the bandwagon without fully understanding the intricacies of this complex world. With promises of quick and easy profits, these con artists preyed on the uninformed, luring them into schemes that often ended in disappointment and financial loss. Unfortunately, I fell victim to one such scheme. Seduced by the allure of easy money, I entrusted my hard-earned funds to a dubious trading platform, granting them access to my accounts in the hopes of seeing my investment grow. For a brief period, everything seemed to be going according to plan, with regular withdrawals and promising returns on my investment. However, my hopes were soon dashed when, without warning, communication from the platform ceased, and my Bitcoin holdings vanished into thin air. Feeling helpless and betrayed, I confided in a family member about my predicament. They listened sympathetically and offered a glimmer of hope in the form of a recommendation for Wizard Web Recovery. Intrigued by the possibility of reclaiming what I had lost, I decided to explore this option further. From the moment I reached out to Wizard Web Recovery, I was met with professionalism and empathy. They took the time to understand my situation and reassured me that I was not alone in my plight. With their guidance, I embarked on a journey to reclaim what was rightfully mine. Wizard Web Recovery's expertise and dedication were evident from the start. They meticulously analyzed the details of my case, uncovering crucial evidence that would prove invaluable in our quest for justice. With each step forward, they kept me informed and empowered, instilling in me a newfound sense of hope and determination. Through their tireless efforts and unwavering support, Wizard Web Recovery succeeded in recovering my lost Bitcoin holdings. It was a moment of triumph and relief, knowing that justice had been served and that I could finally put this chapter behind me. In conclusion, My experience with Wizard Web Recovery  was nothing short of transformative. Their professionalism, expertise, and unwavering commitment to their clients set them apart as true leaders in the field of cryptocurrency recovery. I am forever grateful for their assistance and would highly recommend their services to anyone in need of help navigating the treacherous waters of cryptocurrency scams. 
    • Ok so: Two things to note: It got stuck due to my dimension type. It was previously the same as the overworld dimension tpye but after changing it , it didn't freeze during spawn generation. ALSO, APPARENTLY, the way I'm doing things, the game can't have two extremely-rich dimensions or it will make the new chunk generation be veeery VEEERY slow. I'm doing the dimension file genreation all in the data generation step now, so it's all good. Mostly. If anybody has any tips regarding how can i more efficently generate a biome-rich dimension, im all ears.
    • https://mclo.gs/qTo3bUE  
  • Topics

×
×
  • Create New...

Important Information

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