use of net.minecraft.client.Minecraft in project Witchworks by Um-Mitternacht.
the class BrewHUD method renderOverlay.
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (!BREW_HUD.hide && event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
Optional<IBrewStorage> optional = BrewStorageHandler.getBrewStorage(Minecraft.getMinecraft().player);
if (optional.isPresent()) {
ScaledResolution res = event.getResolution();
int x = res.getScaledWidth() - BREW_HUD.x;
int yOffset = BREW_HUD.y;
Minecraft mc = Minecraft.getMinecraft();
Set<IBrew> client = optional.get().getClient();
if (client == null)
return;
Iterator<IBrew> renders = client.iterator();
GlStateManager.pushMatrix();
while (renders.hasNext()) {
renders.next().renderHUD(x, yOffset, mc);
yOffset += 22;
}
GlStateManager.popMatrix();
}
}
}
use of net.minecraft.client.Minecraft in project Guide-API by TeamAmeriFrance.
the class GuiHelper method getTooltip.
@SuppressWarnings("unchecked")
public static List<String> getTooltip(ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
List<String> list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips);
for (int k = 0; k < list.size(); ++k) {
if (k == 0) {
list.set(k, stack.getRarity().rarityColor + list.get(k));
} else {
list.set(k, TextFormatting.GRAY + list.get(k));
}
}
return list;
}
use of net.minecraft.client.Minecraft in project RFToolsDimensions by McJty.
the class SkyRenderer method renderKenneyClouds.
@SideOnly(Side.CLIENT)
public static void renderKenneyClouds(GenericWorldProvider provider, float partialTicks) {
GlStateManager.disableCull();
Minecraft mc = Minecraft.getMinecraft();
TextureManager renderEngine = mc.getTextureManager();
float f1 = (float) (mc.getRenderViewEntity().lastTickPosY + (mc.getRenderViewEntity().posY - mc.getRenderViewEntity().lastTickPosY) * partialTicks);
Tessellator tessellator = Tessellator.getInstance();
float f2 = 12.0F;
float f3 = 4.0F;
double d0 = (mc.renderGlobal.cloudTickCounter + partialTicks);
double entityX = mc.getRenderViewEntity().prevPosX + (mc.getRenderViewEntity().posX - mc.getRenderViewEntity().prevPosX) * partialTicks;
double entityZ = mc.getRenderViewEntity().prevPosZ + (mc.getRenderViewEntity().posZ - mc.getRenderViewEntity().prevPosZ) * partialTicks;
double d1 = (entityX + d0 * 0.029999999329447746D) / f2;
double d2 = entityZ / f2 + 0.33000001311302185D;
float y = provider.getCloudHeight() - f1 + 0.33F;
int i = MathTools.floor(d1 / 2048.0D);
int j = MathTools.floor(d2 / 2048.0D);
d1 -= (i * 2048);
d2 -= (j * 2048);
renderEngine.bindTexture(locationCloudsPng);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
Vec3d vec3 = provider.getWorld().getCloudColour(partialTicks);
float red = (float) vec3.x;
float green = (float) vec3.y;
float blue = (float) vec3.z;
float f8;
float f9;
float f10;
if (mc.gameSettings.anaglyph) {
f8 = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F;
f9 = (red * 30.0F + green * 70.0F) / 100.0F;
f10 = (red * 30.0F + blue * 70.0F) / 100.0F;
red = f8;
green = f9;
blue = f10;
}
f10 = 0.00390625F;
f8 = MathTools.floor(d1) * f10;
f9 = MathTools.floor(d2) * f10;
float f11 = (float) (d1 - MathTools.floor(d1));
float f12 = (float) (d2 - MathTools.floor(d2));
byte b0 = 8;
byte b1 = 4;
float f13 = 9.765625E-4F;
GlStateManager.scale(f2, 1.0F, f2);
BufferBuilder renderer = tessellator.getBuffer();
for (int k = 0; k < 2; ++k) {
if (k == 0) {
GlStateManager.colorMask(false, false, false, false);
} else if (mc.gameSettings.anaglyph) {
if (EntityRenderer.anaglyphField == 0) {
GlStateManager.colorMask(false, true, true, true);
} else {
GlStateManager.colorMask(true, false, false, true);
}
} else {
GlStateManager.colorMask(true, true, true, true);
}
for (int l = -b1 + 1; l <= b1; ++l) {
for (int i1 = -b1 + 1; i1 <= b1; ++i1) {
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
float u = (l * b0);
float v = (i1 * b0);
float x = u - f11;
float z = v - f12;
// float cr = (float) ((u % 10.0f) / 10.0f);
// float cg = (float) (((u + v) % 10.0f) / 10.0f);
// float cb = (float) ((v % 10.0f) / 10.0f);
float cr = x % 1.0f;
float cg = (x + z) % 1.0f;
float cb = z % 1.0f;
if (y > -f3 - 1.0F) {
renderer.pos((x + 0.0F), (y + 0.0F), (z + b0)).tex(((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
renderer.pos((x + b0), (y + 0.0F), (z + b0)).tex(((u + b0) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
renderer.pos((x + b0), (y + 0.0F), (z + 0.0F)).tex(((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
renderer.pos((x + 0.0F), (y + 0.0F), (z + 0.0F)).tex(((u + 0.0F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
}
if (y <= f3 + 1.0F) {
renderer.pos((x + 0.0F), (y + f3 - f13), (z + b0)).tex(((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * cr, green * cg, blue * cb, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos((x + b0), (y + f3 - f13), (z + b0)).tex(((u + b0) * f10 + f8), ((v + b0) * f10 + f9)).color(red * cr, green * cg, blue * cb, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos((x + b0), (y + f3 - f13), (z + 0.0F)).tex(((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * cr, green * cg, blue * cb, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos((x + 0.0F), (y + f3 - f13), (z + 0.0F)).tex(((u + 0.0F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * cr, green * cg, blue * cb, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
}
int j1;
if (l > -1) {
for (j1 = 0; j1 < b0; ++j1) {
renderer.pos((x + j1 + 0.0F), (y + 0.0F), (z + b0)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 0.0F), (y + f3), (z + b0)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 0.0F), (y + f3), (z + 0.0F)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 0.0F), (y + 0.0F), (z + 0.0F)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
}
}
if (l <= 1) {
for (j1 = 0; j1 < b0; ++j1) {
renderer.pos((x + j1 + 1.0F - f13), (y + 0.0F), (z + b0)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 1.0F - f13), (y + f3), (z + b0)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 1.0F - f13), (y + f3), (z + 0.0F)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
renderer.pos((x + j1 + 1.0F - f13), (y + 0.0F), (z + 0.0F)).tex(((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)).color(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
}
}
if (i1 > -1) {
for (j1 = 0; j1 < b0; ++j1) {
renderer.pos((x + 0.0F), (y + f3), (z + j1 + 0.0F)).tex(((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
renderer.pos((x + b0), (y + f3), (z + j1 + 0.0F)).tex(((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
renderer.pos((x + b0), (y + 0.0F), (z + j1 + 0.0F)).tex(((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
renderer.pos((x + 0.0F), (y + 0.0F), (z + j1 + 0.0F)).tex(((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
}
}
if (i1 <= 1) {
for (j1 = 0; j1 < b0; ++j1) {
renderer.pos((x + 0.0F), (y + f3), (z + j1 + 1.0F - f13)).tex(((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
renderer.pos((x + b0), (y + f3), (z + j1 + 1.0F - f13)).tex(((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
renderer.pos((x + b0), (y + 0.0F), (z + j1 + 1.0F - f13)).tex(((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
renderer.pos((x + 0.0F), (y + 0.0F), (z + j1 + 1.0F - f13)).tex(((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)).color(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
}
}
tessellator.draw();
}
}
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableCull();
}
use of net.minecraft.client.Minecraft in project malmo by Microsoft.
the class HumanLevelCommandsImplementation method onExecute.
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit) {
if (verb.equalsIgnoreCase(HumanLevelCommand.MOVE_MOUSE.value())) {
if (parameter != null && parameter.length() != 0) {
String[] params = parameter.split(" ");
if (params.length != 2 && params.length != 3) {
System.out.println("Malformed parameter string (" + parameter + ") - expected <x> <y>, or <x> <y> <z>");
// Error - incorrect number of parameters.
return false;
}
Integer x, y, z;
try {
x = Integer.valueOf(params[0]);
y = Integer.valueOf(params[1]);
z = params.length == 3 ? Integer.valueOf(params[2]) : 0;
} catch (NumberFormatException e) {
System.out.println("Malformed parameter string (" + parameter + ") - " + e.getMessage());
return false;
}
if (x == null || y == null) {
System.out.println("Malformed parameter string (" + parameter + ")");
// Error - incorrect parameters.
return false;
}
if (x != 0 || y != 0) {
// Code based on EntityRenderer.updateCameraAndRender:
Minecraft mc = Minecraft.getMinecraft();
float f = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
float f1 = f * f * f * 8.0F;
float f2 = (float) x * f1;
float f3 = (float) y * f1;
if (mc.gameSettings.invertMouse)
f3 = -f3;
// Correct any errors from last mouse move:
if (this.isOverriding())
mc.player.turn(this.targetYawDelta, this.targetPitchDelta);
int renderTicksPerClientTick = this.clientTickMonitor.getEventsPerSecond() >= 1 ? (int) Math.ceil(this.renderTickMonitor.getEventsPerSecond() / this.clientTickMonitor.getEventsPerSecond()) : 0;
renderTicksPerClientTick = Math.max(1, renderTicksPerClientTick);
this.targetYawDelta = f2;
this.targetPitchDelta = f3;
this.targetYawDeltaDelta = f2 / (float) renderTicksPerClientTick;
this.targetPitchDeltaDelta = f3 / (float) renderTicksPerClientTick;
// System.out.println("Changing over " + renderTicksPerClientTick + " render ticks.");
}
if (z != 0) {
// Code based on Minecraft.runTickMouse
if (!Minecraft.getMinecraft().player.isSpectator() && this.isOverriding()) {
Minecraft.getMinecraft().player.inventory.changeCurrentItem(z);
}
}
return true;
}
}
return super.onExecute(verb, parameter, missionInit);
}
use of net.minecraft.client.Minecraft in project MorePlanets by SteveKunG.
the class ClientProxyMP method spawnParticle.
@Override
public void spawnParticle(EnumParticleTypesMP type, double x, double y, double z, double motionX, double motionY, double motionZ, Object[] data) {
Particle entityfx = null;
Minecraft mc = Minecraft.getMinecraft();
if (mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.world != null) {
int i = mc.gameSettings.particleSetting;
double d6 = mc.getRenderViewEntity().posX - x;
double d7 = mc.getRenderViewEntity().posY - y;
double d8 = mc.getRenderViewEntity().posZ - z;
double d9 = 16.0D;
if (i == 1 && mc.world.rand.nextInt(3) == 0) {
i = 2;
}
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9) {
return;
} else if (i > 1) {
return;
}
if (type == EnumParticleTypesMP.CRYSTALLIZE_FLAME) {
entityfx = new ParticleCrystallizeFlame(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.CHEESE_OF_MILK_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 1.0F, 0.85F, 0.5F, 0.4F, false);
} else if (type == EnumParticleTypesMP.INFECTED_SPORE) {
entityfx = new ParticleInfectedSpore(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.ALIEN_MINER_SPARK) {
entityfx = new ParticleAlienMinerSpark(mc.world, x, y, z, (float) data[0]);
} else if (type == EnumParticleTypesMP.INFECTED_GUARDIAN_APPEARANCE) {
entityfx = new ParticleInfectedGuardianAppearance(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.DARK_PORTAL) {
entityfx = new ParticleDarkPortal(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.ALIEN_BERRY_LEAVES) {
entityfx = new ParticleAlienBerry(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, (Item) data[0]);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING_META) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, (Item) data[0], (int) data[1]);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING_MOTION) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, motionX, motionY, motionZ, (Item) data[0]);
} else if (type == EnumParticleTypesMP.INFECTED_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.95F, 0.4F, 0.3F, 0.6F, false);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.6F, 0.2F, 0.8F, 0.6F, false);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_LAVA_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.6F, 0.2F, 0.8F, 1.0F, true);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_LAVA) {
entityfx = new ParticleLavaMC(mc.world, x, y, z, "crystallize_lava");
} else if (type == EnumParticleTypesMP.MC_SMOKE_LARGE) {
mc.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0.0D, 0.0D, 0.0D);
} else if (type == EnumParticleTypesMP.NUCLEAR_WASTE_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.4F, 0.8F, 0.1F, 1.0F, true);
} else if (type == EnumParticleTypesMP.PURIFY_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.45F, 0.8F, 1.0F, 0.6F, false);
} else if (type == EnumParticleTypesMP.KOENTUS_METEOR_SMOKE) {
entityfx = new ParticleKoentusMeteor(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.CUSTOM_FALLING_DUST) {
entityfx = new ParticleFallingDustMP(mc.world, x, y, z, (int) data[0]);
}
if (entityfx != null) {
mc.effectRenderer.addEffect(entityfx);
}
}
}
Aggregations