static { for (final String s : GCCoreConfigManager.detectableIDs) { final String[] split = s.split(":"); int blockID = Integer.parseInt(split[0]); List<Integer> metaList = Lists.newArrayList(); metaList.add(Integer.parseInt(split[1])); for (BlockMetaList blockMetaList : ClientProxyCore.detectableBlocks) { if (blockMetaList.getBlockID() == blockID) { metaList.addAll(blockMetaList.getMetaList()); break; } } if (!metaList.contains(0)) { metaList.add(0); } ClientProxyCore.detectableBlocks.add(new BlockMetaList(blockID, metaList)); } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { final Minecraft minecraft = FMLClientHandler.instance().getClient(); final WorldClient world = minecraft.theWorld; final EntityClientPlayerMP player = minecraft.thePlayer; if (type.equals(EnumSet.of(TickType.CLIENT))) { if (GCCoreTickHandlerClient.tickCount >= Long.MAX_VALUE) { GCCoreTickHandlerClient.tickCount = 0; } GCCoreTickHandlerClient.tickCount++; if (GCCoreTickHandlerClient.tickCount % 20 == 0) { if (player != null && player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() instanceof GCCoreItemSensorGlasses) { ClientProxyCore.valueableBlocks.clear(); for (int i = -4; i < 5; i++) { for (int j = -4; j < 5; j++) { for (int k = -4; k < 5; k++) { int x = MathHelper.floor_double(player.posX + i); int y = MathHelper.floor_double(player.posY + j); int z = MathHelper.floor_double(player.posZ + k); final int id = player.worldObj.getBlockId(x, y, z); if (id != 0) { final Block block = Block.blocksList[id]; int metadata = world.getBlockMetadata(x, y, z); boolean isDetectable = false; for (BlockMetaList blockMetaList : ClientProxyCore.detectableBlocks) { if (blockMetaList.getBlockID() == id && blockMetaList.getMetaList().contains(metadata)) { isDetectable = true; break; } } if (isDetectable) { if (!this.alreadyContainsBlock(x, y, z)) { ClientProxyCore.valueableBlocks.add(new Vector3(x, y, z)); } } else if (block instanceof IDetectableResource && ((IDetectableResource) block).isValueable(metadata)) { if (!this.alreadyContainsBlock(x, y, z)) { ClientProxyCore.valueableBlocks.add(new Vector3(x, y, z)); } List<Integer> metaList = Lists.newArrayList(); metaList.add(metadata); for (BlockMetaList blockMetaList : ClientProxyCore.detectableBlocks) { if (blockMetaList.getBlockID() == id) { metaList.addAll(blockMetaList.getMetaList()); break; } } ClientProxyCore.detectableBlocks.add(new BlockMetaList(id, metaList)); } } } } } } } if (GCCoreTickHandlerClient.addTabsNextTick) { if (minecraft.currentScreen.getClass().equals(GuiInventory.class)) { GCCoreTickHandlerClient.addTabsToInventory((GuiContainer) minecraft.currentScreen); } GCCoreTickHandlerClient.addTabsNextTick = false; } if (minecraft.currentScreen != null && minecraft.currentScreen instanceof GuiMainMenu) { GalacticraftCore.playersServer.clear(); GalacticraftCore.playersClient.clear(); ClientProxyCore.playerItemData.clear(); if (GCCoreTickHandlerClient.missingRequirementThread == null) { GCCoreTickHandlerClient.missingRequirementThread = new GCCoreThreadRequirementMissing(FMLCommonHandler.instance().getEffectiveSide()); GCCoreTickHandlerClient.missingRequirementThread.start(); } } if (world != null && GCCoreTickHandlerClient.checkedVersion) { GCCoreUtil.checkVersion(Side.CLIENT); GCCoreTickHandlerClient.checkedVersion = false; } if (player != null && player.ridingEntity != null && player.ridingEntity instanceof EntitySpaceshipBase) { final Object[] toSend = {player.ridingEntity.rotationPitch}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_PITCH, toSend)); final Object[] toSend2 = {player.ridingEntity.rotationYaw}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_YAW, toSend2)); } if (world != null && world.provider instanceof WorldProviderSurface) { if (world.provider.getSkyRenderer() == null && player.ridingEntity != null && player.ridingEntity.posY >= 200) { world.provider.setSkyRenderer(new GCCoreSkyProviderOverworld()); } else if (world.provider.getSkyRenderer() != null && world.provider.getSkyRenderer() instanceof GCCoreSkyProviderOverworld && (player.ridingEntity == null || player.ridingEntity.posY < 200)) { world.provider.setSkyRenderer(null); } } if (world != null && world.provider instanceof GCCoreWorldProviderSpaceStation) { if (world.provider.getSkyRenderer() == null) { world.provider.setSkyRenderer( new GCCoreSkyProviderOrbit( new ResourceLocation( GalacticraftCore.ASSET_DOMAIN, "textures/gui/planets/overworld.png"), true, true)); } if (world.provider.getCloudRenderer() == null) { world.provider.setCloudRenderer(new GCCoreCloudRenderer()); } } if (player != null && player.ridingEntity != null && player.ridingEntity instanceof EntitySpaceshipBase) { final EntitySpaceshipBase ship = (EntitySpaceshipBase) player.ridingEntity; if (minecraft.gameSettings.keyBindLeft.pressed) { ship.turnYaw(-1.0F); final Object[] toSend = {ship.rotationYaw}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_YAW, toSend)); } if (minecraft.gameSettings.keyBindRight.pressed) { ship.turnYaw(1.0F); final Object[] toSend = {ship.rotationYaw}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_YAW, toSend)); } if (minecraft.gameSettings.keyBindForward.pressed) { if (ship.getLaunched()) { ship.turnPitch(-0.7F); final Object[] toSend = {ship.rotationPitch}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_PITCH, toSend)); } } if (minecraft.gameSettings.keyBindBack.pressed) { if (ship.getLaunched()) { ship.turnPitch(0.7F); final Object[] toSend = {ship.rotationPitch}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_SHIP_PITCH, toSend)); } } } if (world != null) { for (int i = 0; i < world.loadedEntityList.size(); i++) { final Entity e = (Entity) world.loadedEntityList.get(i); if (e != null) { if (e instanceof GCCoreEntityRocketT1) { final GCCoreEntityRocketT1 eship = (GCCoreEntityRocketT1) e; if (eship.rocketSoundUpdater == null) { eship.rocketSoundUpdater = new GCCoreSoundUpdaterSpaceship( FMLClientHandler.instance().getClient().sndManager, eship, FMLClientHandler.instance().getClient().thePlayer); } } } } } if (FMLClientHandler.instance().getClient().currentScreen instanceof GCCoreGuiChoosePlanet) { player.motionY = 0; } if (world != null && world.provider instanceof IGalacticraftWorldProvider) { world.setRainStrength(0.0F); } if (!minecraft.gameSettings.keyBindJump.pressed) { ClientProxyCore.lastSpacebarDown = false; } if (player != null && player.ridingEntity != null && minecraft.gameSettings.keyBindJump.pressed && !ClientProxyCore.lastSpacebarDown) { final Object[] toSend = {0}; PacketDispatcher.sendPacketToServer( PacketUtil.createPacket( GalacticraftCore.CHANNEL, EnumPacketServer.IGNITE_ROCKET, toSend)); ClientProxyCore.lastSpacebarDown = true; } } }