Posted October 22, 201410 yr I want to add instant structures to my mod but the code just won't work: package com.kaptainwiz.mykindmod.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class BlockInstantStructure extends Block { Blocks block; public BlockInstantStructure(Material material) { super(material); } public void onBlockPlacedBy(World world, Random random, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) { super.onBlockPlacedBy(world, x, y, z, entity, itemstack);//Super world.setBlockToAir(x, y, z);//Sets the block to air on the x, y, and z coords from where you placed the block world.setBlock(x, y, z, block.cobblestone);//Sets the block on the x, y, and z coords starting from where you placed the block world.setBlock(x, y+1, z, block.planks, 2, 2); //Sets the block(with set metadata) on the x, y, and z coords from where you placed the block world.setBlock(x+1, y, z+1, block.planks, 2, 2); world.setBlock(x+2, y, z+2, block.planks, 2, 2); world.setBlock(x+3, y, z+3, block.planks, 2, 2); world.setBlock(x+4, y, z+4, block.planks, 2, 2);//This is for birch planks, if you want other planks, search 'Minecraft Block Metadata'in google or find it on the MinecraftWiki } } Here's the registry: public static Block blockInstantStructure; blockInstantStructure = new BlockInstantStructure(Material.anvil).setCreativeTab(SampleTab).setBlockName("Instant").setBlockTextureName("sample:SampleInstant"); GameRegistry.registerBlock(blockInstantStructure, "instant"); This doesn't seem to work when I place the block down.. What now
October 23, 201410 yr wrong function its @Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity, ItemStack itemstack){ //code } Also you should do @Override before your functions, because if the function is incorrect, you get an error. The proud(ish) developer of Ancients
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.