Search in sources :

Example 1 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project RFToolsDimensions by McJty.

the class SkyRenderer method registerSky.

public static void registerSky(GenericWorldProvider provider, final DimensionInformation information) {
    provider.setSkyRenderer(new IRenderHandler() {

        @Override
        public void render(float partialTicks, WorldClient world, Minecraft mc) {
            SkyRenderer.renderSky(partialTicks, provider);
        }
    });
    provider.setCloudRenderer(null);
}
Also used : IRenderHandler(net.minecraftforge.client.IRenderHandler) WorldClient(net.minecraft.client.multiplayer.WorldClient) Minecraft(net.minecraft.client.Minecraft)

Example 2 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project RFToolsDimensions by McJty.

the class DimensionMonitorItem method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    for (int i = 0; i <= 8; i++) {
        ResourceLocation registryName = getRegistryName();
        registryName = new ResourceLocation(registryName.getResourceDomain(), registryName.getResourcePath() + i);
        ModelBakery.registerItemVariants(this, new ModelResourceLocation(registryName, "inventory"));
    // ModelBakery.addVariantName(this, getRegistryName() + i);
    }
    ModelLoader.setCustomMeshDefinition(this, stack -> {
        WorldClient world = Minecraft.getMinecraft().world;
        int id = world.provider.getDimension();
        DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
        int energyLevel = storage.getEnergyLevel(id);
        int level = (9 * energyLevel) / PowerConfiguration.MAX_DIMENSION_POWER;
        if (level < 0) {
            level = 0;
        } else if (level > 8) {
            level = 8;
        }
        ResourceLocation registryName = getRegistryName();
        registryName = new ResourceLocation(registryName.getResourceDomain(), registryName.getResourcePath() + (8 - level));
        return new ModelResourceLocation(registryName, "inventory");
    });
}
Also used : DimensionStorage(mcjty.rftoolsdim.dimensions.DimensionStorage) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) WorldClient(net.minecraft.client.multiplayer.WorldClient) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project MorePlanets by SteveKunG.

the class ClientProxyMP method handleSpaceFishHookSpawning.

private static void handleSpaceFishHookSpawning() {
    EntityRegistration entityRegistration = EntityRegistry.instance().lookupModSpawn(EntitySpaceFishHook.class, false);
    Function<EntitySpawnMessage, Entity> handler = input -> {
        int entityID = 0;
        double posX = 0;
        double posY = 0;
        double posZ = 0;
        WorldClient world = FMLClientHandler.instance().getWorldClient();
        try {
            entityID = ReflectionHelper.findField(EntitySpawnMessage.class, "throwerId").getInt(input);
            posX = ReflectionHelper.findField(EntitySpawnMessage.class, "rawX").getDouble(input);
            posY = ReflectionHelper.findField(EntitySpawnMessage.class, "rawY").getDouble(input);
            posZ = ReflectionHelper.findField(EntitySpawnMessage.class, "rawZ").getDouble(input);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Entity angler = world.getEntityByID(entityID);
        if (angler instanceof EntityPlayer) {
            Entity entity = new EntitySpaceFishHook(world, (EntityPlayer) angler, posX, posY, posZ);
            return entity;
        }
        return null;
    };
    entityRegistration.setCustomSpawning(handler, false);
}
Also used : ParticleAlienMinerSpark(stevekung.mods.moreplanets.module.planets.diona.client.particle.ParticleAlienMinerSpark) BiomeColorHelper(net.minecraft.world.biome.BiomeColorHelper) ModelBakeEvent(net.minecraftforge.client.event.ModelBakeEvent) Item(net.minecraft.item.Item) ModelRegistryEvent(net.minecraftforge.client.event.ModelRegistryEvent) ClientRegisterHelper(stevekung.mods.moreplanets.util.helper.ClientRegisterHelper) ColorHelper(stevekung.mods.moreplanets.util.helper.ColorHelper) ItemRendererTieredRocket(stevekung.mods.moreplanets.util.client.renderer.item.ItemRendererTieredRocket) Side(net.minecraftforge.fml.relauncher.Side) ClientEventHandler(stevekung.mods.moreplanets.core.event.ClientEventHandler) ParticleDarkPortal(stevekung.mods.moreplanets.module.planets.diona.client.particle.ParticleDarkPortal) ParticleFallingDustMP(stevekung.mods.moreplanets.util.client.particle.ParticleFallingDustMP) MPSchematics(stevekung.mods.moreplanets.init.MPSchematics) ParticleInfectedSpore(stevekung.mods.moreplanets.module.planets.nibiru.client.particle.ParticleInfectedSpore) ParticleKoentusMeteor(stevekung.mods.moreplanets.module.moons.koentus.client.particle.ParticleKoentusMeteor) Function(com.google.common.base.Function) ModelLoaderRegistry(net.minecraftforge.client.model.ModelLoaderRegistry) EntitySpawnMessage(net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage) MPItems(stevekung.mods.moreplanets.init.MPItems) ParticleAlienBerry(stevekung.mods.moreplanets.module.planets.nibiru.client.particle.ParticleAlienBerry) FMLClientHandler(net.minecraftforge.fml.client.FMLClientHandler) TileEntityItemStackRenderer(net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ParticleInfectedGuardianAppearance(stevekung.mods.moreplanets.module.planets.nibiru.client.particle.ParticleInfectedGuardianAppearance) EnumParticleTypes(net.minecraft.util.EnumParticleTypes) ParticleLiquidDrip(stevekung.mods.moreplanets.util.client.particle.ParticleLiquidDrip) CompatibilityManagerMP(stevekung.mods.moreplanets.util.CompatibilityManagerMP) ParticleBreakingMC(stevekung.mods.moreplanets.util.client.particle.ParticleBreakingMC) ParticleLavaMC(stevekung.mods.moreplanets.util.client.particle.ParticleLavaMC) EnumParticleTypesMP(stevekung.mods.moreplanets.util.EnumParticleTypesMP) ReflectionHelper(net.minecraftforge.fml.relauncher.ReflectionHelper) WorldClient(net.minecraft.client.multiplayer.WorldClient) IMorePlanetsBoss(stevekung.mods.moreplanets.util.IMorePlanetsBoss) stevekung.mods.moreplanets.client.renderer(stevekung.mods.moreplanets.client.renderer) DionaBlocks(stevekung.mods.moreplanets.module.planets.diona.blocks.DionaBlocks) ImmutableList(com.google.common.collect.ImmutableList) Minecraft(net.minecraft.client.Minecraft) TextureStitchEvent(net.minecraftforge.client.event.TextureStitchEvent) TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Entity(net.minecraft.entity.Entity) FronosBlocks(stevekung.mods.moreplanets.module.planets.fronos.blocks.FronosBlocks) CommonRegisterHelper(stevekung.mods.moreplanets.util.helper.CommonRegisterHelper) NibiruBlocks(stevekung.mods.moreplanets.module.planets.nibiru.blocks.NibiruBlocks) EntitySpaceFishHook(stevekung.mods.moreplanets.entity.projectile.EntitySpaceFishHook) BlockColors(net.minecraft.client.renderer.color.BlockColors) ParticleCrystallizeFlame(stevekung.mods.moreplanets.module.planets.diona.client.particle.ParticleCrystallizeFlame) ColorizerGrass(net.minecraft.world.ColorizerGrass) EntityRegistration(net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) Particle(net.minecraft.client.particle.Particle) ItemBlock(net.minecraft.item.ItemBlock) EntityRegistry(net.minecraftforge.fml.common.registry.EntityRegistry) Entity(net.minecraft.entity.Entity) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntitySpaceFishHook(stevekung.mods.moreplanets.entity.projectile.EntitySpaceFishHook) EntitySpawnMessage(net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage) WorldClient(net.minecraft.client.multiplayer.WorldClient) EntityRegistration(net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration)

Example 4 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project Almura by AlmuraDev.

the class ClientboundExchangeOpenResponsePacketHandler method handleMessage.

@Override
public void handleMessage(ClientboundExchangeOpenResponsePacket message, RemoteConnection connection, Platform.Type side) {
    if (side.isClient()) {
        final Minecraft client = Minecraft.getMinecraft();
        if (PacketUtil.checkThreadAndEnqueue(client, message, this, connection, side)) {
            final EntityPlayerSP player = client.player;
            final WorldClient world = client.world;
            if (world != null) {
                new ExchangeGUI(player, world, player.getPosition()).display();
            }
        }
    }
}
Also used : ExchangeGUI(com.almuradev.almura.feature.exchange.client.gui.ExchangeGUI) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient)

Example 5 with WorldClient

use of net.minecraft.client.multiplayer.WorldClient in project minecolonies by Minecolonies.

the class EventHandler method onDebugOverlay.

/**
 * Event when the debug screen is opened. Event gets called by displayed
 * text on the screen, we only need it when f3 is clicked.
 *
 * @param event {@link net.minecraftforge.client.event.RenderGameOverlayEvent.Text}
 */
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDebugOverlay(final RenderGameOverlayEvent.Text event) {
    if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
        final Minecraft mc = Minecraft.getMinecraft();
        if (mc.gameSettings.showDebugInfo) {
            final WorldClient world = mc.world;
            final EntityPlayerSP player = mc.player;
            IColony colony = ColonyManager.getIColony(world, player.getPosition());
            if (colony == null) {
                if (!ColonyManager.isTooCloseToColony(world, player.getPosition())) {
                    event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.noCloseColony"));
                    return;
                }
                colony = ColonyManager.getClosestIColony(world, player.getPosition());
                if (colony == null) {
                    return;
                }
                event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.nextColony", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition())), ColonyManager.getMinimumDistanceBetweenTownHalls()));
                return;
            }
            event.getLeft().add(colony.getName() + " : " + LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.blocksFromCenter", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition()))));
        }
    }
}
Also used : IColony(com.minecolonies.api.colony.IColony) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) 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)33 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 BlockPos (net.minecraft.util.math.BlockPos)7 IBlockState (net.minecraft.block.state.IBlockState)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 Block (net.minecraft.block.Block)5 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 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 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)2