use of net.minecraft.client.renderer.entity.RenderPlayer in project Wizardry by TeamWizardry.
the class ClientProxy method init.
@Override
public void init(FMLInitializationEvent event) {
super.init(event);
MinecraftForge.EVENT_BUS.register(CapeHandler.instance());
Minecraft.getMinecraft().getRenderManager().getSkinMap().values().forEach(render -> render.addLayer(new BloodRenderLayer(render)));
Map<String, RenderPlayer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap();
RenderPlayer render = skinMap.get("default");
render.addLayer(new RenderHaloPlayer(render.getMainModel().bipedHead));
render = skinMap.get("slim");
render.addLayer(new RenderHaloPlayer(render.getMainModel().bipedHead));
Map<Class<? extends Entity>, Render<? extends Entity>> map = Minecraft.getMinecraft().getRenderManager().entityRenderMap;
for (ResourceLocation entity : EntityList.getEntityNameList()) {
Class<? extends Entity> clazz = EntityList.getClass(entity);
Render<? extends Entity> entityRenderer = map.get(clazz);
if (entityRenderer instanceof RenderLiving<?>) {
ModelBase main = ((RenderLiving<?>) entityRenderer).getMainModel();
ModelRenderer renderer = null;
if (main instanceof ModelBiped)
renderer = ((ModelBiped) main).bipedHead;
((RenderLiving<?>) entityRenderer).addLayer(new RenderHaloEntity(renderer));
}
}
}
use of net.minecraft.client.renderer.entity.RenderPlayer in project Hyperium by HyperiumClient.
the class MemoryHelper method worldEvent.
@InvokeEvent
public void worldEvent(WorldUnloadEvent event) {
try {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Map<ResourceLocation, ITextureObject> mapTextureObjects = ((IMixinTextureManager) textureManager).getMapTextureObjects();
List<ResourceLocation> removes = new ArrayList<>();
mapTextureObjects.forEach((key, iTextureObject) -> {
if (iTextureObject instanceof ThreadDownloadImageData) {
IImageBuffer imageBuffer = ((IMixinThreadDownloadImageData) iTextureObject).getImageBuffer();
if (imageBuffer == null)
return;
Class<? extends IImageBuffer> aClass = imageBuffer.getClass();
// Optifine
if (aClass.getName().equalsIgnoreCase("CapeImageBuffer")) {
removes.add(key);
}
}
});
removes.forEach(this::deleteSkin);
// locations.forEach(this::deleteSkin);
int size = locations.size();
locations.clear();
int del = 0;
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
try {
Method getSkinMap = renderManager.getClass().getMethod("getSkinMap");
Object invoke = getSkinMap.invoke(renderManager);
Map<String, RenderPlayer> skinMap = (Map<String, RenderPlayer>) invoke;
for (RenderPlayer value : skinMap.values()) {
ModelPlayer mainModel = value.getMainModel();
Class<?> superClass = mainModel.getClass().getSuperclass();
for (Field field : superClass.getDeclaredFields()) {
field.setAccessible(true);
try {
Object o = field.get(mainModel);
if (o != null) {
try {
Field entityIn = o.getClass().getSuperclass().getDeclaredField("entityIn");
entityIn.setAccessible(true);
Object o1 = entityIn.get(o);
if (o1 != null) {
entityIn.set(o, null);
del++;
}
} catch (IllegalAccessException | NoSuchFieldException ignored) {
}
try {
Field clientPlayer = o.getClass().getSuperclass().getDeclaredField("clientPlayer");
clientPlayer.setAccessible(true);
Object o1 = clientPlayer.get(o);
if (o1 != null) {
clientPlayer.set(o, null);
del++;
}
} catch (IllegalAccessException | NoSuchFieldException ignored) {
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
Hyperium.LOGGER.info("Deleted " + (removes.size() + size + del) + " cosmetic items / skins");
} catch (Exception e) {
e.printStackTrace();
}
}
use of net.minecraft.client.renderer.entity.RenderPlayer in project EnderIO by SleepyTrousers.
the class UpgradeRenderManager method onPlayerRenderPre.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onPlayerRenderPre(RenderPlayerEvent.Pre event) {
final RenderPlayer renderer = event.getRenderer();
if (renderer != null && !injected.containsKey(renderer)) {
UpgradeRenderManager.replaceCapeLayer(renderer);
renderer.addLayer(new UpgradeRenderDispatcher(renderer));
injected.put(renderer, null);
}
}
use of net.minecraft.client.renderer.entity.RenderPlayer in project BloodMagic by WayofTime.
the class ClientProxy method addElytraLayer.
private void addElytraLayer() {
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
try {
Map<String, RenderPlayer> skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l");
skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default")));
skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim")));
BMLog.DEBUG.info("Elytra layer added");
} catch (Exception e) {
BMLog.DEBUG.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade: {}", e.getMessage());
}
}
use of net.minecraft.client.renderer.entity.RenderPlayer in project Galacticraft by micdoodle8.
the class ClientProxyCore method postInit.
@Override
public void postInit(FMLPostInitializationEvent event) {
ClientProxyCore.registerInventoryTabs();
ClientProxyCore.addVariants();
ItemSchematic.registerTextures();
MinecraftForge.EVENT_BUS.register(new TabRegistry());
if (!CompatibilityManager.RenderPlayerAPILoaded) {
try {
Field field = RenderManager.class.getDeclaredField(GCCoreUtil.isDeobfuscated() ? "playerRenderer" : "field_178637_m");
field.setAccessible(true);
field.set(FMLClientHandler.instance().getClient().getRenderManager(), new RenderPlayerGC());
field = RenderManager.class.getDeclaredField(GCCoreUtil.isDeobfuscated() ? "skinMap" : "field_178636_l");
field.setAccessible(true);
Map<String, RenderPlayer> skinMap = (Map<String, RenderPlayer>) field.get(FMLClientHandler.instance().getClient().getRenderManager());
skinMap.put("default", new RenderPlayerGC(skinMap.get("default"), false));
skinMap.put("slim", new RenderPlayerGC(skinMap.get("slim"), true));
} catch (Exception e) {
e.printStackTrace();
}
}
try {
Field ftc = Minecraft.getMinecraft().getClass().getDeclaredField(GCCoreUtil.isDeobfuscated() ? "mcMusicTicker" : "field_147126_aw");
ftc.setAccessible(true);
ftc.set(Minecraft.getMinecraft(), new MusicTickerGC(Minecraft.getMinecraft()));
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations