Posted June 19, 201312 yr Heres the base code you'll need //Blocks public static Block fencePistonOn = new BlockFencePiston(1537, Material.piston, true, false); public static Block fencePistonOff = new BlockFencePiston(1538, Material.piston, false, false).setCreativeTab(CreativeTabs.tabRedstone); public static Block killFencePistonOn = new BlockFencePiston(1539, Material.piston, true, true); public static Block killFencePistonOff = new BlockFencePiston(1540, Material.piston, false, true).setCreativeTab(CreativeTabs.tabRedstone); @Init public static void init(FMLInitializationEvent e){ GameRegistry.registerBlock(fencePistonOff, "Fence Piston"); GameRegistry.registerBlock(killFencePistonOff, "Killer Fence Piston"); LanguageRegistry.addName(fencePistonOff, "Fence Piston"); LanguageRegistry.addName(killFencePistonOff, "Killer Fence Piston"); } Alright, so the problem is that both blocks are named Killer Fence Piston, but neither have the killer effect... what did I do wrong, im new to 1.5 modding and a lot has changed. Thanks for your help The Korecraft Mod
June 20, 201312 yr you should register all of the blocks GameRegistry.registerBlock(fencePistonOff, "Fence Piston"); GameRegistry.registerBlock(killFencePistonOff, "Killer Fence Piston"); GameRegistry.registerBlock(fencePistonOn, "Fence Piston On"); GameRegistry.registerBlock(killFencePistonOn, "Killer Fence Piston On"); http://mag.racked.eu/cimage/i6000/Achievement++get%21/Newb+Modder%21/mca.png[/img]
June 20, 201312 yr Author No I dont need to, because you are never going to have the on state block in your hand, but thats not my question, my question is why are they the same names The Korecraft Mod
June 20, 201312 yr No I dont need to, because you are never going to have the on state block in your hand, but thats not my question, my question is why are they the same names Because the constructor of BlockFencePiston sets the unlocalized name to the same string in both cases. 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.
June 20, 201312 yr Lets see. You have a constructor which is passed arguments. You have a function that runs in the constructor that needs arguments. There are vanilla blocks that operate in a similar manner. 2 + 2 = ? 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.
June 20, 201312 yr Author Okay, I have the names sorted out by setting the unlocalized names, but Im probably making a dumb mistake about the killer property... I have it sent into my constructor like so: Base Class //Blocks public static Block fencePistonOn = new BlockFencePiston(1537, Material.piston, true, false).setUnlocalizedName("FencePistonOn"); public static Block fencePistonOff = new BlockFencePiston(1538, Material.piston, false, false).setUnlocalizedName("FencePiston").setCreativeTab(CreativeTabs.tabRedstone); public static Block killFencePistonOn = new BlockFencePiston(1539, Material.piston, true, true).setUnlocalizedName("Killer Fence Piston On"); public static Block killFencePistonOff = new BlockFencePiston(1540, Material.piston, false, true).setUnlocalizedName("Killer Fence Piston").setCreativeTab(CreativeTabs.tabRedstone); And then my constructor: public boolean active; public boolean killer; public BlockFencePiston(int par1, Material par2Material, boolean isOn, boolean doesKill) { super(par1, par2Material); this.active = isOn; this.killer = doesKill; if (isOn) { this.setTickRandomly(true); } } But the code doesn't realize that the killer boolean is true. The Korecraft Mod
June 20, 201312 yr But the code doesn't realize that the killer boolean is true. What does this mean? 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.
June 20, 201312 yr Author I have it in the contructor make the killer boolean true when I make the blocks, but when I try to use the killer variable, it only shows up as false. The Korecraft Mod
June 23, 201312 yr Author So what I mean is that when I call it: public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if(this.active){ if(par5Entity instanceof EntityPlayer)System.out.println(this.killer); if(this.killer){ par5Entity.addVelocity(0.0, 100.0, 0.0); }else{ par5Entity.setFire(10); } } } Where it says if(par5Entity instanceof EntityPlayer)System.out.println(this.killer); I'm printing out if it is killer or not when you collide, but it always says false The Korecraft Mod
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.