Jump to content

iluvpie777

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by iluvpie777

  1. Tried all of that still doesn't work also yes my event handler is registered
  2. So basically println() isn't working which means that the if statement isn't working I know for a fact that the IEEP counter works as I have used it for alot of other events and it works just fine here is my code, isDamaged() was like the only thing I found that checked if the item has been damaged if there is a better way to check a fishing rod after using it I'm all ears anyways here is my code: @SubscribeEvent public void useItem(Finish event) { EMIEEP props = EMIEEP.get(event.entityPlayer); if (event.entityPlayer.getHeldItem().getItem() == Items.fishing_rod && event.result.getItem().isDamaged(event.entityPlayer.getHeldItem())) { props.addToCounter(2.0); System.out.println(props.getCounter()); } }
  3. So I'm actually still having some trouble with this event, I'm trying to make it so that when a player uses a fishing rod and it's durability goes down a counter will add 2 but it's not working does anyone know why? code: @SubscribeEvent public void useItem(Finish event) { EMIEEP props = EMIEEP.get(event.entityPlayer); if (event.entityPlayer.getHeldItem().getItem() == Items.fishing_rod && event.result.getItem().isDamaged(event.entityPlayer.getHeldItem())) { props.addToCounter(2.0); System.out.println(props.getCounter()); } }
  4. Thanks, I managed to get the event working!
  5. Hi I'm just kind of confused on how this event works with it's start, tick, stop, and finish variables could someone please explain to me how to properly use these in the event? thanks
  6. Thank You! Everything is working perfectly now I didn't realize that everything I needed was in conext
  7. So I've mannaged to get SimpleNetworkWrapper working but the only place to execute the spawn entity code is here: code: @Override public IMessage onMessage(EMMessage message, MessageContext context) { return null; } So once again there is no world or player so how do I execute the spawn entity code
  8. So I'm kinda confused on how Simple Network Wrapper works, so basically it sends a string from the client side to server side, and the server takes that string and does stuff with it?
  9. Hi I've been trying to make an entity spawn next to the player when a specific key is pressed however in the KeyInputEvent there is no world or entity so how do I make it so when I press a certain button an entity spawns, or do I have to use a different event completely. It's not much help but here is my KeyInputEvent code Code: public class KeyHandler { public boolean isAttacking = false; World world; EntityPlayer player; private static Key getPressedKeybinding() { if (KeyBindings.attack.isPressed()) { return Key.ATTACK; } return Key.UKNOWN; } @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event) { if (KeyBindings.attack.isPressed()) { isAttacking = true; } } }
  10. does anyone know how to give a projectile a potion effect? I've tried movingobjectposition.entityHit but there is no addPotionEffect option
  11. so I tried Blocks.flowing_water and it gets the spawned water flowing but it still stays, I want the blocks that are not permanent (the nonsource blocks) to spawn, is it possible to do this?
  12. oh wow lol, I searched through all the blocks and somehow missed it thx!
  13. Hi so I'm trying to make it so that when a mob gets hit by my projectile a puddle of water will spawn at it's feet however I'm not quite sure how to get the active water to spawn so that it goes away after a little bit. My code: @Override protected void onImpact(MovingObjectPosition movingobjectposition) { if (movingobjectposition.entityHit != null) { float getDmg = 2; movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), getDmg); int rand = random.nextInt(5); if (rand == 4) { int x = MathHelper.floor_double(this.posX); int y = MathHelper.floor_double(movingobjectposition.entityHit.posY); int z = MathHelper.floor_double(this.posZ); this.worldObj.setBlock(x, y, z, Blocks.water); } } for (int l = 0; l <7; ++l) { this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } if (!this.worldObj.isRemote) { this.setDead(); } } as you see right now its block.water how do i get the active water?
  14. OMG Thank you so much everything is working the way I intended!
  15. Thankyou really appreciate the help and advice
  16. I so im trying to make a counter that will go up when you do certain tasks so right now I've only set it to count up when water is scooped into a bucket, after getting 5 water buckets the player will gain enhanced movement speed. The problem is when I create a new world the player in the new world also has the enhanced movement speed without completing the task, this is because the counter does not reset for the new world my question is how do I get this counter to reset thx! Event Handler Code: public class EMEventHandler { private int counter = 0; public World world; @SubscribeEvent public void bucketUse(FillBucketEvent event) { if (event.entityPlayer.getHeldItem().getItem() == Items.water_bucket) { counter++; System.out.println(counter); } } @SubscribeEvent public void counterUpdateEvent (LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; if(counter >= 5) { player.capabilities.setPlayerWalkSpeed(0.2F); } } } } Main Class Code: public class MMod { public static final String version = "0.01"; EMEventHandler eventhandler = new EMEventHandler(); @EventHandler public void preInit(FMLPreInitializationEvent event) { //some use FML bus FMLCommonHandler.instance().bus().register(eventhandler); //most events use MinecraftForge event bus MinecraftForge.EVENT_BUS.register(eventhandler); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
×
×
  • Create New...

Important Information

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