Jump to content

[1.7.10] Issues with rotation metadata


naturaGodhead

Recommended Posts

I've been working on a beehive block, and I've been using the furnace metadata to attempt to get the rotation for the block working correctly. For some reason even though everything looks the same as the vanila furnace, when I load up the game the entire block is just a pink + black missing texture. What am I doing wrong?

 

Code:

 

package com.natura.artifacts.block;

import java.util.Random;

import com.natura.artifacts.Main;
import com.natura.artifacts.item.ArtifactItems;

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.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class BeeHive extends Block {

	private Item drop;
	private int meta;
	private int least_quantity;
	private int most_quantity;
	@SideOnly(Side.CLIENT)
	public IIcon iconFront;
	@SideOnly(Side.CLIENT)
	public IIcon blockIcon;
	@SideOnly(Side.CLIENT)
	public IIcon iconBottom;
	
	protected BeeHive(Material material, Item drop, int least, int most) {
		super(material);
		this.setBlockName("beeHive");
		this.setCreativeTab(ArtifactItems.tabArtifacts);
		this.setHardness(0.6F);
		this.setResistance(0.2F);
		this.setHarvestLevel("axe", 2);
		this.setStepSound(soundTypeWood);
		this.setBlockTextureName(Main.MODID + ":beeHiveSide");
		this.drop = drop;
	    this.least_quantity = least;
	    this.most_quantity = most;
	}
	
	public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)
    {
        int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

        if (l == 0)
        {
            p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2);
        }

        if (l == 1)
        {
            p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 5, 2);
        }

        if (l == 2)
        {
            p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2);
        }

        if (l == 3)
        {
            p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2);
        }

    }
	
	@SideOnly(Side.CLIENT)
	@Override
	public IIcon getIcon(int side, int meta) {
		 return side == 1 ? this.iconBottom : (side == 0 ? this.iconBottom : (side != meta ? this.blockIcon : this.iconFront));
	}
	
	@SideOnly(Side.CLIENT)
	@Override
	public void registerBlockIcons(IIconRegister reg) {
	  this.blockIcon = reg.registerIcon("beeHiveSide");
	  this.iconBottom = reg.registerIcon("beeHiveBottom");
	  this.iconFront = reg.registerIcon("beeHiveFront");
	  	
	}
	
	@Override
	public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_,
			EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {

		if(!p_149727_1_.isRemote) {
	    	if(p_149727_5_.getCurrentEquippedItem() != null) {
	    		if(p_149727_5_.getCurrentEquippedItem().getItem() == Items.bucket) {
	    		p_149727_5_.inventory.consumeInventoryItem(Items.bucket);
	    		p_149727_5_.inventory.addItemStackToInventory(new ItemStack(ArtifactItems.honeyBucket, 1, 0));
	    		p_149727_5_.inventoryContainer.detectAndSendChanges();
				return true;
	    		}
	    	}
		}
	    	
		return true;
	}
	
	
	
	@Override
	public Item getItemDropped(int meta, Random random, int fortune) {
	    return this.drop;
	}


	@Override
	public int quantityDropped(int meta, int fortune, Random random) {
	    if (this.least_quantity >= this.most_quantity)
	        return this.least_quantity;
	    return this.least_quantity + random.nextInt(this.most_quantity - this.least_quantity + fortune + 1);
	}

}

 

Link to comment
Share on other sites

1.7.10 is no longer supported here.

Update.

  • Like 1

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

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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