Jump to content

Armour that changes block properties


ZacDoesStuff

Recommended Posts

Hi! I've created an armour for my mod where the boots are skates. My plan is to have the skates allow you to walk on ice like it's a normal block, or even "skate" on it faster, but I have no idea where to start to tackle this. Any suggestions would be great!

 

Thanks,

 

ZacDoesStuff  :)

Link to comment
Share on other sites

Use World#getBlockId() if you are in 1.6.4.

You can use the player's position, and check the block under the player.

If it is ice block, you can make the player "skate" fast.

you can refer to the player running code.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Use World#getBlockId() if you are in 1.6.4.

You can use the player's position, and check the block under the player.

If it is ice block, you can make the player "skate" fast.

you can refer to the player running code.

 

Where would I do all this? In the armour class? I tried this

 

public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack, int par2, int par3, int par4)

    {

if (itemStack.itemID == CanadianMod.skates.itemID && (world.getBlockId(par2, par3-1, par4) == Block.ice.blockID)){

Block.ice.slipperiness = 0.00F;

}

    }

 

But that was before i knew where to start, I kind of just guessed...

Link to comment
Share on other sites

No, don't do that!  It sounds right when you're new, but it's like sounding out words when you learn to read.  You have to go through your code line by line and figure out what each one does on its own.  Let's try that:

 

    {
      if (itemStack.itemID == CanadianMod.skates.itemID && (world.getBlockId(par2, par3-1, par4) == Block.ice.blockID)){
         Block.ice.slipperiness = 0.00F;
      }
    }

If the item is a pair of skates and the block below the player is ice

All ice in the world (In every dimension) now has 0 slipperiness forever.  (Since you're not saving the current slipperiness and setting it back.)

 

Changing the slipperiness of an individual block in a cube based game isn't reasonable: you want to cheat.  Easiest way would probably be by multiplying the player's current velocity until they hit a max.

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



×
×
  • Create New...

Important Information

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