@SubscribeEvent public void onTickEvent(TickEvent.PlayerTickEvent evt) { if (tick >= 15) { for (TileEntity t : (List<TileEntity>) evt.player.worldObj.loadedTileEntityList) { if (t instanceof LobbyTileEntity) { tile = (LobbyTileEntity) t; if (tile.players.size() != tile.blockMetadata) tile.check(); } } tick = 0; } }
@SubscribeEvent public void clientConnectedtoServer(FMLNetworkEvent.ServerConnectionFromClientEvent event) { if (!CreeperHost.instance.active) return; MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if (server == null || server.isSinglePlayer() || discoverMode != Discoverability.PUBLIC) return; INetHandlerPlayServer handler = event.handler; if (handler instanceof NetHandlerPlayServer) { EntityPlayerMP entity = ((NetHandlerPlayServer) handler).playerEntity; playersJoined.add(entity.getUniqueID()); } }
@SubscribeEvent public void onActionPerformed(ActionPerformedEvent.Pre event) { GuiScreen gui = Util.getGuiFromEvent(event); GuiButton button = Util.getButton(event); if (gui instanceof GuiMainMenu) { if (button != null && button.id == MAIN_BUTTON_ID) { Minecraft.getMinecraft().displayGuiScreen(GuiGetServer.getByStep(0, new Order())); } } else if (gui instanceof GuiMultiplayer) { if (button != null && button.id == MP_BUTTON_ID) { Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayerPublic(gui)); } } else if (gui instanceof GuiIngameMenu && button.id == FRIEND_BUTTON_ID) { CreeperHost.proxy.openFriendsGui(); } }
@SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent event) { if (!Config.getInstance().isSivIntegration()) return; if (event.type != RenderGameOverlayEvent.ElementType.PLAYER_LIST) { return; } if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped()) { return; } Minecraft mc = Minecraft.getMinecraft(); ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight()); if (guiServerInfo.renderServerInfo()) { event.setCanceled(true); } }
@SubscribeEvent public void recalc(LivingHurtEvent event) { if (!(event.entity instanceof EntityPlayer)) { return; } EntityPlayer player = (EntityPlayer) event.entity; if (!AbilityData.get(player).isSkillLearned(SkillAirControl.INSTANCE)) { return; } if (event.source.getDamageType().equals("inWall") || event.source.getDamageType().equals("drown")) { event.ammount *= 0.1; } else if (event.source.getDamageType().equals("fall")) { event.ammount *= 0.25; } else if (event.source.isProjectile() || event.source.getDamageType().equals("anvil")) { event.ammount *= 0.75; } }
@SubscribeEvent @SuppressWarnings("unchecked") public void onWorldTick(TickEvent.ServerTickEvent event) { if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER) return; if (EtFuturum.enablePlayerSkinOverlay) if (playerLoggedInCooldown != null) if (--playerLoggedInCooldown <= 0) { for (World world : MinecraftServer.getServer().worldServers) for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) { NBTTagCompound nbt = player.getEntityData(); if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) { boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY); EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex)); } } playerLoggedInCooldown = null; } }
@SubscribeEvent public void arrowNock(ArrowNockEvent event) { if (event.result == null) return; IInventory invt = event.entityPlayer.inventory; for (int i = 0; i < invt.getSizeInventory(); i++) { ItemStack stack = invt.getStackInSlot(i); if (stack == null || stack.stackSize <= 0) continue; if (stack.getItem() == Items.arrow) return; if (stack.getItem() == ModItems.tipped_arrow) { event.setCanceled(true); event.entityPlayer.setItemInUse(event.result, event.result.getItem().getMaxItemUseDuration(event.result)); return; } } }
@SubscribeEvent public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event) { if (!EtFuturum.enableEnchants) return; try { File file = event.getPlayerFile(Reference.MOD_ID); if (!file.exists()) { file.createNewFile(); return; } BufferedReader br = new BufferedReader(new FileReader(file)); String line = br.readLine(); if (line != null) { int seed = Integer.parseInt(line); ContainerEnchantment.seeds.put(event.playerUUID, seed); br.close(); } } catch (Exception e) { } }
@SubscribeEvent public void onPlayerSaveFromFileEvent(PlayerEvent.SaveToFile event) { if (!EtFuturum.enableEnchants) return; try { File file = event.getPlayerFile(Reference.MOD_ID); if (!file.exists()) { file.createNewFile(); return; } Integer seed = ContainerEnchantment.seeds.get(event.playerUUID); if (seed != null) { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(seed.toString()); bw.close(); } } catch (IOException e) { } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void dropEvent(LivingDropsEvent event) { if (event.entityLiving.worldObj.isRemote) return; if (EtFuturum.enableSkullDrop) dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops); Random rand = event.entityLiving.worldObj.rand; if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) { int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel); for (int i = 0; i < amount; i++) if (event.entityLiving.isBurning()) addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops); else addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops); } }
@SubscribeEvent public void spawnEvent(EntityJoinWorldEvent event) { if (event.entity instanceof EntityPig) { EntityPig pig = (EntityPig) event.entity; if (EtFuturum.enableBeetroot) pig.tasks.addTask(4, new EntityAITempt(pig, 1.2, ModItems.beetroot, false)); } else if (event.entity instanceof EntityChicken) { EntityChicken chicken = (EntityChicken) event.entity; if (EtFuturum.enableBeetroot) chicken.tasks.addTask(3, new EntityAITempt(chicken, 1.0D, ModItems.beetroot_seeds, false)); } else if (event.entity instanceof EntityWolf) { EntityWolf wolf = (EntityWolf) event.entity; if (EtFuturum.enableRabbit) wolf.targetTasks.addTask(4, new EntityAITargetNonTamed(wolf, EntityRabbit.class, 200, false)); } else if (event.entity instanceof EntityVillager) { EntityVillager villager = (EntityVillager) event.entity; for (Object obj : villager.tasks.taskEntries) { EntityAITaskEntry entry = (EntityAITaskEntry) obj; if (entry.action instanceof EntityAIOpenDoor) { villager.tasks.removeTask(entry.action); villager.tasks.addTask(entry.priority, new EntityAIOpenCustomDoor(villager, true)); break; } } } }
@SubscribeEvent public void interactEntityEvent(EntityInteractEvent event) { ItemStack stack = event.entityPlayer.getCurrentEquippedItem(); if (stack == null) return; if (!(event.target instanceof EntityAnimal)) return; EntityAnimal animal = (EntityAnimal) event.target; if (!animal.isChild()) { if (animal instanceof EntityPig) { if (stack.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot) setAnimalInLove(animal, event.entityPlayer, stack); } else if (animal instanceof EntityChicken) if (stack.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot) setAnimalInLove(animal, event.entityPlayer, stack); } else if (EtFuturum.enableBabyGrowthBoost && isFoodItem(animal, stack)) feedBaby(animal, event.entityPlayer, stack); }
@SubscribeEvent public void entityHurtEvent(LivingHurtEvent event) { if (!EtFuturum.enableDmgIndicator) return; int amount = MathHelper.floor_float(Math.min(event.entityLiving.getHealth(), event.ammount) / 2F); if (amount <= 0) return; // If the attacker is a player spawn the hearts aligned and facing it if (event.source instanceof EntityDamageSource) { EntityDamageSource src = (EntityDamageSource) event.source; Entity attacker = src.getSourceOfDamage(); if (attacker instanceof EntityPlayer && !(attacker instanceof FakePlayer)) { EntityPlayer player = (EntityPlayer) attacker; Vec3 look = player.getLookVec(); look.rotateAroundY((float) Math.PI / 2); for (int i = 0; i < amount; i++) { double x = event.entityLiving.posX - amount * 0.35 * look.xCoord / 2 + i * 0.35 * look.xCoord; double y = event.entityLiving.posY + 1.5 + event.entityLiving.worldObj.rand.nextGaussian() * 0.05; double z = event.entityLiving.posZ - amount * 0.35 * look.zCoord / 2 + i * 0.35 * look.zCoord; EtFuturum.networkWrapper.sendToAllAround(new BlackHeartParticlesMessage(x, y, z), new TargetPoint(player.worldObj.provider.dimensionId, x, y, z, 64)); } } } }
@SubscribeEvent public void onScreenShotShield(final @Nonnull ScreenShotShieldEvent.Post event) { if (Config.getConfig().notifyChat.get()) { final String mode = ScreenShotShieldRegistery.getListener(Config.getConfig().ssmode.get()).name(); ChatBuilder.create("mchelishield.notification.chat.screenshot.message").useTranslation().setParams(mode).chatClient(); ChatBuilder.create("mchelishield.notification.chat.screenshot.message.mode").useTranslation().setParams(mode).chatClient(); } if (Config.getConfig().notifySound.get()) FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F)); if (Config.getConfig().notifyEffect.get()) this.effectStrength = .75f; if (Config.getConfig().notifyOverlay.get()) { this.text = I18n.format("mchelishield.notification.overlay.screenshot.message"); this.textStrength = 1f; } }
@SubscribeEvent public void onModListShield(final @Nonnull ModListShieldEvent.Post event) { if (Config.getConfig().notifyChat.get()) { final String mode = ModListShieldRegistery.getListener(Config.getConfig().mlmode.get()).name(); ChatBuilder.create("mchelishield.notification.chat.modlist.message").useTranslation().setParams(mode).chatClient(); ChatBuilder.create("mchelishield.notification.chat.modlist.message.mode").useTranslation().setParams(mode).chatClient(); } if (Config.getConfig().notifySound.get()) FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F)); if (Config.getConfig().notifyEffect.get()) this.effectStrength = .75f; if (Config.getConfig().notifyOverlay.get()) { this.text = I18n.format("mchelishield.notification.overlay.modlist.message"); this.textStrength = 1f; } }
@SubscribeEvent public void keyListener(KeyInputEvent event) throws IOException { if (EasyLogin.logingui.isPressed()) { Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(new MainGui(mc.currentScreen)); // 密码读取 InputStream in = new BufferedInputStream(new FileInputStream("config/easylogin.properties")); prop.load(in); // 解密密码 byte[] passwordByte = prop.getProperty("PassWord").getBytes(); byte key = 124; for (int i = 0; i < passwordByte.length; i++) { passwordByte[i] ^= key; } MainGui.settext(new String(passwordByte)); System.out.println(new String(passwordByte)); } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void renderTick(TickEvent.RenderTickEvent event) { Minecraft mc = FMLClientHandler.instance().getClient(); World world = mc.theWorld; if (event.phase != TickEvent.Phase.START) { if ((Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer)) { EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().renderViewEntity; if ((player != null) && (mc.inGameHasFocus) && (Minecraft.isGuiEnabled())) { // If player have radiation detector on hotbar. if (isPlayerHasItemOnHotbar(player.inventory, ItemsHZDS.radiation_detector)) { PlayerTracker tracker = TrackerManager.lookupTrackerFromUsername(mc.thePlayer.getCommandSenderName()); if (tracker != null) { renderRadiation(tracker); } } } } } }
@SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event) { PlayerTracker tracker = TrackerManager.lookupTracker(event.original); if (tracker != null) { HazardsLib.modLog.info("Changing tracker owner for: '" + event.entity.getCommandSenderName() + "'..."); tracker.owner = event.entityPlayer; if (event.wasDeath) { tracker.resetData(); TrackerManager.saveTracker(tracker); } tracker.loadFromNBT(); } if (event.wasDeath) { doDeath(event.entityPlayer); doDeath(event.original); } }
@SubscribeEvent public void ItemCraftedEvent(cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent event) { //System.out.println("[EVENT] Player crafted something."); if (event.crafting != null && event.crafting.getItem() instanceof ERA) { ItemStack stack = event.craftMatrix.getStackInSlot(1); if (stack != null && stack.stackSize > 1) { stack.stackSize -= 26; if (stack.stackSize <= 0) { event.craftMatrix.setInventorySlotContents(1, null); } // Nothing left } // else, nothing in there or only a single rail, meaning this is a repairing event. I'm fine with that } // else, not mine, so don't care else if (event.crafting != null && event.crafting.getItem() instanceof _WeaponBase) // More generic weapon check { this.copyName(event.craftMatrix, event.crafting); } }
@SubscribeEvent public void onCrafting(ItemCraftedEvent e) { ItemStack itemstack = e.crafting; Item item = itemstack.getItem(); IInventory inventory = e.craftMatrix; if (item == null || inventory == null) return; if(inventory != null) { if(item == ModItems.itemWoodenTwig) com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.hammers); if(item == TFCItems.stick) com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.knives); } }
@SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; PlayerRoleplayMode props = PlayerRoleplayMode.get(player); NBTTagCompound playerDataRoleplayMode = CommonProxy.getEntityData((player).getCommandSenderName()); if (playerDataRoleplayMode != null) { props.loadNBTData(playerDataRoleplayMode); } PacketHandler.INSTANCE.sendTo(new MessageSyncRoleplayMode(player), (EntityPlayerMP) player); } }
@SubscribeEvent public void eventBreakEvent(BlockEvent.BreakEvent event) { World world = event.world; int x = event.x; int y = event.y; int z = event.z; EntityPlayer player = event.getPlayer(); if (player != null && player.getHeldItem() != null && player.getHeldItem().getItem() == Items.stick) { if (TOConfig.debugEnable && TOConfig.debugRemover && !world.isRemote && player.capabilities.isCreativeMode) { int radius = TOConfig.debugRemoverScannerRadius; for (int xx = x - radius; xx < x + radius; xx++) for (int zz = z - radius; zz < z + radius; zz++) for (int yy = 0; yy < 257; yy++) if (!(world.getBlock(xx, yy, zz) instanceof BlockInfusedBlockOre)) world.setBlock(xx, yy, zz, Blocks.air, 0, 2); String text = "[DEBUG " + ThaumOresMod.NAME + "] Removed blocks at " + x + ";" + z + " with radius " + radius; player.addChatMessage(new ChatComponentText(text)); ThaumOresMod.log.info(text); } } }
/** * By subscribing to the OnConfigChangedEvent we are able to execute code when our config screens are closed. * This implementation uses the optional configID string to handle multiple Configurations using one event handler. */ @SubscribeEvent public void onConfigChanged(OnConfigChangedEvent event) { if (getMetadata().modId.equals(event.modID) && !event.isWorldRunning) { if (Configuration.CATEGORY_GENERAL.equals(event.configID)) { syncConfig(false); } else if ("chunkLoader".equals(event.configID)) { ForgeChunkManager.syncConfigDefaults(); ForgeChunkManager.loadConfiguration(); } } }
@SubscribeEvent public void updateEntity(final LivingEvent.LivingUpdateEvent event) { if (event.entity.worldObj.isRemote) { return; } if (event.entity.getEntityData().hasKey("CursedEarth")) { int c = event.entity.getEntityData().getInteger("CursedEarth"); if (c == 0) { event.entity.setDead(); NetworkHandler.sendParticle(event.entity.worldObj, "smoke", event.entity.posX, event.entity.posY + event.entity.height / 4.0f, event.entity.posZ, 0.0, 0.0, 0.0, false); } else { --c; event.entity.getEntityData().setInteger("CursedEarth", c); } } }
@SubscribeEvent public void onBlockPlace(PlaceEvent event) { Location loc = new Location(event.world, event.x, event.y, event.z); TileEntity tileEntity = loc.getTileEntity(); if (tileEntity instanceof TileEntityEnergyBase) { TileEntityEnergyBase energy = (TileEntityEnergyBase) tileEntity; NBTTagCompound nbt = NBTUtil.getNBT(event.itemInHand); if (nbt.hasKey("energy")) { energy.storage.modifyEnergyStored(nbt.getInteger("energy")); } } }
@SubscribeEvent public void onTick(TickEvent.ServerTickEvent e) { if (e.phase == TickEvent.Phase.START) { final Runnable[] adds; synchronized (pending) { adds = pending.toArray(new Runnable[pending.size()]); pending.clear(); } for (Runnable runnable : adds) { try { runnable.run(); } catch (Throwable t) { log.warn("Error in scheduled tick action.", t); } } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void schematicFlipEvent(FlipPage event) { ISchematicPage page = null; switch (event.direction) { case 1: page = EventHandlerGC.getNextSchematic(event.index); break; case -1: page = EventHandlerGC.getLastSchematic(event.index); break; } if (page != null) { GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_SCHEMATIC_PAGE, new Object[] { page.getPageID() })); FMLClientHandler.instance().getClient().thePlayer.openGui(GalacticraftCore.instance, page.getGuiID(), FMLClientHandler.instance().getClient().thePlayer.worldObj, (int) FMLClientHandler.instance().getClient().thePlayer.posX, (int) FMLClientHandler.instance().getClient().thePlayer.posY, (int) FMLClientHandler.instance().getClient().thePlayer.posZ); } }
@SubscribeEvent public void addUnstableTimer(final SmelteryCastedEvent.CastingTable event) { if (ExtraUtils.tcon_unstable_material_id <= 0) { return; } final ItemStack output = event.output; if (output == null || !(output.getItem() instanceof IToolPart)) { return; } final IToolPart part = (IToolPart)output.getItem(); if (part.getMaterialID(output) != ExtraUtils.tcon_unstable_material_id) { return; } final NBTTagCompound tag = getOrInitTag(output); final WorldServer world = DimensionManager.getWorld(0); if (world == null) { return; } tag.setLong("XUDeadline", world.getTotalWorldTime()); final WorldServer localWorld = DimensionManager.getWorld(this.curDim); if (localWorld != null) { tag.setLong("XULocalDeadline", localWorld.getTotalWorldTime()); tag.setInteger("XULocalDim", this.curDim); } }
@SubscribeEvent(priority = EventPriority.LOWEST) public void denyCraft(final ToolBuildEvent event) { if (ExtraUtils.tcon_unstable_material_id <= 0) { return; } final WorldServer world = DimensionManager.getWorld(0); if (world == null) { return; } if (isToolExpired(event.headStack, world) || isToolExpired(event.handleStack, world) || isToolExpired(event.accessoryStack, world) || isToolExpired(event.extraStack, world)) { event.headStack = null; event.handleStack = null; event.accessoryStack = null; event.extraStack = null; } }
@SubscribeEvent(priority = EventPriority.LOWEST) public void onPlayerPearl(EnderTeleportEvent event) { if ( !(event.entityLiving instanceof EntityPlayerMP) ) return; if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() ) return; EntityPlayerMP player = (EntityPlayerMP) event.entityLiving; Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() ); Location target = new Location(event, player); Location newLoc = BorderCheck.checkPlayer(player, target, true, true); if (newLoc != null) { event.setCanceled(true); event.targetX = newLoc.posX; event.targetY = newLoc.posY; event.targetZ = newLoc.posZ; } }
@SubscribeEvent public void noMobs(final LivingSpawnEvent.CheckSpawn event) { if (event.getResult() == Event.Result.DEFAULT && event.world.provider.dimensionId == ExtraUtils.underdarkDimID && event.entity instanceof EntityMob) { if (EventHandlerUnderdark.rand.nextDouble() < Math.min(0.95, event.entity.posY / 80.0)) { event.setResult(Event.Result.DENY); } else { IAttributeInstance t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.maxHealth); t.setBaseValue(t.getBaseValue() * 2.0); ((EntityMob)event.entity).heal((float)t.getAttributeValue()); t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.attackDamage); t.setBaseValue(t.getBaseValue() * 2.0); if (!EventHandlerServer.isInRangeOfTorch(event.entity) && event.entityLiving.worldObj.checkNoEntityCollision(event.entityLiving.boundingBox) && event.entityLiving.worldObj.getCollidingBoundingBoxes((Entity)event.entityLiving, event.entityLiving.boundingBox).isEmpty() && !event.entityLiving.worldObj.isAnyLiquid(event.entityLiving.boundingBox)) { event.setResult(Event.Result.ALLOW); } } } }
@SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { if(event.getChunk() != null && !event.world.isRemote) { int x = event.getChunk().xPosition; int z = event.getChunk().zPosition; IChunkProvider cProvider = event.getChunk().worldObj.getChunkProvider(); Chunk[] neighbors = new Chunk[5]; neighbors[0] = event.getChunk(); if(cProvider.chunkExists(x + 1, z)) neighbors[1] = cProvider.provideChunk(x + 1, z); if(cProvider.chunkExists(x - 1, z)) neighbors[2] = cProvider.provideChunk(x - 1, z); if(cProvider.chunkExists(x, z + 1)) neighbors[3] = cProvider.provideChunk(x, z + 1); if(cProvider.chunkExists(x, z - 1)) neighbors[4] = cProvider.provideChunk(x, z - 1); for(Chunk c : neighbors) { refreshChunk(c); } } }
@SubscribeEvent public void onZombieSummonAid(SummonAidEvent event) { if (event.entity instanceof EntityEvolvedZombie) { event.customSummonedAid = new EntityEvolvedZombie(event.world); if (((EntityLivingBase) event.entity).getRNG().nextFloat() < ((EntityEvolvedZombie) event.entity).getEntityAttribute(((EntityEvolvedZombie) event.entity).getReinforcementsAttribute()).getAttributeValue()) { event.setResult(Result.ALLOW); } else { event.setResult(Result.DENY); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onClientTick(ClientTickEvent event) { final Minecraft minecraft = FMLClientHandler.instance().getClient(); final WorldClient world = minecraft.theWorld; if (world != null) { if (world.provider instanceof WorldProviderMars) { if (world.provider.getSkyRenderer() == null) { world.provider.setSkyRenderer(new SkyProviderMars((IGalacticraftWorldProvider) world.provider)); } if (world.provider.getCloudRenderer() == null) { world.provider.setCloudRenderer(new CloudRenderer()); } } } }
@SubscribeEvent public void onPlanetDecorated(GCCoreEventPopulate.Post event) { if (this.eggGenerator == null) { this.eggGenerator = new WorldGenEggs(MarsBlocks.rock); } if (event.worldObj.provider instanceof WorldProviderMars) { int eggsPerChunk = 2; int x; int y; int z; for (int eggCount = 0; eggCount < eggsPerChunk; ++eggCount) { x = event.chunkX + event.rand.nextInt(16) + 8; y = event.rand.nextInt(128); z = event.chunkZ + event.rand.nextInt(16) + 8; this.eggGenerator.generate(event.worldObj, event.rand, x, y, z); } } }
@SubscribeEvent public void onConnectionReceived(ServerConnectionFromClientEvent event) { if (ConfigManagerCore.enableDebug) { Integer[] idList = (Integer[]) WorldUtil.getPlanetList().get(0); String ids = ""; for (int j = 0; j < idList.length; j++) { ids+=idList[j].toString()+" "; } GCLog.info("Galacticraft server sending dimension IDs to connecting client: "+ ids); } event.manager.scheduleOutboundPacket(ConnectionPacket.createDimPacket(WorldUtil.getPlanetListInts())); event.manager.scheduleOutboundPacket(ConnectionPacket.createSSPacket(WorldUtil.getSpaceStationListInts())); event.manager.scheduleOutboundPacket(ConnectionPacket.createConfigPacket(ConfigManagerCore.getServerConfigOverride())); }
@SubscribeEvent public void entityEvent(LivingEvent.LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { if (((EntityPlayer) event.entity).getCurrentEquippedItem() != null) { canItemShowTess = (RFUtilities.TE_LOADED && (((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemToolBase || ((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemMultimeter)) || ((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemDialer; } else { canItemShowTess = false; } } }
@SubscribeEvent public void onPlayerCloned(PlayerEvent.Clone e) { NBTTagCompound nbt = new NBTTagCompound(); PlayerData.get(e.original).saveReviveRelevantNBTData(nbt, e.wasDeath); PlayerData.get(e.entityPlayer).loadNBTData(nbt); }
@SubscribeEvent public void onBlockBreak(BlockEvent.BreakEvent evt) { /* if (evt.block instanceof LobbyBlock) { // RESETS DATA AND CANCELS EVENT LobbyTileEntity t = (LobbyTileEntity) evt.world.getTileEntity(evt.x, evt.y, evt.z); if (t != null) { PlayerData data; for (EntityPlayer p : UUIDUtil.getPlayersFromProfileUUIDs(evt.world, t.players)) { data = PlayerData.get(p); data.setReady(false); data.setInLobby(false); if (evt.world.isRemote) data.sendToServer(); t.removePlayer(p); //PAYDAY.INSTANCE.sendToServer(new LobbyPlayerActionPacket(evt.x, evt.y, evt.z, true)); } } //evt.setCanceled(true); }*/ }
@SubscribeEvent public void onPlayerLoggedIn(PlayerLoggedInEvent event) { if (mod.getConfig().isUseVersionChecker() && mod.getVersionChecker().isNewVersionAvaible()) { if (mod.getVersionChecker().getNewestVersion() != null) { event.player.addChatComponentMessage(mod.getVersionChecker().getNewestVersion().getFormattedChatText()); } } }