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);
}
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");
});
}
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);
}
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();
}
}
}
}
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()))));
}
}
}
Aggregations