Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.knifesurge.ToolExpansion.eventhandlers;
- import com.knifesurge.ToolExpansion.entityItem.SpecialEntityItem;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.init.Items;
- import net.minecraftforge.event.entity.EntityJoinWorldEvent;
- import net.minecraftforge.fml.common.eventhandler.EventPriority;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- public class EntityJoinWorldEventHandler {
- @SubscribeEvent(priority=EventPriority.HIGHEST)
- public void onEntityJoinWorld(EntityJoinWorldEvent event)
- {
- if(event.entity instanceof EntityItem)
- {
- if(((EntityItem)event.entity).getEntityItem().getItem() == Items.blaze_rod)
- {
- event.setCanceled(true);
- SpecialEntityItem entityItem = new SpecialEntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, ((EntityItem)event.entity).getEntityItem());
- event.entity.worldObj.spawnEntityInWorld(entityItem);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment