Jump to content

Block Rotation


Chlod

Recommended Posts

What do I do if I want a block to rotate. Similar to the furnace, when you place it, it always gets placed with the front facing you. Thanks.

 

package com.chlod.golf.Blocks;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class Slide extends Block{

protected Slide(Material p_i45394_1_) {
	super(p_i45394_1_);
        this.slipperiness = 1.5F;
        this.setTickRandomly(true);
}

}

Developer of Chlod's Mod! Project Link: http://minecraft.curseforge.com/projects/chlods-mod

Link to comment
Share on other sites

Look into IIcon in regards to taking side/meta data parameters.

 

Also,

 

Depending on 1.7.x or 1.8 you may find BlockState or otherwise.

 

Reference block code on this tutorial for example of 1.8 code:

 

jabelarminecraft.blogspot.com/p/blog-page_31.html?m=1

 

For 1.7.10 I'd recommend:

bedrockminer.jimdo.com/modding-tutorials/basic-modding-1-7/multi-texture-blocks/

 

You can also look at vanilla furnace or crafting table (work bench in class name) as they use front, side and top textures.

 

 

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Link to comment
Share on other sites

Looks like you are on 1.7.x - you'll want to override #onBlockPlacedBy which is called when a player places the block, and then #getIcon to return the appropriate texture based on the side and current metadata. You can basically copy the implementations from BlockFurnace provided that you are not using metadata for anything else, though I would recommend you take some time to understand how it works.

Link to comment
Share on other sites

Looks like you are on 1.7.x - you'll want to override #onBlockPlacedBy which is called when a player places the block, and then #getIcon to return the appropriate texture based on the side and current metadata. You can basically copy the implementations from BlockFurnace provided that you are not using metadata for anything else, though I would recommend you take some time to understand how it works.

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

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.