From 311ab89f93558233a40079f7cb16605b141b5346 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 12 Dec 2021 19:38:06 +0100 Subject: Move sources and resources --- .../plugin/villagers/VillagerEventHandler.java | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/java/gtPlusPlus/plugin/villagers/VillagerEventHandler.java (limited to 'src/main/java/gtPlusPlus/plugin/villagers/VillagerEventHandler.java') diff --git a/src/main/java/gtPlusPlus/plugin/villagers/VillagerEventHandler.java b/src/main/java/gtPlusPlus/plugin/villagers/VillagerEventHandler.java new file mode 100644 index 0000000000..b515f0979e --- /dev/null +++ b/src/main/java/gtPlusPlus/plugin/villagers/VillagerEventHandler.java @@ -0,0 +1,47 @@ +package gtPlusPlus.plugin.villagers; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.plugin.villagers.entity.EntityBaseVillager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; + +public class VillagerEventHandler { + + private final static VillagerEventHandler mInstance; + + static { + mInstance = new VillagerEventHandler(); + Utils.registerEvent(mInstance); + } + + @SubscribeEvent + public void onEntityJoinWorld(EntityJoinWorldEvent event){ + + + /*try { + if (event.entity != null && event.entity instanceof EntityLivingBase && event.entity instanceof EntityVillager){ + EntityVillager entity = (EntityVillager) event.entity; + World world = entity.worldObj; + int profession = entity.getProfession(); + if (world != null && (profession >= 7735 && profession <= 7737)){ + EntityBaseVillager mNew = new EntityBaseVillager(world, profession); + mNew.copyLocationAndAnglesFrom(entity); + if (mNew != null) { + world.removeEntity(entity); + world.spawnEntityInWorld(mNew); + } + } + + } + } + catch (Throwable t) { + t.printStackTrace(); + return; + }*/ + + } + +} -- cgit