net.minecraftforge.event.entity.EntityEvent Java Examples
The following examples show how to use
net.minecraftforge.event.entity.EntityEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CivilizationHandlers.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void handleEnteringProvince(EntityEvent.EnteringChunk event) { if (!(event.getEntity() instanceof EntityPlayerMP)) { return; } EntityPlayerMP player = (EntityPlayerMP) event.getEntity(); PlayerCivilizationCapabilityImpl.get(player).updatePlayerLocation(event.getNewChunkX(), event.getNewChunkZ()); }
Example #2
Source File: EventHandlerGolem.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.LOWEST) public void on(EntityEvent.EntityConstructing e) { if(e.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) e.entity; golem.registerExtendedProperties(Gadomancy.MODID, new ExtendedGolemProperties(golem)); golem.getDataWatcher().addObject(ModConfig.golemDatawatcherId, ""); } }
Example #3
Source File: EventHandlerGolem.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.HIGHEST) public void on(EntityEvent.EnteringChunk event) { if(event.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) event.entity; if(GadomancyApi.isAdditionalGolemType(golem.getGolemType())) { ExtendedGolemProperties props = (ExtendedGolemProperties)event.entity.getExtendedProperties(Gadomancy.MODID); if(props.shouldUpdateHealth()) { props.resetUpdateHealth(); golem.setHealth(props.getHealth()); } } } }
Example #4
Source File: Entity.java From TickDynamic with MIT License | 5 votes |
public Entity(World p_i1582_1_) { this.entityId = nextEntityID++; this.renderDistanceWeight = 1.0D; this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.field_70135_K = true; this.width = 0.6F; this.height = 1.8F; this.nextStepDistance = 1; this.rand = new Random(); this.fireResistance = 1; this.firstUpdate = true; this.entityUniqueID = UUID.randomUUID(); this.myEntitySize = Entity.EnumEntitySize.SIZE_2; this.worldObj = p_i1582_1_; this.setPosition(0.0D, 0.0D, 0.0D); if (p_i1582_1_ != null) { this.dimension = p_i1582_1_.provider.dimensionId; } this.dataWatcher = new DataWatcher(this); this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.entityInit(); extendedProperties = new HashMap<String, IExtendedEntityProperties>(); MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this)); for (IExtendedEntityProperties props : this.extendedProperties.values()) { props.init(this, p_i1582_1_); } }
Example #5
Source File: EntitySpawnHandler.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onEntityConstruction(EntityEvent.EntityConstructing event) { if (event.getEntity() instanceof EntityFluidCow) { final EntityFluidCow entityFluidCow = (EntityFluidCow) event.getEntity(); if (entityFluidCow.getEntityFluid() == null) { entityFluidCow.setEntityFluid(getEntityFluid()); } } }
Example #6
Source File: PlayerListener.java From SkyblockAddons with MIT License | 4 votes |
@SubscribeEvent() public void onTickMagmaBossChecker(EntityEvent.EnteringChunk e) { Entity entity = e.entity; if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT) && entity instanceof EntityArrow) { EntityArrow arrow = (EntityArrow)entity; EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; ItemStack heldItem = p.getHeldItem(); if (heldItem != null && "EXPLOSIVE_BOW".equals(ItemUtils.getSkyBlockItemID(heldItem))) { AxisAlignedBB playerRadius = new AxisAlignedBB(p.posX - 3, p.posY - 3, p.posZ - 3, p.posX + 3, p.posY + 3, p.posZ + 3); if (playerRadius.isVecInside(arrow.getPositionVector())) { // System.out.println("Spawned explosive arrow!"); main.getNewScheduler().scheduleRepeatingTask(new SkyblockRunnable() { @Override public void run() { if (arrow.isDead || arrow.isCollided || arrow.inGround) { cancel(); // System.out.println("Arrow is done, added an explosion!"); Vec3 explosionLocation = new Vec3(arrow.posX, arrow.posY, arrow.posZ); explosiveBowExplosions.put(System.currentTimeMillis(), explosionLocation); recentlyKilledZealots.keySet().removeIf((killedTime) -> System.currentTimeMillis() - killedTime > 150); Set<Vec3> filteredRecentlyKilledZealots = new HashSet<>(); for (Map.Entry<Long, Set<Vec3>> recentlyKilledZealotEntry : recentlyKilledZealots.entrySet()) { filteredRecentlyKilledZealots.addAll(recentlyKilledZealotEntry.getValue()); } if (filteredRecentlyKilledZealots.isEmpty()) return; // int possibleZealotsKilled = filteredRecentlyKilledZealots.size(); // System.out.println("This means "+possibleZealotsKilled+" may have been killed..."); // int originalPossibleZealotsKilled = possibleZealotsKilled; for (Vec3 zealotDeathLocation : filteredRecentlyKilledZealots) { double distance = explosionLocation.distanceTo(zealotDeathLocation); System.out.println("Distance was "+distance+"!"); if (distance < 4.6) { // possibleZealotsKilled--; main.getPersistentValues().addKill(); EndstoneProtectorManager.onKill(); } } // System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed..."); } } }, 0, 1); } } } if (main.getUtils().getLocation() == Location.BLAZING_FORTRESS) { if (magmaBossSpawnArea.isVecInside(new Vec3(entity.posX, entity.posY, entity.posZ))) { // timers will trigger if 15 magmas/8 blazes spawn in the box within a 4 second time period long currentTime = System.currentTimeMillis(); if (e.entity instanceof EntityMagmaCube) { if (!recentlyLoadedChunks.contains(new IntPair(e.newChunkX, e.newChunkZ)) && entity.ticksExisted == 0) { recentMagmaCubes++; main.getScheduler().schedule(Scheduler.CommandType.SUBTRACT_MAGMA_COUNT, 4); if (recentMagmaCubes >= 17) { magmaTime = 600; magmaAccuracy = EnumUtils.MagmaTimerAccuracy.EXACTLY; if (currentTime - lastMagmaWavePost > 300000) { lastMagmaWavePost = currentTime; main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.MAGMA_WAVE); } } } } else if (e.entity instanceof EntityBlaze) { if (!recentlyLoadedChunks.contains(new IntPair(e.newChunkX, e.newChunkZ)) && entity.ticksExisted == 0) { recentBlazes++; main.getScheduler().schedule(Scheduler.CommandType.SUBTRACT_BLAZE_COUNT, 4); if (recentBlazes >= 10) { magmaTime = 1200; magmaAccuracy = EnumUtils.MagmaTimerAccuracy.EXACTLY; if (currentTime - lastBlazeWavePost > 300000) { lastBlazeWavePost = currentTime; main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BLAZE_WAVE); } } } } } } }
Example #7
Source File: EntityEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static void onEntityConstruct(Entity entity) { MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(entity)); }
Example #8
Source File: EntityEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static void onEnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ) { MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(entity, newChunkX, newChunkZ, oldChunkX, oldChunkZ)); }
Example #9
Source File: EntityEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static float getEyeHeight(Entity entity, EntityPose pose, EntityDimensions size, float defaultHeight) { EntityEvent.EyeHeight event = new EntityEvent.EyeHeight(entity, pose, size, defaultHeight); MinecraftForge.EVENT_BUS.post(event); return event.getNewHeight(); }
Example #10
Source File: HandlerEvents.java From burlapcraft with GNU Lesser General Public License v3.0 | 4 votes |
@SubscribeEvent public void EntityJoinWorldEvent(EntityEvent event) { if (event.entity instanceof EntityPlayer) { player = (EntityPlayer) event.entity; } }