Jump to content

Recommended Posts

Posted

So, I'm trying to make a trap for one of my new structures that's going to generate in the world. However, I cannot get it to rotate properly. The schematic to java converter gave me this line of code for the dispenser rotation:

 world.setBlock(x + 4, y + -4, z + 9, Blocks.dispenser, 11, 3); 

I made a new block for debugging. It just raised more questions.

Here is the block's code:

 

 

package net.morestructures.mod.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World;
import net.morestructures.mod.Morestructures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TestBlock extends Block 
{
Blocks b;

public TestBlock(Material material) {
	super(material);

	this.setHardness(3.0F);
	this.setResistance(5.0F);
	this.setStepSound(soundTypeMetal);
	this.setCreativeTab(Morestructures.morestructuresTab);
    }

@Override

    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) {
	 super.onBlockPlacedBy(world, x, y, z, entity, itemStack);
	 world.setBlockToAir(x,y,z);



	 world.setBlock(x + 1, y, z, Blocks.dispenser, 11, 5);
	 world.setBlock(x + 2, y, z, Blocks.dispenser, 11, 2);
	 world.setBlock(x + 3, y, z, Blocks.dispenser, 11, 1);
	 world.setBlock(x, y, z, Blocks.dispenser, 11, 3);
	 world.setBlock(x + 4, y, z, Blocks.dispenser, 11, 4);
 } 
    



@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
	this.blockIcon = iconRegister.registerIcon(Morestructures.modid + ":" + this.getUnlocalizedName().substring(5));
}

}


 

*Spoilers did not open for me, sorry about that.

 

I did not make a texture for it just to keep it simple.

So, This is what happens when I place the block:

 

4UfUa6t.png

 

Then, I broke off the block on the end, and placed my block in the exact same spot as before.

Then this happened:

 

AgBpz7Q.png

 

On a side note, If anyone knows how to make a dispenser's tile entity inventory be many potions of harming II, please tell me how!

 

Thanks for your help, nightscout01

 

 

Posted

Hi

 

I think you have mixed up metadata and flags.

 

 

    /**

    * Sets the block ID and metadata at a given location. Args: X, Y, Z, new block ID, new metadata, flags. Flag 1 will

    * cause a block update. Flag 2 will send the change to clients (you almost always want this). Flag 4 prevents the

    * block from being re-rendered, if this is a client world. Flags can be added together.

    */

    public boolean setBlock(int wx, int wy, int wz, Block block, int metadata, int flags)

 

-TGG

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.