Jump to content

madao161

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

madao161's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I've done the following and now it works! public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { this.primeTnt(par1World, par2, par3, par4, 1, par5EntityLivingBase); par1World.setBlockToAir(par2, par3, par4); } Thanks a bunch guys!
  2. Okay, let's start anew here because I am genuinely all confused now. I upgraded to 1.6.4 so now that my code works better with everything else. Just to restate what I am trying to do here, instead of having to use flint+steel or any other item to activate the TnT. I want the TnT to activate the moment I place it down. I've looked what sets a TnT block and changes the entity into a primed TnT. From what I can see, it should be this (inside BlockTNT.java) public void primeTnt(World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) { if (!par1World.isRemote) { if ((par5 & 1) == 1) { EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par6EntityLivingBase); par1World.spawnEntityInWorld(entitytntprimed); par1World.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F); } } } It changes the TnT block into entity of PrimedTnT into the world. So in logical sense I should just call this function inside the function onBlockPlaced, or is it onBlockAdded (not sure the diff). Here's the problem, the function decoration for the two in the block.java is as following: public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) { return par9; } public void onBlockAdded(World par1World, int par2, int par3, int par4) {} Meanwhile as we see that the arguments that PrimedTnT takes in is public void primeTnt(World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) If I assume that we use onBlockPlaced, we are missing EntityLivingBase par6EntitityLivingBase that I have no idea how I can get to pass in (and that's also assuming par1-5 in onBlockPlaced is the same things needed as par1-5 in primeTnt) and I have no idea what par9 is that is needed to be returned. If we assume it's onBlockAdded, we are missing par5 and par6EntityLivingBase. I hope this provides more clear view of what my issue is so more clear help can be provided. Thanks
  3. Sorry, I was just trying to get some trace messages through to see if I can see what's happening. What's the way to get an output message in the chat box so I can see what's happening? Also, can someone give me some more specific help? I've wrestled with this for days now and can't figure out how to get this going... Thanks
  4. I have tried doing what you said. In the original TnT block, I find this: */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID) { this.func_94391_a(par1World, par2, par3, par4, 1, par5EntityPlayer); par1World.setBlockToAir(par2, par3, par4); return true; } else { return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); } } So then in my modded BlockModTnT.java, I've placed the following: public void onBlockPlaced(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, EntityLiving par6EntityLiving) { //this.func_94391_a(par1World, par2, par3, par4, 1, par5EntityPlayer); //par1World.setBlockToAir(par2, par3, par4); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here5"); EntityTNTPrimed var7 = new EntityTNTPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par6EntityLiving); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here6"); par1World.spawnEntityInWorld(var7); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here7"); par1World.playSoundAtEntity(var7, "random.fuse", 1.0F, 1.0F); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here8"); } public void onBlockAdded(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, EntityLiving par6EntityLiving) { super.onBlockAdded(par1World, par2, par3, par4); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here1"); //this.func_94391_a(par1World, par2, par3, par4, 1, par5EntityPlayer); //par1World.setBlockToAir(par2, par3, par4); EntityTNTPrimed var7 = new EntityTNTPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par6EntityLiving); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here2"); par1World.spawnEntityInWorld(var7); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here3"); par1World.playSoundAtEntity(var7, "random.fuse", 1.0F, 1.0F); ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode:" + "Got here4"); /*if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); par1World.setBlockToAir(par2, par3, par4); }*/ } This is my mod_Tnt.java package net.minecraft.src; public class mod_Tnt extends BaseMod { public static final Block newTnT = (new BlockModTnT(244)).setHardness(0.0F).setUnlocalizedName("modtnt"); public void load() { ModLoader.registerBlock(newTnT); ModLoader.addName(newTnT, "ModdedTnT"); ModLoader.addRecipe(new ItemStack(newTnT, 64), new Object [] {"###", Character.valueOf('#'), Block.dirt}); } @Override public String getVersion() { // TODO Auto-generated method stub return null; } } You can tell I've put a bunch of trace statements inside the BlockModTnT, and it doesn't look like any of them show up when I call them so it's almost like the code never even reaches there. Please help.
  5. Hi all, first timer here. Just have a quick question for you all. I'm looking to make a bomberman sorta like mod for minecraft, but I'm running into an issue with trying to make a tnt block become a primed tnt block on placed. Can someone please point me in the right direction to make this happen? Thanks;
×
×
  • Create New...

Important Information

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