use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.
the class ClientEffectProxy method spawnParticle.
@Override
protected void spawnParticle(Particle particle) {
Minecraft mc = FMLClientHandler.instance().getClient();
mc.effectRenderer.addEffect(particle);
}
use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.
the class FluidModelRenderer method renderFluid.
/**
* @param level Ranges from 1 to 16 inclusively, 0 will crash
*/
public void renderFluid(FluidStack fluidStack, int level) {
IBakedModel bakedModel = new FluidModel(fluidStack, false).bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, RenderTools::getTexture);
Minecraft mc = Minecraft.getMinecraft();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
Tessellator tess = Tessellator.getInstance();
VertexBuffer buffer = tess.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
IExtendedBlockState state = (IExtendedBlockState) new ExtendedBlockState(Blocks.WATER, new IProperty[] { BlockFluidBase.LEVEL }, BlockFluidBase.FLUID_RENDER_PROPS.toArray(new IUnlistedProperty<?>[0])).getBaseState();
for (int i = 0; i < 4; i++) state = state.withProperty(BlockFluidBase.LEVEL_CORNERS[i], level / 16F);
state = (IExtendedBlockState) state.withProperty(BlockFluidBase.LEVEL, level - 1);
state = state.withProperty(BlockFluidBase.FLOW_DIRECTION, -1000F);
putQuads(buffer, bakedModel.getQuads(state, null, 1234));
for (EnumFacing side : EnumFacing.VALUES) {
putQuads(buffer, bakedModel.getQuads(state, side, 1234));
}
tess.draw();
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.
the class JSONModelRenderer method renderModel.
public void renderModel(ResourceLocation model) {
IBakedModel bakedModel = bakedModels.get(model);
if (bakedModel == null)
return;
Minecraft mc = Minecraft.getMinecraft();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
Tessellator tess = Tessellator.getInstance();
VertexBuffer buffer = tess.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
putQuads(buffer, bakedModel.getQuads(null, null, 1234));
for (EnumFacing side : EnumFacing.VALUES) {
putQuads(buffer, bakedModel.getQuads(null, side, 1234));
}
tess.draw();
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
use of net.minecraft.client.Minecraft in project Pearcel-Mod by MiningMark48.
the class KeyHandler method onEvent.
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(TickEvent.PlayerTickEvent event) {
if (event.side == Side.SERVER) {
return;
}
if (event.phase == TickEvent.Phase.START) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = event.player;
World world = player.getEntityWorld();
int x = (int) event.player.posX;
int y = (int) event.player.posY;
int z = (int) event.player.posZ;
//PCP GUI
if (item_pcp.isPressed()) {
if (player.inventory.hasItemStack(new ItemStack(ModItems.pcp))) {
player.sendMessage(new TextComponentString("This is a WIP, Coming Soon™!"));
//player.openGui(PearcelMod.instance, GUIs.gui_id_pcp, world, x, y, z);
}
}
//PEPC GUI
if (item_pepc.isPressed()) {
if (player.inventory.hasItemStack(new ItemStack(ModItems.pepc))) {
player.sendMessage(new TextComponentString("This is a WIP, Coming Soon™!"));
//player.displayGUIChest(player.getInventoryEnderChest());
}
}
//Manual Gui
if (gui_manual.isPressed()) {
if (player.inventory.hasItemStack(new ItemStack(ModItems.pearcel_manual))) {
Minecraft.getMinecraft().displayGuiScreen(new GuiManual(0));
}
}
}
}
use of net.minecraft.client.Minecraft in project ArsMagica2 by Mithion.
the class AMGuiHelper method overrideMouseInput.
public static boolean overrideMouseInput(EntityRenderer renderer, float f, boolean b) {
Minecraft mc = Minecraft.getMinecraft();
if (!mc.inGameHasFocus || mc.thePlayer == null || mc.theWorld == null)
return true;
ExtendedProperties props = ExtendedProperties.For(mc.thePlayer);
if (!(mc.thePlayer.isPotionActive(BuffList.scrambleSynapses) ^ props.getIsFlipped())) {
return true;
}
mc.mouseHelper.mouseXYChange();
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
float f2 = f1 * f1 * f1 * 8.0F;
float f3 = (float) mc.mouseHelper.deltaX * f2;
float f4 = (float) mc.mouseHelper.deltaY * f2;
byte b0 = -1;
if (mc.gameSettings.invertMouse) {
b0 = 1;
}
if (mc.gameSettings.smoothCamera) {
String[] scy = { "field_78496_H", "smoothCamYaw" };
String[] scp = { "field_78521_m", "smoothCamPitch" };
String[] scpt = { "field_78533_p", "smoothCamPartialTicks" };
String[] scfx = { "field_78518_n", "smoothCamFilterX" };
String[] scfy = { "field_78499_K", "smoothCamFilterY" };
//renderer.smoothCamYaw += f3;
ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scy) - f3, scy);
//renderer.smoothCamPitch += f4;
ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scp) - f4, scp);
//float f5 = f - renderer.smoothCamPartialTicks;
float f5 = f - (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scpt);
//renderer.smoothCamPartialTicks = f;
ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, f, scpt);
//f3 = renderer.smoothCamFilterX * f5;
f3 = (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scfx) * f5;
//f4 = renderer.smoothCamFilterY * f5;
f4 = (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scfy) * f5;
mc.thePlayer.setAngles(-f3, f4 * (float) b0);
} else {
mc.thePlayer.setAngles(-f3, f4 * (float) b0);
}
return false;
}
Aggregations