Guest User

Untitled

a guest
Apr 14th, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. package tutorial.generic;
  2. import net.minecraft.block.BlockGrass;
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraftforge.event.entity.EntityEvent;
  5. import net.minecraftforge.event.world.BlockEvent.BreakEvent;
  6. import cpw.mods.fml.common.eventhandler.SubscribeEvent;
  7.  
  8.  
  9. public class genericHooks {
  10.     @SubscribeEvent
  11.      public void onEntityConstruct(EntityEvent.EntityConstructing event) {
  12.             if (event.entity instanceof EntityPlayer) {
  13.                 event.entity.registerExtendedProperties(PlayerInformation.IDENTIFIER, new PlayerInformation((EntityPlayer) event.entity));
  14.                 System.out.println("Desu");
  15.             }
  16.         }
  17. @SubscribeEvent
  18. public void onBreakEvent(BreakEvent event){
  19.  
  20.      if (event.getPlayer() instanceof EntityPlayer) {
  21.          EntityPlayer ent = (EntityPlayer) event.getPlayer();
  22.          PlayerInformation playerInfo = PlayerInformation.forPlayer(ent);
  23.      
  24.          if ( event.block.getClass() == BlockGrass.class ){
  25.              System.out.println("Broken block:"+event.block.getClass());
  26.              System.out.println("From NBT, Player XP:" + playerInfo.getXP());
  27.              playerInfo.addXP(1);
  28.              }
  29.          }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment