Search in sources :

Example 11 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project ClaySoldiersMod by SanAndreasP.

the class ClientProxy method swingSoldierArm.

@Override
public void swingSoldierArm(byte[] data, Player player) {
    WorldClient world = (WorldClient) ((EntityPlayer) player).worldObj;
    Entity entity = world.getEntityByID(getEntityIdFromByteArray(data));
    if (entity != null && entity instanceof EntityClayMan)
        ((EntityClayMan) entity).swingArm();
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) WorldClient(net.minecraft.client.multiplayer.WorldClient)

Example 12 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project Random-Things by lumien231.

the class MessageLightRedirector method onMessage.

@Override
public void onMessage(MessageContext context) {
    WorldClient worldObj = Minecraft.getMinecraft().world;
    if (worldObj != null && worldObj.provider.getDimension() == dimension && worldObj.isBlockLoaded(pos)) {
        for (EnumFacing facing : EnumFacing.VALUES) {
            if (!(worldObj.getBlockState(pos.offset(facing)).getBlock() instanceof BlockLightRedirector)) {
                IBlockState state = worldObj.getBlockState(pos.offset(facing));
                worldObj.notifyBlockUpdate(pos.offset(facing), state, state, 3);
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) EnumFacing(net.minecraft.util.EnumFacing) BlockLightRedirector(lumien.randomthings.block.BlockLightRedirector) WorldClient(net.minecraft.client.multiplayer.WorldClient)

Example 13 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project FoamFix by asiekierka.

the class ProxyClient method onWorldUnload.

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldUnload(WorldEvent.Unload event) {
    if (FoamFixShared.config.clClearCachesOnUnload && event.getWorld() instanceof WorldClient && REGION_CACHE_GETTER != null) {
        try {
            LoadingCache cache = (LoadingCache) (REGION_CACHE_GETTER.invoke());
            cache.invalidateAll();
            cache.cleanUp();
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
Also used : LoadingCache(com.google.common.cache.LoadingCache) WorldClient(net.minecraft.client.multiplayer.WorldClient) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 14 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project Galacticraft by micdoodle8.

the class AsteroidsEventHandlerClient method onClientTick.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
    Minecraft minecraft = Minecraft.getMinecraft();
    WorldClient world = minecraft.theWorld;
    if (world != null) {
        if (world.provider instanceof WorldProviderAsteroids) {
            if (world.provider.getSkyRenderer() == null) {
                world.provider.setSkyRenderer(new SkyProviderAsteroids((IGalacticraftWorldProvider) world.provider));
            }
            if (world.provider.getCloudRenderer() == null) {
                world.provider.setCloudRenderer(new CloudRenderer());
            }
        }
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) CloudRenderer(micdoodle8.mods.galacticraft.core.client.CloudRenderer) SkyProviderAsteroids(micdoodle8.mods.galacticraft.planets.asteroids.client.SkyProviderAsteroids) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient) WorldProviderAsteroids(micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 15 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project Galacticraft by micdoodle8.

the class EventHandlerGC method overrideSkyColor.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void overrideSkyColor(FogColors event) {
    // Disable any night vision effects on the sky, if the planet has no atmosphere
    if (event.entity instanceof EntityLivingBase && ((EntityLivingBase) event.entity).isPotionActive(Potion.nightVision)) {
        WorldClient worldclient = Minecraft.getMinecraft().theWorld;
        if (worldclient.provider instanceof IGalacticraftWorldProvider && ((IGalacticraftWorldProvider) worldclient.provider).hasNoAtmosphere() && event.block.getMaterial() == Material.air && !((IGalacticraftWorldProvider) worldclient.provider).hasBreathableAtmosphere()) {
            Vec3 vec = worldclient.getFogColor(1.0F);
            event.red = (float) vec.xCoord;
            event.green = (float) vec.yCoord;
            event.blue = (float) vec.zCoord;
            return;
        }
        if (worldclient.provider.getSkyRenderer() instanceof SkyProviderOverworld && event.entity.posY > Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) {
            Vec3 vec = TransformerHooks.getFogColorHook(event.entity.worldObj);
            event.red = (float) vec.xCoord;
            event.green = (float) vec.yCoord;
            event.blue = (float) vec.zCoord;
            return;
        }
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SkyProviderOverworld(micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld) WorldClient(net.minecraft.client.multiplayer.WorldClient) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

WorldClient (net.minecraft.client.multiplayer.WorldClient)39 Minecraft (net.minecraft.client.Minecraft)19 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)12 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)10 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)10 Entity (net.minecraft.entity.Entity)9 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 BlockPos (net.minecraft.util.math.BlockPos)7 Block (net.minecraft.block.Block)6 IBlockState (net.minecraft.block.state.IBlockState)6 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)4 IRenderHandler (net.minecraftforge.client.IRenderHandler)4 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)3 ItemStack (net.minecraft.item.ItemStack)3 TileEntity (net.minecraft.tileentity.TileEntity)3 BlockPos (net.minecraft.util.BlockPos)3 Function (com.google.common.base.Function)2 Random (java.util.Random)2 GuiCelestialSelection (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection)2 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)2