use of net.minecraft.client.Minecraft in project malmo by Microsoft.
the class VideoHook method forceResize.
/**
* Force Minecraft to resize its GUI
* @param width new width of window
* @param height new height of window
*/
private void forceResize(int width, int height) {
// Are we in the dev environment or deployed?
boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
// We need to know, because the method name will either be obfuscated or not.
String resizeMethodName = devEnv ? "resize" : "func_71370_a";
Class[] cArgs = new Class[2];
cArgs[0] = int.class;
cArgs[1] = int.class;
Method resize;
try {
resize = Minecraft.class.getDeclaredMethod(resizeMethodName, cArgs);
resize.setAccessible(true);
resize.invoke(Minecraft.getMinecraft(), width, height);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of net.minecraft.client.Minecraft in project malmo by Microsoft.
the class TextureHelper method hookIntoRenderPipeline.
public static void hookIntoRenderPipeline() {
// Subvert the render manager. This MUST be called at the right time (FMLInitializationEvent).
// 1: Replace the MC entity renderer with our own:
Minecraft.getMinecraft().entityRenderer = new MalmoEntityRenderer(Minecraft.getMinecraft(), Minecraft.getMinecraft().getResourceManager());
// 2: Create a new RenderManager:
RenderManager newRenderManager = new TextureHelper.MalmoRenderManager(Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem());
// 3: Use reflection to:
// a) replace Minecraft's RenderManager with our new RenderManager
// b) point Minecraft's RenderGlobal object to the new RenderManager
// Are we in the dev environment or deployed?
boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
// We need to know, because the names will either be obfuscated or not.
String mcRenderManagerName = devEnv ? "renderManager" : "field_175616_W";
String globalRenderManagerName = devEnv ? "renderManager" : "field_175010_j";
// NOTE: obfuscated name may need updating if Forge changes - search in
// ~\.gradle\caches\minecraft\de\oceanlabs\mcp\mcp_snapshot\20161220\1.11.2\srgs\mcp-srg.srg
Field renderMan;
Field globalRenderMan;
try {
renderMan = Minecraft.class.getDeclaredField(mcRenderManagerName);
renderMan.setAccessible(true);
renderMan.set(Minecraft.getMinecraft(), newRenderManager);
globalRenderMan = RenderGlobal.class.getDeclaredField(globalRenderManagerName);
globalRenderMan.setAccessible(true);
globalRenderMan.set(Minecraft.getMinecraft().renderGlobal, newRenderManager);
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
use of net.minecraft.client.Minecraft in project RFToolsDimensions by McJty.
the class SkyRenderer method registerSkybox.
public static void registerSkybox(GenericWorldProvider provider, final SkyType skyType) {
provider.setSkyRenderer(new IRenderHandler() {
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
SkyRenderer.renderSkyTexture(skyType.sky, skyType.sky2, skyType.skyboxType);
}
});
provider.setCloudRenderer(doNothingRenderHandler);
}
use of net.minecraft.client.Minecraft 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.Minecraft in project Almura by AlmuraDev.
the class RootContentLoader method insertResourcePack.
// TODO(kashike); find a better way to do this
@Listener
@SideOnly(Side.CLIENT)
public void insertResourcePack(final GamePreInitializationEvent event) {
final Minecraft client = Minecraft.getMinecraft();
for (final AbstractFileSystemSearchEntry qrp : this.entries(AbstractFileSystemSearchEntry.class)) {
client.defaultResourcePacks.add(new DirectoryResourcePack(qrp));
}
client.refreshResources();
}
Aggregations