Jump to content

Swordthane

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Swordthane

  1. After reading your post I realized that I was going about it the wrong way. I was set on changing the block class which was misguided so I just made an alt fence class and fixed it there
  2. Here is the code. I did clean it up so its not as long. Center is the main mod class and if I have the last part where I try to do the @Override it does not work. So I made the second class which to my knowledge does nothing to my understanding as of now. The change to the canPlaceTorchOnTop are at the end of the return statement. Center package ThunderMuffin; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; //cropped out for convince @Mod(modid="ThunderMuffin", name="ThunderMuffin", version="First Muffin") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Center { public final static Block goldFence = new BlockFence(3000,"gold_block",Material.rock).setUnlocalizedName("Gold Fence"); //there are a bunch of these // The instance of your mod that Forge uses. @Instance("Center") public static Center instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide="ThunderMuffin.client.ClientProxy", serverSide="ThunderMuffin.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Stub Method } @EventHandler//put recipes in here public void load(FMLInitializationEvent event) { proxy.registerRenderers(); GameRegistry.registerBlock(goldFence,"Gold Fence"); LanguageRegistry.addName(goldFence,"Gold Fence"); ItemStack goldFenceStack = new ItemStack(goldFence,6); GameRegistry.addRecipe(goldFenceStack,"xxx", "xxx",'x',Item.ingotGold); //there are a bunch of thes } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Stub Method } @Override public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { if (world.doesBlockHaveSolidTopSurface(x, y, z)) { return true; } else { int id = world.getBlockId(x, y, z); return id == Block.fence.blockID || id == Block.netherFence.blockID || id == Block.glass.blockID || id == Block.cobblestoneWall.blockID ||(id >2999 && id <3016); } } } BlockExtender package ThunderMuffin; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; public class BlockExtender extends Block { public BlockExtender(int par1, Material par2Material) { super(par1, par2Material); // TODO Auto-generated constructor stub } @Override public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { if (world.doesBlockHaveSolidTopSurface(x, y, z)) { return true; } else { int id = world.getBlockId(x, y, z); return id == Block.fence.blockID || id == Block.netherFence.blockID || id == Block.glass.blockID || id == Block.cobblestoneWall.blockID ||(id >2999 && id <3016); } } }
  3. I am a new Minecraft modder and trying to set up a basic fence mod. I found I could not place torches on my new fence and after looking I found that changing the canPlaceTorchOnTop() method in Block.java would allow me to place them properly. However I am under the assumption that changing the Block.java class its self is not the proper way to do it so I am trying to find the alternative. I am trying to override the method with the @Override but I am not sure if what I am doing is the correct approach and/ its not working. I would appreciate any help from the community.
×
×
  • Create New...

Important Information

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