Compare commits

...
Author SHA1 Message Date
Jason Mitchell 52776530d8 Handle GL_COMPILE separately from GL_COMPILE_AND_EXECUTE
* Should fix OpenComputer issues
2023-12-26 17:19:35 -08:00
Jason Mitchell 9cebb352ad Opt in debug
* Less stutter with buggy stuff
2023-12-26 15:12:44 -08:00
embeddedt d810eaf876 Use client world for main thread renders 2023-12-26 12:45:45 -08:00
Jason Mitchell 1a1ca32721 Update 000-report-bug.yml 2023-12-26 09:10:00 -08:00
Jason Mitchell a3d689e806 Because of course someone uses DoubleBuffer 2023-12-26 08:45:26 -08:00
embeddedt d4e22b6c0c Avoid restoring GL buffers we didn't modify 2023-12-26 07:35:29 -08:00
Jason Mitchell 7e24f6a395 Reduce stuttering on Nvidia - Track the model view and projection matrix (#56)
* Track the model view and projection matrix
* Cache ViewportState as well
* Add mixin to speedup Jabba's saveBoundTexture
2023-12-25 20:16:43 -08:00
embeddedt c8e6a6f34f Make glPushAttrib match native behavior if bypassing state manager cache 2023-12-25 17:19:59 -08:00
Jason Mitchell f7a79cf02f Switch up how we're grabbing the projection & model view matrix to avoid needing to call glGetFloat() again 2023-12-25 16:14:35 -08:00
mist475 21b0de542c base mcpf merge (#45) 2023-12-25 11:44:38 -08:00
Jason Mitchell 7ae4e14a3e Add some more guards around GL capabilities 2023-12-25 11:35:24 -08:00
Jason Mitchell bfd6c25a03 Update README.MD 2023-12-25 09:20:35 -08:00
238 changed files with 21017 additions and 72 deletions

No files matched your search

+3 -3
View File
@@ -45,9 +45,9 @@ body:
- type: textarea
id: modlist
attributes:
label: Mod List
description: "List of mods, ideally a minimal reproducible set (can be retrieved from latest.log)"
placeholder: "List of mods go here"
label: Mod List or GTNH Pack Version
description: "List of mods, ideally a minimal reproducible set (can be retrieved from latest.log). If using GTNH please indicate pack version and any changed mods, not the entire modlist."
placeholder: "List of mods or GTNH Pack version goes here"
validations:
required: true
- type: checkboxes
+4
View File
@@ -14,6 +14,7 @@
# Permanent Incompatibilities
* Optifine [Disabled, won't fix]
* Fastcraft [Disable, won't fix]
* LWJGL3ify 1.5.4 and below - Use the latest version available, 1.5.7+
* ArchaicFix 0.6.2 and below - Use 0.7.0 or above
* Hodgepodge 2.4.2 and below - Use 2.4.3 or above
* CodeChickenCore/Lib <1.2.0 - Threading issues, use 1.2.0+
@@ -36,6 +37,9 @@
* Embeddedt for [Embeddium](https://github.com/embeddedt/embeddium/tree/dc59ca357c25beefd6288f0d1d40b4cd8e670ab8) under the [LGPL 3.0](https://github.com/embeddedt/embeddium/blob/16.x/forge/LICENSE)
* Neodymium
* Makamys for [Neodymium](https://github.com/makamys/Neodymium) - Various Tessellator -> Quad functionality taken under the LGPL 3
* MCPatcherForge
* Original [MCPatcher](https://bitbucket.org/prupe/mcpatcher/src/master/): Paul Rupe
* [Forge version](https://bitbucket.org/prupe/mcpatcher/src/master/): Mist475 under LGPL 3.0 with default ctm textures for glass and bookshelves by DarkBum under CC-BY-SA
* HUDCaching
* Created by [Moulberry](https://github.com/Moulberry/MCHUDCaching), backported from [Patcher](https://github.com/Sk1erLLC/Patcher) mod by Alexdoru under the CC-BY-SA-NC 4.0 license
* Angelica
+1 -1
View File
@@ -62,7 +62,7 @@ apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,nei_at.cfg
accessTransformersFile = angelica_at.cfg notfine_at.cfg archaicfix_at.cfg
accessTransformersFile = angelica_at.cfg notfine_at.cfg archaicfix_at.cfg mcpatcherforge_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = true
@@ -17,6 +17,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean enableIris;
@Config.Comment("Enable MCPatcherForge features, still in Alpha. Individual features are toggled in mcpatcher.json")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean enableMCPatcherForgeFeatures;
@Config.Comment("Enable NotFine optimizations")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@@ -68,4 +73,9 @@ public class AngelicaConfig {
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean optimizeTextureLoading;
@Config.Comment("Optimize slow glGetInteger in Jabba w/ Nvidia Drivers")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean optimizeJabbaGetInteger;
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.glsm;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.glsm.states.AlphaState;
import com.gtnewhorizons.angelica.glsm.states.BlendState;
@@ -8,7 +9,9 @@ import com.gtnewhorizons.angelica.glsm.states.Color4;
import com.gtnewhorizons.angelica.glsm.states.DepthState;
import com.gtnewhorizons.angelica.glsm.states.FogState;
import com.gtnewhorizons.angelica.glsm.states.GLColorMask;
import com.gtnewhorizons.angelica.glsm.states.MatrixState;
import com.gtnewhorizons.angelica.glsm.states.TextureState;
import com.gtnewhorizons.angelica.glsm.states.ViewportState;
import com.gtnewhorizons.angelica.hudcaching.HUDCaching;
import lombok.Getter;
import net.coderbot.iris.Iris;
@@ -24,7 +27,10 @@ import net.coderbot.iris.texture.TextureInfoCache;
import net.coderbot.iris.texture.TextureTracker;
import net.coderbot.iris.texture.pbr.PBRTextureManager;
import net.minecraft.client.renderer.OpenGlHelper;
import org.joml.Matrix4d;
import org.joml.Matrix4f;
import org.joml.Vector3d;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.Drawable;
@@ -33,6 +39,7 @@ import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.stream.IntStream;
@@ -55,6 +62,8 @@ public class GLStateManager {
@Getter private static final AlphaState alphaState = new AlphaState();
@Getter private static final BooleanState lightingState = new BooleanState(GL11.GL_LIGHTING);
@Getter private static final BooleanState rescaleNormalState = new BooleanState(GL12.GL_RESCALE_NORMAL);
@Getter private static final MatrixState matrixState = new MatrixState();
@Getter private static final ViewportState viewportState = new ViewportState();
private static long dirty = 0;
@@ -77,7 +86,7 @@ public class GLStateManager {
private static Thread CurrentThread = MainThread;
private static boolean runningSplash = false;
private static boolean inGLNewList = false;
private static int glListMode = 0;
private static boolean hudCaching$blendEnabled;
@@ -386,11 +395,17 @@ public class GLStateManager {
}
}
public static int getBoundTexture() {
return Textures[activeTexture].binding;
}
public static void glBindTexture(int target, int texture) {
if(inGLNewList) {
// Binding a texture, while building a list, is not allowed and is a silent noop
Throwable throwable = new Throwable();
LOGGER.info("Naughty naughty, someone's making a texture binding in a display list!", throwable);
if(glListMode == GL11.GL_COMPILE ) {
if(AngelicaMod.lwjglDebug) {
// Binding a texture, while building a list, is not allowed and is a silent noop
final Throwable throwable = new Throwable();
LOGGER.info("Naughty naughty, someone's making a texture binding in a display list!", throwable);
}
return;
}
@@ -654,25 +669,26 @@ public class GLStateManager {
}
public static void glNewList(int list, int mode) {
if(inGLNewList) {
if(glListMode > 0) {
throw new RuntimeException("glNewList called inside of a display list!");
}
inGLNewList = true;
glListMode = mode;
GL11.glNewList(list, mode);
}
public static void glEndList() {
if(!inGLNewList) {
if(glListMode == 0) {
throw new RuntimeException("glEndList called outside of a display list!");
}
inGLNewList = false;
glListMode = 0;
GL11.glEndList();
}
public static void glPushAttrib(int mask) {
// TODO: Proper state tracking; but at least for now the current cases of this didn't do anything related to textures and
// just overly broadly set ALL_BITS :facepalm:
GL11.glPushAttrib(mask & ~(GL11.GL_TEXTURE_BIT));
GL11.glPushAttrib(GLStateManager.BYPASS_CACHE ? mask : (mask & ~(GL11.GL_TEXTURE_BIT)));
}
public static void glPopAttrib() {
@@ -694,4 +710,94 @@ public class GLStateManager {
public static void dirty(long dirtyFlag) {
dirty |= dirtyFlag;
}
// Matrix Operations
public static void glMatrixMode(int mode) {
matrixState.setMode(mode);
GL11.glMatrixMode(mode);
}
public static void glLoadIdentity() {
GL11.glLoadIdentity();
matrixState.identity();
}
public static void glTranslatef(float x, float y, float z) {
GL11.glTranslatef(x, y, z);
matrixState.translate(x, y, z);
}
public static void glTranslated(double x, double y, double z) {
GL11.glTranslated(x, y, z);
matrixState.translate((float) x, (float) y, (float) z);
}
public static void glScalef(float x, float y, float z) {
GL11.glScalef(x, y, z);
matrixState.scale(x, y, z);
}
public static void glScaled(double x, double y, double z) {
GL11.glScaled(x, y, z);
matrixState.scale((float) x, (float) y, (float) z);
}
public static void glMultMatrix(FloatBuffer matrix) {
GL11.glMultMatrix(matrix);
matrixState.multiply(matrix);
}
public static final Matrix4d conersionMatrix4d = new Matrix4d();
public static final Matrix4f conersionMatrix4f = new Matrix4f();
public static void glMultMatrix(DoubleBuffer matrix) {
GL11.glMultMatrix(matrix);
conersionMatrix4d.set(matrix);
conersionMatrix4f.set(conersionMatrix4d);
matrixState.multiply(conersionMatrix4f);
}
public static void glRotatef(float angle, float x, float y, float z) {
GL11.glRotatef(angle, x, y, z);
matrixState.rotate((float)Math.toRadians(angle), x, y, z);
}
public static void glRotated(double angle, double x, double y, double z) {
GL11.glRotated(angle, x, y, z);
matrixState.rotate((float)Math.toRadians(angle), (float) x, (float) y, (float) z);
}
public static void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) {
GL11.glOrtho(left, right, bottom, top, zNear, zFar);
matrixState.ortho(left, right, bottom, top, zNear, zFar);
}
public static void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) {
GL11.glFrustum(left, right, bottom, top, zNear, zFar);
matrixState.frustum(left, right, bottom, top, zNear, zFar);
}
public static void glPushMatrix() {
GL11.glPushMatrix();
matrixState.push();
}
public static void glPopMatrix() {
GL11.glPopMatrix();
matrixState.pop();
}
private static final Matrix4f perspectiveMatrix = new Matrix4f();
private static final FloatBuffer perspectiveBuffer = BufferUtils.createFloatBuffer(16);
public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
perspectiveMatrix.identity().perspective((float)Math.toRadians(fovy), aspect, zNear, zFar);
perspectiveMatrix.get(0, perspectiveBuffer);
GL11.glMultMatrix(perspectiveBuffer);
matrixState.multiply(perspectiveMatrix);
}
public static void glViewport(int x, int y, int width, int height) {
GL11.glViewport(x, y, width, height);
viewportState.set(x, y, width, height);
}
}
@@ -0,0 +1,134 @@
package com.gtnewhorizons.angelica.glsm.states;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;
import org.lwjgl.opengl.GL11;
import java.nio.FloatBuffer;
public class MatrixState {
public MatrixMode mode = MatrixMode.NONE;
public final Matrix4fStack projectionMatrix;
public final Matrix4fStack modelViewMatrix;
public MatrixState() {
projectionMatrix = new Matrix4fStack(GL11.glGetInteger(GL11.GL_MAX_PROJECTION_STACK_DEPTH));
modelViewMatrix = new Matrix4fStack(GL11.glGetInteger(GL11.GL_MAX_MODELVIEW_STACK_DEPTH));
}
public void identity() {
switch (mode) {
case MODELVIEW -> modelViewMatrix.identity();
case PROJECTION -> projectionMatrix.identity();
default -> {
}
}
}
public void setMode(int mode) {
switch (mode) {
case GL11.GL_MODELVIEW -> this.mode = MatrixMode.MODELVIEW;
case GL11.GL_PROJECTION -> this.mode = MatrixMode.PROJECTION;
default -> this.mode = MatrixMode.NONE;
}
}
public void translate(float x, float y, float z) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.translate(x, y, z);
case PROJECTION -> projectionMatrix.translate(x, y, z);
default -> {
}
}
}
public void scale(float x, float y, float z) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.scale(x, y, z);
case PROJECTION -> projectionMatrix.scale(x, y, z);
default -> {
}
}
}
private final Matrix4f tempMatrix = new Matrix4f();
public void multiply(FloatBuffer matrix) {
tempMatrix.set(matrix);
switch (mode) {
case MODELVIEW -> modelViewMatrix.mul(tempMatrix);
case PROJECTION -> projectionMatrix.mul(tempMatrix);
default -> {
}
}
}
public void multiply(Matrix4f matrix) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.mul(matrix);
case PROJECTION -> projectionMatrix.mul(matrix);
default -> {
}
}
}
public void rotate(float angle, float x, float y, float z) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.rotate(angle, x, y, z);
case PROJECTION -> projectionMatrix.rotate(angle, x, y, z);
default -> {
}
}
}
public void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.ortho((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
case PROJECTION -> projectionMatrix.ortho((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
default -> {
}
}
}
public void frustum(double left, double right, double bottom, double top, double zNear, double zFar) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.frustum((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
case PROJECTION -> projectionMatrix.frustum((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
default -> {
}
}
}
public void push() {
switch (mode) {
case MODELVIEW -> modelViewMatrix.pushMatrix();
case PROJECTION -> projectionMatrix.pushMatrix();
default -> {
}
}
}
public void pop() {
switch (mode) {
case MODELVIEW -> modelViewMatrix.popMatrix();
case PROJECTION -> projectionMatrix.popMatrix();
default -> {
}
}
}
public void perspective(float fovy, float aspect, float zNear, float zFar) {
switch (mode) {
case MODELVIEW -> modelViewMatrix.perspective(fovy, aspect, zNear, zFar);
case PROJECTION -> projectionMatrix.perspective(fovy, aspect, zNear, zFar);
default -> {
}
}
}
enum MatrixMode {
NONE,
MODELVIEW,
PROJECTION
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.glsm.states;
import java.nio.IntBuffer;
public class ViewportState {
public int x;
public int y;
public int width;
public int height;
public void set(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void get(IntBuffer params) {
params.put(0, x);
params.put(1, y);
params.put(2, width);
params.put(3, height);
}
}
@@ -9,6 +9,8 @@ import com.gtnewhorizons.angelica.mixins.Mixins;
import com.gtnewhorizons.angelica.mixins.TargetedMod;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import mist475.mcpatcherforge.asm.AsmTransformers;
import mist475.mcpatcherforge.asm.mappings.Namer;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -32,6 +34,8 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
public static final Logger LOGGER = LogManager.getLogger("Angelica");
private String[] transformerClasses;
static {
try {
// Angelica Config
@@ -55,7 +59,12 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
}
// Return any others here
return null;
if (transformerClasses == null) {
Namer.initNames();
transformerClasses = AsmTransformers.getTransformers();
}
return transformerClasses;
}
@Override
@@ -3,7 +3,8 @@ package com.gtnewhorizons.angelica.mixins;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import com.mitchej123.hodgepodge.Common;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import java.util.ArrayList;
@@ -12,6 +13,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public enum Mixins {
ANGELICA_STARTUP(new Builder("Angelica Startup").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
@@ -23,8 +25,9 @@ public enum Mixins {
ANGELICA(new Builder("Angelica").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).addMixinClasses(
"angelica.MixinEntityRenderer"
"angelica.MixinActiveRenderInfo"
,"angelica.MixinClippingHelperImpl"
,"angelica.MixinEntityRenderer"
)
),
@@ -133,6 +136,11 @@ public enum Mixins {
)
),
OPTIMIZE_JABBA_GET_INTEGER(new Builder("Optimize Jabba getInteger").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.JABBA).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.optimizeJabbaGetInteger)
.addMixinClasses("client.jabba.MixinTileEntityBaseRenderer")),
ANGELICA_TEXTURE(new Builder("Textures").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris || AngelicaConfig.enableSodium).addMixinClasses(
@@ -184,14 +192,22 @@ public enum Mixins {
NOTFINE_FEATURES(new Builder("NotFine Features").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.glint.MixinItemRenderer"
,"notfine.glint.MixinRenderBiped"
"notfine.glint.MixinRenderBiped"
,"notfine.glint.MixinRenderItem"
,"notfine.glint.MixinRenderPlayer"
,"notfine.gui.MixinGuiSlot"
,"notfine.renderer.MixinRenderGlobal"
,"notfine.settings.MixinGameSettings"
)),
NOTFINE_FEATURES_NO_MCPF_CIT(new Builder("NotFine Features which clash with mcpf cit (compat handled in MCPF_NF mixin)").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
!(AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
).addMixinClasses(
"notfine.glint.MixinItemRenderer",
"notfine.glint.MixinRenderItemGlint"
)),
NOTFINE_LATE_TWILIGHT_FORESTLEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.TWILIGHT_FOREST).setSide(Side.CLIENT)
.setPhase(Phase.LATE).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.leaves.twilightforest.MixinBlockTFLeaves"
@@ -206,7 +222,172 @@ public enum Mixins {
NOTFINE_LATE_WITCHERY_LEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.WITCHERY).setSide(Side.CLIENT)
.setPhase(Phase.LATE).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.leaves.witchery.MixinBlockWitchLeaves"
))
)),
MCPATCHERFORGE_NOTFINE_COMPAT(new Builder("Notfine features and MCPF features where the 2 would clash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
AngelicaConfig.enableMCPatcherForgeFeatures &&
Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
.addMixinClasses(addPrefix(
"notfine_mcpf_compat.",
"MixinRenderItem",
"MixinItemRenderer"))),
MCPATCHERFORGE_BASE_MOD(new Builder("Base MCPatcher mixins").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix(
"mcpatcherforge.",
"base.MixinBlockGrass",
"base.MixinBlockMycelium",
"base.MixinAbstractTexture",
"base.MixinTextureAtlasSprite",
"base.MixinSimpleReloadableResourceManager",
"base.MixinMinecraft"
// TODO merge renderpass changes into Sodium renderer
// "renderpass.MixinEntityRenderer",
// "renderpass.MixinRenderBlocks",
// "renderpass.MixinRenderGlobal",
// "renderpass.MixinWorldRenderer"
)
)),
MCPATCHERFORGE_CUSTOM_COLOURS(new Builder("Custom colors").setSide(Mixins.Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.cc.",
"block.material.MixinMapColor",
"block.MixinBlock",
"block.MixinBlockDoublePlant",
"block.MixinBlockGrass",
"block.MixinBlockLeaves",
"block.MixinBlockLilyPad",
"block.MixinBlockLiquid",
"block.MixinBlockOldLeaf",
"block.MixinBlockRedstoneWire",
"block.MixinBlockReed",
"block.MixinBlockStem",
"block.MixinBlockTallGrass",
"block.MixinBlockVine",
"client.particle.MixinEntityAuraFX",
"client.particle.MixinEntityBubbleFX",
"client.particle.MixinEntityDropParticleFX",
"client.particle.MixinEntityPortalFX",
"client.particle.MixinEntityRainFX",
"client.particle.MixinEntityRedDustFX",
"client.particle.MixinEntitySplashFX",
"client.particle.MixinEntitySuspendFX",
"client.renderer.entity.MixinRenderWolf",
"client.renderer.entity.MixinRenderXPOrb",
"client.renderer.tileentity.MixinTileEntitySignRenderer",
"client.renderer.MixinEntityRenderer",
"client.renderer.MixinItemRenderer",
"client.renderer.MixinRenderBlocks",
"client.renderer.MixinRenderGlobal",
"entity.MixinEntityList",
"item.crafting.MixinRecipesArmorDyes",
"item.MixinItemArmor",
"item.MixinItemBlock",
"item.MixinItemMonsterPlacer",
"potion.MixinPotion",
"potion.MixinPotionHelper",
"world.MixinWorld",
"world.MixinWorldProvider",
"world.MixinWorldProviderEnd",
"world.MixinWorldProviderHell"))),
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES(new Mixins.Builder("Custom Item Textures").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.cit.",
"client.renderer.entity.MixinRenderBiped",
"client.renderer.entity.MixinRenderEntityLiving",
"client.renderer.entity.MixinRenderItem",
"client.renderer.entity.MixinRenderPlayer",
"client.renderer.entity.MixinRenderSnowball",
"client.renderer.MixinItemRenderer",
"item.MixinItem",
"nbt.MixinNBTTagCompound",
"nbt.MixinNBTTagList"))),
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES_NO_NF(new Mixins.Builder("Custom Item Textures without notfine features").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)) && !AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix(
"mcpatcherforge.cit.client.renderer.",
"entity.MixinRenderItemRenderDroppedItem",
"MixinItemRenderer_NO_NF"
))),
MCPATCHERFORGE_CONNECTED_TEXTURES(new Builder("Connected Textures").setSide(Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")),
MCPATCHERFORGE_EXTENDED_HD(new Builder("Extended hd").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix("mcpatcherforge.hd.", "MixinFontRenderer", "MixinTextureClock", "MixinTextureCompass", "MixinTextureManager"))),
MCPATCHERFORGE_RANDOM_MOBS(new Builder("Random Mobs").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.mob.",
"MixinRender",
"MixinRenderEnderman",
"MixinRenderFish",
"MixinRenderLiving",
"MixinRenderMooshroom",
"MixinRenderSheep",
"MixinRenderSnowMan",
"MixinRenderSpider",
"MixinRenderWolf",
"MixinEntityLivingBase"))),
MCPATCHERFORGE_SKY(new Builder("Sky").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.BETTER_SKIES, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.sky.", "MixinEffectRenderer", "MixinRenderGlobal"
))),
MCPATCHERFORGE_CTM_OR_CC(new Builder("Connected textures or Custom Colors enabled").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)
|| Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.ctm_cc.", "MixinRenderBlocks", "MixinTextureMap")))
;
private final List<String> mixinClasses;
@@ -348,6 +529,14 @@ public enum Mixins {
}
}
@SuppressWarnings("SimplifyStreamApiCallChains")
private static String[] addPrefix(String prefix, String... values) {
return Arrays.stream(values)
.map(s -> prefix + s)
.collect(Collectors.toList())
.toArray(new String[values.length]);
}
private enum Side {
BOTH,
CLIENT,
@@ -0,0 +1,45 @@
package com.gtnewhorizons.angelica.mixins.early.angelica;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.states.ViewportState;
import com.gtnewhorizons.angelica.rendering.RenderingState;
import net.minecraft.client.renderer.ActiveRenderInfo;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.nio.FloatBuffer;
@Mixin(ActiveRenderInfo.class)
public class MixinActiveRenderInfo {
@Shadow private static FloatBuffer modelview;
@Shadow private static FloatBuffer projection;
@Inject(method = "updateRenderInfo", at = @At(value = "TAIL"))
private static void angelica$onUpdateRenderInfo(CallbackInfo ci) {
RenderingState.INSTANCE.setProjectionMatrix(projection);
RenderingState.INSTANCE.setModelViewMatrix(modelview);
}
@Redirect(method = "updateRenderInfo", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glGetFloat(ILjava/nio/FloatBuffer;)V"), remap = false)
private static void angelica$glGetFloat(int pname, FloatBuffer params) {
if(pname == GL11.GL_MODELVIEW_MATRIX) {
GLStateManager.getMatrixState().modelViewMatrix.get(0, params);
} else if(pname == GL11.GL_PROJECTION_MATRIX) {
GLStateManager.getMatrixState().projectionMatrix.get(0, params);
} else {
GL11.glGetFloat(pname, params);
}
}
@Redirect(method = "updateRenderInfo", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glGetInteger(ILjava/nio/IntBuffer;)V"), remap = false)
private static void angelica$glGetInteger(int pname, java.nio.IntBuffer params) {
if(pname == GL11.GL_VIEWPORT) {
GLStateManager.getViewportState().get(params);
} else {
GL11.glGetInteger(pname, params);
}
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.angelica;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.nio.FloatBuffer;
@Mixin(ClippingHelperImpl.class)
public class MixinClippingHelperImpl {
@Redirect(method="init", at=@At(value="INVOKE", target="Lorg/lwjgl/opengl/GL11;glGetFloat(ILjava/nio/FloatBuffer;)V"), remap = false)
private void angelica$glGetFloat(int pname, FloatBuffer params) {
if(pname == GL11.GL_MODELVIEW_MATRIX) {
GLStateManager.getMatrixState().modelViewMatrix.get(0, params);
} else if(pname == GL11.GL_PROJECTION_MATRIX) {
GLStateManager.getMatrixState().projectionMatrix.get(0, params);
} else {
GL11.glGetFloat(pname, params);
}
}
}
@@ -21,8 +21,5 @@ public abstract class MixinEntityRenderer {
viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks,
viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks
);
RenderingState.INSTANCE.captureProjectionMatrix();
RenderingState.INSTANCE.captureModelViewMatrix();
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import net.minecraft.client.renderer.texture.AbstractTexture;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.AbstractTextureExpansion;
@Mixin(AbstractTexture.class)
public abstract class MixinAbstractTexture implements AbstractTextureExpansion {
@Shadow
public int glTextureId;
public void unloadGLTexture() {
if (this.glTextureId >= 0) {
GL11.glDeleteTextures(this.glTextureId);
this.glTextureId = -1;
}
}
}
@@ -0,0 +1,33 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.mal.block.RenderBlocksUtils;
@Mixin(BlockGrass.class)
public class MixinBlockGrass {
@Shadow
private IIcon field_149991_b;
@Inject(
method = "getIcon(Lnet/minecraft/world/IBlockAccess;IIII)Lnet/minecraft/util/IIcon;",
at = @At("HEAD"),
cancellable = true)
private void modifyGetIcon(IBlockAccess worldIn, int x, int y, int z, int side, CallbackInfoReturnable<IIcon> cir) {
final IIcon grassTexture = RenderBlocksUtils
.getGrassTexture((Block) (Object) this, worldIn, x, y, z, side, this.field_149991_b);
if (grassTexture != null) {
cir.setReturnValue(grassTexture);
}
}
}
@@ -0,0 +1,33 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import net.minecraft.block.Block;
import net.minecraft.block.BlockMycelium;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.mal.block.RenderBlocksUtils;
@Mixin(BlockMycelium.class)
public abstract class MixinBlockMycelium {
@Shadow
private IIcon field_150200_a;
@Inject(
method = "getIcon(Lnet/minecraft/world/IBlockAccess;IIII)Lnet/minecraft/util/IIcon;",
at = @At("HEAD"),
cancellable = true)
private void modifyGetIcon(IBlockAccess worldIn, int x, int y, int z, int side, CallbackInfoReturnable<IIcon> cir) {
final IIcon grassTexture = RenderBlocksUtils
.getGrassTexture((Block) (Object) this, worldIn, x, y, z, side, this.field_150200_a);
if (grassTexture != null) {
cir.setReturnValue(grassTexture);
}
}
}
@@ -0,0 +1,119 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import java.io.File;
import java.io.IOException;
import java.net.Proxy;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Session;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.google.common.collect.Multimap;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.cc.Colorizer;
import com.prupe.mcpatcher.cit.CITUtils;
import com.prupe.mcpatcher.ctm.CTMUtils;
import com.prupe.mcpatcher.hd.FontUtils;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import com.prupe.mcpatcher.mal.tile.TileLoader;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
@Shadow
public abstract IResourceManager getResourceManager();
@Shadow
@Final
private static ResourceLocation locationMojangPng;
@Inject(
method = "<init>(Lnet/minecraft/util/Session;IIZZLjava/io/File;Ljava/io/File;Ljava/io/File;Ljava/net/Proxy;Ljava/lang/String;Lcom/google/common/collect/Multimap;Ljava/lang/String;)V",
at = @At("RETURN"))
private void modifyConstructor(Session sessionIn, int displayWidth, int displayHeight, boolean fullscreen,
boolean isDemo, File dataDir, File assetsDir, File resourcePackDir, Proxy proxy, String version,
Multimap<String, String> twitchDetails, String assetsJsonVersion, CallbackInfo ci) {
MCPatcherUtils.setMinecraft(dataDir);
}
@Inject(
method = "startGame()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/resources/IReloadableResourceManager;registerReloadListener(Lnet/minecraft/client/resources/IResourceManagerReloadListener;)V",
ordinal = 0))
private void modifyStartGame1(CallbackInfo ci) {
TileLoader.init();
CTMUtils.reset();
if (Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)) {
CITUtils.init();
}
if (Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "enabled", true)) {
FontUtils.init();
}
if (Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "enabled", true)) {
MobRandomizer.init();
}
if (Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true)) {
Colorizer.init();
}
}
@Inject(
method = "startGame()V",
at = @At(
value = "INVOKE",
target = "Lcpw/mods/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V",
remap = false,
shift = At.Shift.AFTER))
private void modifyStartGame2(CallbackInfo ci) {
TexturePackChangeHandler.beforeChange1();
}
@Inject(
method = "startGame()V",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glViewport(IIII)V",
remap = false,
shift = At.Shift.AFTER))
private void modifyStartGame3(CallbackInfo ci) {
TexturePackChangeHandler.afterChange1();
}
@Redirect(
method = "loadScreen()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureManager;getDynamicTextureLocation(Ljava/lang/String;Lnet/minecraft/client/renderer/texture/DynamicTexture;)Lnet/minecraft/util/ResourceLocation;"))
private ResourceLocation modifyLoadScreen(TextureManager renderEngine, String p_110578_1_,
DynamicTexture p_110578_2_) throws IOException {
return renderEngine.getDynamicTextureLocation(
"logo",
new DynamicTexture(
ImageIO.read(
this.getResourceManager()
.getResource(locationMojangPng)
.getInputStream())));
}
@Inject(method = "runGameLoop()V", at = @At(value = "HEAD"))
private void modifyRunGameLoop(CallbackInfo ci) {
TexturePackChangeHandler.checkForTexturePackChange();
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
@Mixin(SimpleReloadableResourceManager.class)
public abstract class MixinSimpleReloadableResourceManager {
@Inject(method = "notifyReloadListeners()V", at = @At("HEAD"))
private void modifyNotifyReloadListeners1(CallbackInfo ci) {
TexturePackChangeHandler.beforeChange1();
}
@Inject(method = "notifyReloadListeners()V", at = @At("RETURN"))
private void modifyNotifyReloadListeners2(CallbackInfo ci) {
TexturePackChangeHandler.afterChange1();
}
}
@@ -0,0 +1,29 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.base;
import java.util.List;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(TextureAtlasSprite.class)
public abstract class MixinTextureAtlasSprite {
// In 1.6 this is a List<int[]>
@Shadow
public List<int[][]> framesTextureData;
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason null check?
*/
@Overwrite
public int getFrameCount() {
if (this.framesTextureData != null) {
return this.framesTextureData.size();
}
return 1;
}
}
@@ -0,0 +1,36 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(Block.class)
public abstract class MixinBlock {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
public void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
public void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
public void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockDoublePlant.class)
public abstract class MixinBlockDoublePlant {
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockGrass.class)
public abstract class MixinBlockGrass {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockLeaves.class)
public abstract class MixinBlockLeaves {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLilyPad;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockLilyPad.class)
public abstract class MixinBlockLilyPad {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockLiquid.class)
public abstract class MixinBlockLiquid {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockOldLeaf;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockOldLeaf.class)
public abstract class MixinBlockOldLeaf {
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,53 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneWire;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(BlockRedstoneWire.class)
public abstract class MixinBlockRedstoneWire {
// Not much more compatible but it's the thought that counts
@ModifyReturnValue(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("RETURN"))
public int modifyColorMultiplier(int defaultColor, IBlockAccess worldIn, int x, int y, int z) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
return ColorizeBlock.blockColor;
}
return ColorizeBlock.colorizeRedstoneWire(worldIn, x, y, z, defaultColor);
}
@ModifyArgs(
method = "randomDisplayTick(Lnet/minecraft/world/World;IIILjava/util/Random;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Ljava/lang/String;DDDDDD)V"))
private void modifyRandomDisplayTick(Args args, World worldIn, int x, int y, int z, Random random) {
if (ColorizeBlock.computeRedstoneWireColor(worldIn.getBlockMetadata(x, y, z))) {
float f1 = Colorizer.setColor[0];
float f2 = Colorizer.setColor[1];
float f3 = Colorizer.setColor[2];
if (f2 < 0.0f) {
f2 = 0.0f;
}
if (f3 < 0.0f) {
f3 = 0.0f;
}
args.set(4, (double) f1);
args.set(5, (double) f2);
args.set(6, (double) f3);
}
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockReed;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockReed.class)
public abstract class MixinBlockReed {
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStem;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockStem.class)
public abstract class MixinBlockStem {
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockTallGrass.class)
public abstract class MixinBlockTallGrass {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockVine;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(BlockVine.class)
public abstract class MixinBlockVine {
@Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true)
private void modifyGetBlockColor(CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "getRenderColor(I)I", at = @At("HEAD"), cancellable = true)
private void modifyGetRenderColor(int meta, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, meta)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
@Inject(method = "colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I", at = @At("HEAD"), cancellable = true)
private void modifyColorMultiplier(IBlockAccess worldIn, int x, int y, int z, CallbackInfoReturnable<Integer> cir) {
if (ColorizeBlock.colorizeBlock((Block) (Object) this, worldIn, x, y, z)) {
cir.setReturnValue(ColorizeBlock.blockColor);
}
}
}
@@ -0,0 +1,31 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.block.material;
import net.minecraft.block.material.MapColor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.mixins.interfaces.MapColorExpansion;
@Mixin(MapColor.class)
public abstract class MixinMapColor implements MapColorExpansion {
@Unique
private int mcpatcher_forge$origColorValue;
@Inject(method = "<init>(II)V", at = @At("RETURN"))
private void modifyConstructor(int colorIndex, int colorValue, CallbackInfo ci) {
this.setOriginalColorValue(colorValue);
}
public int getOriginalColorValue() {
return mcpatcher_forge$origColorValue;
}
public void setOriginalColorValue(int value) {
mcpatcher_forge$origColorValue = value;
}
}
@@ -0,0 +1,31 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityAuraFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import com.prupe.mcpatcher.cc.ColorizeEntity;
import com.prupe.mcpatcher.cc.Colorizer;
import com.gtnewhorizons.angelica.mixins.interfaces.EntityAuraFXExpansion;
@Mixin(EntityAuraFX.class)
public abstract class MixinEntityAuraFX extends EntityFX implements EntityAuraFXExpansion {
protected MixinEntityAuraFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@SuppressWarnings("DataFlowIssue")
@Override
public EntityAuraFX colorize() {
if (ColorizeEntity.computeMyceliumParticleColor()) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
}
return (EntityAuraFX) (Object) this;
}
}
@@ -0,0 +1,35 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityBubbleFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntityBubbleFX.class)
public abstract class MixinEntityBubbleFX extends EntityFX {
protected MixinEntityBubbleFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDDDDD)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, double motionX, double motionY,
double motionZ, CallbackInfo ci) {
if (ColorizeBlock.computeWaterColor(false, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 1.0f;
this.particleGreen = 1.0f;
this.particleBlue = 1.0f;
}
}
}
@@ -0,0 +1,135 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityDropParticleFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.ColorizeEntity;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntityDropParticleFX.class)
public abstract class MixinEntityDropParticleFX extends EntityFX {
@Shadow
private Material materialType;
@Shadow
private int bobTimer;
protected MixinEntityDropParticleFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(
method = "<init>(Lnet/minecraft/world/World;DDDLnet/minecraft/block/material/Material;)V",
at = @At("RETURN"))
private void modifyConstructor(World worldIn, double x, double y, double z, Material material, CallbackInfo ci) {
if (material == Material.water) {
if (ColorizeBlock.computeWaterColor(true, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 0.2f;
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
} else {
this.particleRed = 1.0F;
this.particleGreen = 0.0F;
this.particleBlue = 0.0F;
}
}
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason Inject would be too inefficient
*/
@SuppressWarnings("DuplicatedCode")
@Overwrite
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.materialType != Material.water) {
// Patch start
if (ColorizeEntity.computeLavaDropColor(40 - this.bobTimer)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 1.0f;
this.particleGreen = 16.0f / (40 - this.bobTimer + 16);
this.particleBlue = 4.0f / (40 - this.bobTimer + 8);
}
// Patch end
} else {
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float) (40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float) (40 - this.bobTimer + 8);
}
this.motionY -= this.particleGravity;
if (this.bobTimer-- > 0) {
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
this.setParticleTextureIndex(113);
} else {
this.setParticleTextureIndex(112);
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0) {
this.setDead();
}
if (this.onGround) {
if (this.materialType == Material.water) {
this.setDead();
this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
} else {
this.setParticleTextureIndex(114);
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
Material material = this.worldObj
.getBlock(
MathHelper.floor_double(this.posX),
MathHelper.floor_double(this.posY),
MathHelper.floor_double(this.posZ))
.getMaterial();
if (material.isLiquid() || material.isSolid()) {
double d0 = (float) (MathHelper.floor_double(this.posY) + 1) - BlockLiquid.getLiquidHeightPercent(
this.worldObj.getBlockMetadata(
MathHelper.floor_double(this.posX),
MathHelper.floor_double(this.posY),
MathHelper.floor_double(this.posZ)));
if (this.posY < d0) {
this.setDead();
}
}
}
}
@@ -0,0 +1,35 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityPortalFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeEntity;
@Mixin(EntityPortalFX.class)
public abstract class MixinEntityPortalFX extends EntityFX {
@Shadow
private float portalParticleScale;
protected MixinEntityPortalFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDDDDD)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, double motionX, double motionY,
double motionZ, CallbackInfo ci) {
// green & red get multiplied in constructor, blue doesn't
this.particleGreen = this.portalParticleScale / 0.3f;
this.particleGreen *= ColorizeEntity.portalColor[1];
this.particleRed = this.portalParticleScale / 0.9f;
this.particleRed *= ColorizeEntity.portalColor[0];
this.particleBlue = ColorizeEntity.portalColor[2];
}
}
@@ -0,0 +1,34 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityRainFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntityRainFX.class)
public abstract class MixinEntityRainFX extends EntityFX {
protected MixinEntityRainFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDD)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, CallbackInfo ci) {
if (ColorizeBlock.computeWaterColor(false, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 0.2f;
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
}
}
@@ -0,0 +1,51 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntityReddustFX.class)
public abstract class MixinEntityRedDustFX extends EntityFX {
@Shadow
float reddustParticleScale;
protected MixinEntityRedDustFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDDFFFF)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, float p_i1224_8_, float red, float green,
float blue, CallbackInfo ci) {
// == 1.0f is needed as this runs after the rest of the constructor
if (red == 0.0F || red == 1.0f) {
red = 1.0F;
// Injected block
if (ColorizeBlock.computeRedstoneWireColor(15)) {
red = Colorizer.setColor[0];
green = Colorizer.setColor[1];
blue = Colorizer.setColor[2];
}
}
float f4 = (float) Math.random() * 0.4F + 0.6F;
this.particleRed = ((float) (Math.random() * 0.20000000298023224D) + 0.8F) * red * f4;
this.particleGreen = ((float) (Math.random() * 0.20000000298023224D) + 0.8F) * green * f4;
this.particleBlue = ((float) (Math.random() * 0.20000000298023224D) + 0.8F) * blue * f4;
this.particleScale *= 0.75F;
this.particleScale *= p_i1224_8_;
this.reddustParticleScale = this.particleScale;
this.particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int) ((float) this.particleMaxAge * p_i1224_8_);
this.noClip = false;
}
}
@@ -0,0 +1,31 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntitySplashFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntitySplashFX.class)
public abstract class MixinEntitySplashFX extends EntityFX {
protected MixinEntitySplashFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDDDDD)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, double motionX, double motionY,
double motionZ, CallbackInfo ci) {
if (ColorizeBlock.computeWaterColor(false, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
}
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntitySuspendFX;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeEntity;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(EntitySuspendFX.class)
public abstract class MixinEntitySuspendFX extends EntityFX {
protected MixinEntitySuspendFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Inject(method = "<init>(Lnet/minecraft/world/World;DDDDDD)V", at = @At("RETURN"))
private void modifyConstructor(World world, double x, double y, double z, double motionX, double motionY,
double motionZ, CallbackInfo ci) {
ColorizeEntity.computeSuspendColor(6710962, (int) x, (int) y, (int) z);
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
}
}
@@ -0,0 +1,85 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.enchantment.EnchantmentHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.cc.Colorizer;
import com.prupe.mcpatcher.cc.Lightmap;
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer {
@Shadow
private Minecraft mc;
@Shadow
float fogColorRed;
@Shadow
float fogColorGreen;
@Shadow
float fogColorBlue;
@Shadow
@Final
private DynamicTexture lightmapTexture;
@Shadow
@Final
private int[] lightmapColors;
@Shadow
private boolean lightmapUpdateNeeded;
@Inject(method = "updateLightmap(F)V", at = @At("HEAD"), cancellable = true)
private void modifyUpdateLightMap(float partialTick, CallbackInfo ci) {
if (Lightmap
.computeLightmap((EntityRenderer) (Object) this, this.mc.theWorld, this.lightmapColors, partialTick)) {
this.lightmapTexture.updateDynamicTexture();
this.lightmapUpdateNeeded = false;
ci.cancel();
}
}
@Inject(
method = "updateFogColor(F)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/renderer/EntityRenderer;fogColorBlue:F",
ordinal = 11,
shift = At.Shift.AFTER))
private void modifyUpdateFogColor1(float p_78466_1_, CallbackInfo ci) {
float n11 = (float) EnchantmentHelper.getRespiration(this.mc.renderViewEntity) * 0.2F;
if (ColorizeWorld.computeUnderwaterColor()) {
this.fogColorRed = Colorizer.setColor[0] + n11;
this.fogColorGreen = Colorizer.setColor[1] + n11;
this.fogColorBlue = Colorizer.setColor[2] + n11;
}
}
@Inject(
method = "updateFogColor(F)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/renderer/EntityRenderer;fogColorBlue:F",
ordinal = 12,
shift = At.Shift.AFTER))
private void modifyUpdateFogColor2(float p_78466_1_, CallbackInfo ci) {
if (ColorizeWorld.computeUnderlavaColor()) {
this.fogColorRed = Colorizer.setColor[0];
this.fogColorGreen = Colorizer.setColor[1];
this.fogColorBlue = Colorizer.setColor[2];
}
}
}
@@ -0,0 +1,29 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(ItemRenderer.class)
public abstract class MixinItemRenderer {
@Inject(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemIn2D(Lnet/minecraft/client/renderer/Tessellator;FFFFIIF)V",
ordinal = 0))
private void modifyRenderItem2(EntityLivingBase entity, ItemStack itemStack, int renderPass,
IItemRenderer.ItemRenderType type, CallbackInfo ci) {
ColorizeBlock.colorizeWaterBlockGL(Block.getBlockFromItem(itemStack.getItem()));
}
}
@@ -0,0 +1,800 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCauldron;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
import com.prupe.mcpatcher.mal.block.RenderBlocksUtils;
import com.prupe.mcpatcher.renderpass.RenderPass;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@Shadow
public IBlockAccess blockAccess;
@Shadow
public boolean enableAO;
@Shadow
public float colorRedTopLeft;
@Shadow
public float colorRedBottomLeft;
@Shadow
public float colorRedBottomRight;
@Shadow
public float colorRedTopRight;
@Shadow
public float colorGreenTopLeft;
@Shadow
public float colorGreenBottomLeft;
@Shadow
public float colorGreenBottomRight;
@Shadow
public float colorGreenTopRight;
@Shadow
public float colorBlueTopLeft;
@Shadow
public float colorBlueBottomLeft;
@Shadow
public float colorBlueBottomRight;
@Shadow
public float colorBlueTopRight;
@Shadow
public abstract boolean hasOverrideBlockTexture();
// Compute values once and reuse later
@Unique
private boolean mcpatcherforge$computeRedstoneWireColor;
@Unique
private float mcpatcherforge$redstoneWireColorRed;
@Unique
private float mcpatcherforge$redstoneWireColorGreen;
@Unique
private float mcpatcherforge$redstoneWireColorBlue;
@Unique
private void mcpatcherforge$setColorAndVertex(Tessellator tessellator, float red, float green, float blue, double x,
double y, double z, double u, double v) {
if (ColorizeBlock.isSmooth) {
tessellator.setColorOpaque_F(red, green, blue);
}
tessellator.addVertexWithUV(x, y, z, u, v);
}
@Inject(
method = "renderBlockCauldron(Lnet/minecraft/block/BlockCauldron;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockCauldron;getBlockTextureFromSide(I)Lnet/minecraft/util/IIcon;",
shift = At.Shift.AFTER))
private void modifyRenderBlockCauldron1(BlockCauldron block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
ColorizeBlock.computeWaterColor();
Tessellator.instance.setColorOpaque_F(Colorizer.setColor[0], Colorizer.setColor[1], Colorizer.setColor[2]);
}
@Inject(
method = "renderBlockCauldron(Lnet/minecraft/block/BlockCauldron;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockLiquid;getLiquidIcon(Ljava/lang/String;)Lnet/minecraft/util/IIcon;"))
private void modifyRenderBlockCauldron2(BlockCauldron block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
ColorizeBlock.computeWaterColor();
Tessellator.instance.setColorOpaque_F(Colorizer.setColor[0], Colorizer.setColor[1], Colorizer.setColor[2]);
}
@Inject(method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z", at = @At("HEAD"))
private void calculateComputeRedstoneWireColor(Block block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
this.mcpatcherforge$computeRedstoneWireColor = ColorizeBlock
.computeRedstoneWireColor(this.blockAccess.getBlockMetadata(x, y, z));
this.mcpatcherforge$redstoneWireColorRed = Math.max(Colorizer.setColor[0], 0.0f);
this.mcpatcherforge$redstoneWireColorGreen = Math.max(Colorizer.setColor[1], 0.0f);
this.mcpatcherforge$redstoneWireColorBlue = Math.max(Colorizer.setColor[2], 0.0f);
}
@ModifyArgs(
method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 0))
private void modifyColorRedstoneWire1(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
}
}
@ModifyArgs(
method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 4))
private void modifyColorRedstoneWire2(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
}
}
@ModifyArgs(
method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 6))
private void modifyColorRedstoneWire3(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
}
}
@ModifyArgs(
method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 8))
private void modifyColorRedstoneWire4(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
}
}
@ModifyArgs(
method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 10))
private void modifyColorRedstoneWire5(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
}
}
@Inject(
method = "renderStandardBlock(Lnet/minecraft/block/Block;III)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z"))
private void modifyRenderStandardBlock(Block block, int x, int y, int z, CallbackInfoReturnable<Boolean> cir) {
// TODO: capture local variables to prevent double math
int l = block.colorMultiplier(this.blockAccess, x, y, z);
float f = (float) (l >> 16 & 255) / 255.0F;
float f1 = (float) (l >> 8 & 255) / 255.0F;
float f2 = (float) (l & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable) {
float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
f = f3;
f1 = f4;
f2 = f5;
}
RenderBlocksUtils
.setupColorMultiplier(block, this.blockAccess, x, y, z, this.hasOverrideBlockTexture(), f, f1, f2);
}
@ModifyConstant(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
constant = { @Constant(floatValue = 0.5F), @Constant(floatValue = 0.6F), @Constant(floatValue = 0.8F) })
private float redirectAOBaseMultiplier(float constant) {
return RenderPass.getAOBaseMultiplier(constant);
}
// If only ordinal number was accessible ...
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 0),
ordinal = 1)
private boolean redirectColorMultiplier1(boolean value) {
return RenderBlocksUtils.useColorMultiplier(0);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 1),
ordinal = 1)
private boolean redirectColorMultiplier2(boolean value) {
return RenderBlocksUtils.useColorMultiplier(2);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 2),
ordinal = 1)
private boolean redirectColorMultiplier3(boolean value) {
return RenderBlocksUtils.useColorMultiplier(3);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 3),
ordinal = 1)
private boolean redirectColorMultiplier4(boolean value) {
return RenderBlocksUtils.useColorMultiplier(4);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 4),
ordinal = 1)
private boolean redirectColorMultiplier5(boolean value) {
return RenderBlocksUtils.useColorMultiplier(5);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 0),
ordinal = 1)
private boolean redirectColorMultiplierPartial1(boolean value) {
return RenderBlocksUtils.useColorMultiplier(0);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 1),
ordinal = 1)
private boolean redirectColorMultiplierPartial2(boolean value) {
return RenderBlocksUtils.useColorMultiplier(2);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 2),
ordinal = 1)
private boolean redirectColorMultiplierPartial3(boolean value) {
return RenderBlocksUtils.useColorMultiplier(3);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 3),
ordinal = 1)
private boolean redirectColorMultiplierPartial4(boolean value) {
return RenderBlocksUtils.useColorMultiplier(4);
}
@ModifyVariable(
method = "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(value = "LOAD", ordinal = 4),
ordinal = 1)
private boolean redirectColorMultiplierPartial5(boolean value) {
return RenderBlocksUtils.useColorMultiplier(5);
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 0))
private void redirectColorMultiplier1(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(0),
RenderBlocksUtils.getColorMultiplierGreen(0),
RenderBlocksUtils.getColorMultiplierBlue(0));
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 1))
private void redirectColorMultiplier2(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(1),
RenderBlocksUtils.getColorMultiplierGreen(1),
RenderBlocksUtils.getColorMultiplierBlue(1));
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 2))
private void redirectColorMultiplier3(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(2),
RenderBlocksUtils.getColorMultiplierGreen(2),
RenderBlocksUtils.getColorMultiplierBlue(2));
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 4))
private void redirectColorMultiplier4(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(3),
RenderBlocksUtils.getColorMultiplierGreen(3),
RenderBlocksUtils.getColorMultiplierBlue(3));
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 6))
private void redirectColorMultiplier5(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(4),
RenderBlocksUtils.getColorMultiplierGreen(4),
RenderBlocksUtils.getColorMultiplierBlue(4));
}
@Redirect(
method = "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 8))
private void redirectColorMultiplier6(Tessellator instance, float red, float green, float blue) {
Tessellator.instance.setColorOpaque_F(
RenderBlocksUtils.getColorMultiplierRed(5),
RenderBlocksUtils.getColorMultiplierGreen(5),
RenderBlocksUtils.getColorMultiplierBlue(5));
}
// If I was able to access ordinal number the duplication wouldn't be necessary
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 0))
private boolean modifyRenderBlockSandFalling0(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 0);
}
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 1))
private boolean modifyRenderBlockSandFalling1(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 1);
}
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 2))
private boolean modifyRenderBlockSandFalling2(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 2);
}
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 3))
private boolean modifyRenderBlockSandFalling3(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 3);
}
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 4))
private boolean modifyRenderBlockSandFalling4(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 4);
}
@WrapWithCondition(
method = "renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 5))
private boolean modifyRenderBlockSandFalling5(Tessellator tessellator, float x, float y, float z, Block block,
World world) {
return !ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, (int) x, (int) y, (int) z, 5);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 0))
private void mcpatcherforge$handleSmoothing(Tessellator tessellator, float red, float green, float blue,
Block block, int x, int y, int z) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, x, y, z, 1 + 6))) {
tessellator.setColorOpaque_F(red, green, blue);
}
}
// Violate DRY
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 0))
private void mcpatcherforge$redirectColor1(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopLeft,
this.colorGreenTopLeft,
this.colorBlueTopLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 1))
private void mcpatcherforge$redirectColor2(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomLeft,
this.colorGreenBottomLeft,
this.colorBlueBottomLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 2))
private void mcpatcherforge$redirectColor3(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomRight,
this.colorGreenBottomRight,
this.colorBlueBottomRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 3))
private void mcpatcherforge$redirectColor4(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopRight,
this.colorGreenTopRight,
this.colorBlueTopRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 4))
private void mcpatcherforge$redirectColor5(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopLeft,
this.colorGreenTopLeft,
this.colorBlueTopLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 5))
private void mcpatcherforge$redirectColor6(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopRight,
this.colorGreenTopRight,
this.colorBlueTopRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 6))
private void mcpatcherforge$redirectColor7(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomRight,
this.colorGreenBottomRight,
this.colorBlueBottomRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 7))
private void mcpatcherforge$redirectColor8(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomLeft,
this.colorGreenBottomLeft,
this.colorBlueBottomLeft,
x,
y,
z,
u,
v);
}
@Inject(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceYNeg(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V"))
private void mcpatcherforge$setEnableAO(Block block, int x, int y, int z, CallbackInfoReturnable<Boolean> cir) {
this.enableAO = false;
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 8))
private void mcpatcherforge$redirectColor11(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopLeft,
this.colorGreenTopLeft,
this.colorBlueTopLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 9))
private void mcpatcherforge$redirectColor12(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomLeft,
this.colorGreenBottomLeft,
this.colorBlueBottomLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 10))
private void mcpatcherforge$redirectColor13(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomRight,
this.colorGreenBottomRight,
this.colorBlueBottomRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 11))
private void mcpatcherforge$redirectColor14(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopRight,
this.colorGreenTopRight,
this.colorBlueTopRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 12))
private void mcpatcherforge$redirectColor15(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopRight,
this.colorGreenTopRight,
this.colorBlueTopRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 13))
private void mcpatcherforge$redirectColor16(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomRight,
this.colorGreenBottomRight,
this.colorBlueBottomRight,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 14))
private void mcpatcherforge$redirectColor17(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedBottomLeft,
this.colorGreenBottomLeft,
this.colorBlueBottomLeft,
x,
y,
z,
u,
v);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V",
ordinal = 15))
private void mcpatcherforge$redirectColor18(Tessellator tessellator, double x, double y, double z, double u,
double v) {
mcpatcherforge$setColorAndVertex(
tessellator,
this.colorRedTopLeft,
this.colorGreenTopLeft,
this.colorBlueTopLeft,
x,
y,
z,
u,
v);
}
}
@@ -0,0 +1,34 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.settings.GameSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cc.ColorizeWorld;
@Mixin(RenderGlobal.class)
public abstract class MixinRenderGlobal {
@ModifyArg(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_I(I)V"))
private int modifyRenderSky2(int endSkyColor) {
return ColorizeWorld.endSkyColor;
}
//TODO: decide if this is ok to leave out in Angelica
/*
@Redirect(
method = "renderClouds(F)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z"))
private boolean modifyRenderClouds(GameSettings instance) {
return ColorizeWorld.drawFancyClouds(instance.fancyGraphics);
}
*/
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer.entity;
import net.minecraft.client.renderer.entity.RenderWolf;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityWolf;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cc.ColorizeEntity;
@Mixin(RenderWolf.class)
public class MixinRenderWolf {
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/passive/EntityWolf;IF)I",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glColor3f(FFF)V", ordinal = 1, remap = false))
private void modifyShouldRenderPass2(float red, float green, float blue, EntityWolf entity) {
int collarColor = entity.getCollarColor();
GL11.glColor3f(
ColorizeEntity.getWolfCollarColor(EntitySheep.fleeceColorTable[collarColor], collarColor)[0],
ColorizeEntity.getWolfCollarColor(EntitySheep.fleeceColorTable[collarColor], collarColor)[1],
ColorizeEntity.getWolfCollarColor(EntitySheep.fleeceColorTable[collarColor], collarColor)[2]);
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer.entity;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderXPOrb;
import net.minecraft.entity.item.EntityXPOrb;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cc.ColorizeEntity;
@Mixin(RenderXPOrb.class)
public abstract class MixinRenderXPOrb {
@Redirect(
method = "doRender(Lnet/minecraft/entity/item/EntityXPOrb;DDDFF)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;setColorRGBA_I(II)V"))
private void modifyDoRender(Tessellator instance, int color, int alpha, EntityXPOrb entity, double x, double y,
double z, float p_76986_8_, float p_76986_9_) {
instance
.setColorRGBA_I(ColorizeEntity.colorizeXPOrb(color, ((float) entity.xpColor + p_76986_9_) / 2.0F), alpha);
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySignRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import com.prupe.mcpatcher.cc.ColorizeWorld;
@Mixin(TileEntitySignRenderer.class)
public abstract class MixinTileEntitySignRenderer {
@ModifyArg(
method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntitySign;DDDF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I"),
index = 3)
private int modifyRenderTileEntityAt(int color) {
return ColorizeWorld.colorizeSignText();
}
}
@@ -0,0 +1,21 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cc.ColorizeItem;
@Mixin(EntityList.class)
public abstract class MixinEntityList {
@Inject(method = "addMapping(Ljava/lang/Class;Ljava/lang/String;III)V", at = @At("HEAD"))
private static void modifyAddMapping(Class<? extends Entity> entityClass, String entityName, int entityId,
int shellColor, int spotColor, CallbackInfo ci) {
ColorizeItem.setupSpawnerEgg(entityName, entityId, shellColor, spotColor);
}
}
@@ -0,0 +1,18 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.item;
import net.minecraft.item.ItemArmor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import com.prupe.mcpatcher.cc.ColorizeEntity;
@Mixin(ItemArmor.class)
public abstract class MixinItemArmor {
@ModifyConstant(method = "getColor(Lnet/minecraft/item/ItemStack;)I", constant = @Constant(intValue = 10511680))
private int modifyGetColor(int input) {
return ColorizeEntity.undyedLeatherColor;
}
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.item;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(ItemBlock.class)
public abstract class MixinItemBlock extends Item {
@Final
@Shadow
public Block field_150939_a;
@Override
public int getColorFromItemStack(final ItemStack itemStack, final int meta) {
final Block block = this.field_150939_a;
if (block != null) {
return block.getRenderColor(meta);
}
return super.getColorFromItemStack(itemStack, meta);
}
}
@@ -0,0 +1,20 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.item;
import net.minecraft.item.ItemMonsterPlacer;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeItem;
@Mixin(ItemMonsterPlacer.class)
public abstract class MixinItemMonsterPlacer {
@Inject(method = "getColorFromItemStack(Lnet/minecraft/item/ItemStack;I)I", at = @At("RETURN"), cancellable = true)
private void modifyGetColorFromItemStack(ItemStack itemStack, int spots, CallbackInfoReturnable<Integer> cir) {
cir.setReturnValue(ColorizeItem.colorizeSpawnerEgg(cir.getReturnValue(), itemStack.getItemDamage(), spots));
}
}
@@ -0,0 +1,99 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.item.crafting;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.RecipesArmorDyes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import com.prupe.mcpatcher.cc.ColorizeEntity;
@Mixin(RecipesArmorDyes.class)
public abstract class MixinRecipesArmorDyes {
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason Fleece color redirection is beyond my skill atm
*/
@SuppressWarnings("DuplicatedCode")
@Overwrite
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
ItemStack itemstack = null;
int[] aint = new int[3];
int i = 0;
int j = 0;
ItemArmor itemarmor = null;
int k;
int l;
float f;
float f1;
int l1;
for (k = 0; k < inventoryCrafting.getSizeInventory(); ++k) {
ItemStack itemstack1 = inventoryCrafting.getStackInSlot(k);
if (itemstack1 != null) {
if (itemstack1.getItem() instanceof ItemArmor) {
itemarmor = (ItemArmor) itemstack1.getItem();
if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.CLOTH || itemstack != null) {
return null;
}
itemstack = itemstack1.copy();
itemstack.stackSize = 1;
if (itemarmor.hasColor(itemstack1)) {
l = itemarmor.getColor(itemstack);
f = (float) (l >> 16 & 255) / 255.0F;
f1 = (float) (l >> 8 & 255) / 255.0F;
float f2 = (float) (l & 255) / 255.0F;
i = (int) ((float) i + Math.max(f, Math.max(f1, f2)) * 255.0F);
aint[0] = (int) ((float) aint[0] + f * 255.0F);
aint[1] = (int) ((float) aint[1] + f1 * 255.0F);
aint[2] = (int) ((float) aint[2] + f2 * 255.0F);
++j;
}
} else {
if (itemstack1.getItem() != Items.dye) {
return null;
}
// patch
float[] afloat = ColorizeEntity.getArmorDyeColor(
EntitySheep.fleeceColorTable[BlockColored.func_150032_b(itemstack1.getItemDamage())],
BlockColored.func_150032_b(itemstack1.getItemDamage()));
int j1 = (int) (afloat[0] * 255.0F);
int k1 = (int) (afloat[1] * 255.0F);
l1 = (int) (afloat[2] * 255.0F);
i += Math.max(j1, Math.max(k1, l1));
aint[0] += j1;
aint[1] += k1;
aint[2] += l1;
++j;
}
}
}
if (itemarmor == null) {
return null;
} else {
k = aint[0] / j;
int i1 = aint[1] / j;
l = aint[2] / j;
f = (float) i / (float) j;
f1 = (float) Math.max(k, Math.max(i1, l));
k = (int) ((float) k * f / f1);
i1 = (int) ((float) i1 * f / f1);
l = (int) ((float) l * f / f1);
l1 = (k << 8) + i1;
l1 = (l1 << 8) + l;
itemarmor.func_82813_b(itemstack, l1);
return itemstack;
}
}
}
@@ -0,0 +1,33 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.potion;
import net.minecraft.potion.Potion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeItem;
import com.gtnewhorizons.angelica.mixins.interfaces.PotionExpansion;
@Mixin(Potion.class)
public abstract class MixinPotion implements PotionExpansion {
@Unique
private int mcpatcher_forge$origColor;
@Inject(method = "setPotionName(Ljava/lang/String;)Lnet/minecraft/potion/Potion;", at = @At("RETURN"))
private void modifySetPotionName(String name, CallbackInfoReturnable<Potion> cir) {
ColorizeItem.setupPotion((Potion) (Object) this);
}
public void setOrigColor(int color) {
this.mcpatcher_forge$origColor = color;
}
public int getOrigColor() {
return this.mcpatcher_forge$origColor;
}
}
@@ -0,0 +1,18 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.potion;
import net.minecraft.potion.PotionHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import com.prupe.mcpatcher.cc.ColorizeItem;
@Mixin(PotionHelper.class)
public abstract class MixinPotionHelper {
@ModifyConstant(method = "calcPotionLiquidColor(Ljava/util/Collection;)I", constant = @Constant(intValue = 3694022))
private static int modifyCalcPotionLiquidColor(int constant) {
return ColorizeItem.getWaterBottleColor();
}
}
@@ -0,0 +1,80 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.world;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(World.class)
public abstract class MixinWorld {
@Unique
private boolean mcpatcher_forge$computeSkyColor;
@Inject(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At("HEAD"),
remap = false)
private void modifyGetSkyColorBody1(Entity entity, float p_72833_2_, CallbackInfoReturnable<Vec3> cir) {
this.mcpatcher_forge$computeSkyColor = ColorizeWorld.computeSkyColor((World) (Object) this, p_72833_2_);
}
@Inject(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraftforge/client/ForgeHooksClient;getSkyBlendColour(Lnet/minecraft/world/World;III)I",
remap = false),
remap = false)
private void modifyGetSkyColorBody2(Entity entity, float p_72833_2_, CallbackInfoReturnable<Vec3> cir) {
ColorizeWorld.setupForFog(entity);
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At(value = "STORE", ordinal = 0),
ordinal = 3,
remap = false)
private float modifyGetSkyColorBody3(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
return Colorizer.setColor[0];
}
return input;
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At(value = "STORE", ordinal = 0),
ordinal = 4,
remap = false)
private float modifyGetSkyColorBody4(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
return Colorizer.setColor[1];
}
return input;
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At(value = "STORE", ordinal = 0),
ordinal = 5,
remap = false)
private float modifyGetSkyColorBody5(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
return Colorizer.setColor[2];
}
return input;
}
}
@@ -0,0 +1,54 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.world;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(WorldProvider.class)
public abstract class MixinWorldProvider {
@Unique
private boolean mcpatcher_forge$computeFogColor;
@Inject(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", at = @At("HEAD"))
private void modifyGetFogColor1(float celestialAngle, float renderPartialTicks, CallbackInfoReturnable<Vec3> cir) {
this.mcpatcher_forge$computeFogColor = ColorizeWorld
.computeFogColor((WorldProvider) (Object) this, celestialAngle);
}
@ModifyConstant(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", constant = @Constant(floatValue = 0.7529412F))
private float modifyGetFogColor1(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
return Colorizer.setColor[0];
}
return constant;
}
@ModifyConstant(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", constant = @Constant(floatValue = 0.84705883F))
private float modifyGetFogColor2(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
return Colorizer.setColor[1];
}
return constant;
}
@ModifyConstant(
method = "getFogColor(FF)Lnet/minecraft/util/Vec3;",
constant = @Constant(floatValue = 1.0F, ordinal = 2))
private float modifyGetFogColor3(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
return Colorizer.setColor[2];
}
return constant;
}
}
@@ -0,0 +1,29 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.world;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProviderEnd;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mixin(WorldProviderEnd.class)
public abstract class MixinWorldProviderEnd {
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason customized value
*/
@SideOnly(Side.CLIENT)
@Overwrite
public Vec3 getFogColor(float celestialAngle, float renderPartialTicks) {
return Vec3.createVectorHelper(
ColorizeWorld.endFogColor[0],
ColorizeWorld.endFogColor[1],
ColorizeWorld.endFogColor[2]);
}
}
@@ -0,0 +1,29 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.world;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProviderHell;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mixin(WorldProviderHell.class)
public abstract class MixinWorldProviderHell {
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason customized value
*/
@SideOnly(Side.CLIENT)
@Overwrite
public Vec3 getFogColor(float celestialAngle, float renderPartialTicks) {
return Vec3.createVectorHelper(
ColorizeWorld.netherFogColor[0],
ColorizeWorld.netherFogColor[1],
ColorizeWorld.netherFogColor[2]);
}
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(ItemRenderer.class)
public abstract class MixinItemRenderer {
@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/EntityLivingBase;getItemIcon(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;"))
private IIcon modifyRenderItem1(EntityLivingBase instance, ItemStack item, int renderPass, EntityLivingBase entity,
ItemStack item2, int renderPass1) {
return CITUtils.getIcon(entity.getItemIcon(item2, renderPass1), item2, renderPass1);
}
}
@@ -0,0 +1,22 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer;
import com.prupe.mcpatcher.cit.CITUtils;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ItemRenderer.class)
public class MixinItemRenderer_NO_NF {
@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"),
remap = false)
private boolean modifyRenderItem3(ItemStack item, int pass, EntityLivingBase entity, ItemStack itemStack,
int renderPass) {
return !CITUtils.renderEnchantmentHeld(item, renderPass) && item.hasEffect(pass);
}
}
@@ -0,0 +1,44 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(RenderBiped.class)
public abstract class MixinRenderBiped extends RenderLiving {
public MixinRenderBiped(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/EntityLiving;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderBiped;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyShouldRenderPass(RenderBiped instance, ResourceLocation resourceLocation,
EntityLiving entityLiving, int slotId, float p_77032_3_) {
this.bindTexture(
CITUtils.getArmorTexture(resourceLocation, entityLiving, entityLiving.func_130225_q(3 - slotId)));
}
@Redirect(
method = "func_82408_c(Lnet/minecraft/entity/EntityLiving;IF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderBiped;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyFunc_82408_c(RenderBiped instance, ResourceLocation resourceLocation, EntityLiving entityLiving,
int slotId, float p_82408_3_) {
this.bindTexture(
CITUtils.getArmorTexture(resourceLocation, entityLiving, entityLiving.func_130225_q(3 - slotId)));
}
}
@@ -0,0 +1,286 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(RendererLivingEntity.class)
public abstract class MixinRenderEntityLiving extends Render {
@Final
@Shadow
private static Logger logger;
@Final
@Shadow
private static ResourceLocation RES_ITEM_GLINT;
@Shadow
public ModelBase mainModel;
@Shadow
public ModelBase renderPassModel;
@Shadow
protected abstract float interpolateRotation(float angle1, float angle2, float p_77034_3_);
@Shadow
protected abstract void renderModel(EntityLivingBase entityLivingBase, float p_77036_2_, float p_77036_3_,
float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_);
@Shadow
protected abstract void renderLivingAt(EntityLivingBase entityLivingBase, double p_77039_2_, double p_77039_4_,
double p_77039_6_);
@Shadow
protected abstract void rotateCorpse(EntityLivingBase entityLivingBase, float p_77043_2_, float p_77043_3_,
float p_77043_4_);
@Shadow
protected abstract float renderSwingProgress(EntityLivingBase entityLivingBase, float p_77040_2_);
@Shadow
protected abstract float handleRotationFloat(EntityLivingBase entityLivingBase, float p_77044_2_);
@Shadow
protected abstract void renderEquippedItems(EntityLivingBase entityLivingBase, float p_77029_2_);
@Shadow
protected abstract int inheritRenderPass(EntityLivingBase entityLivingBase, int p_77035_2_, float p_77035_3_);
@Shadow
protected abstract int shouldRenderPass(EntityLivingBase entityLivingBase, int p_77032_2_, float p_77032_3_);
@Shadow
protected abstract void func_82408_c(EntityLivingBase entityLivingBase, int p_82408_2_, float p_82408_3_);
@Shadow
protected abstract int getColorMultiplier(EntityLivingBase entityLivingBase, float p_77030_2_, float p_77030_3_);
@Shadow
protected abstract void preRenderCallback(EntityLivingBase entityLivingBase, float p_77041_2_);
@Shadow
protected abstract void passSpecialRender(EntityLivingBase entityLivingBase, double p_77033_2_, double p_77033_4_,
double p_77033_6_);
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason if statement modified into else-if
*/
@SuppressWarnings("DuplicatedCode")
@Overwrite
public void doRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
if (MinecraftForge.EVENT_BUS
.post(new RenderLivingEvent.Pre(entity, (RendererLivingEntity) (Object) this, x, y, z))) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
this.mainModel.onGround = this.renderSwingProgress(entity, p_76986_9_);
if (this.renderPassModel != null) {
this.renderPassModel.onGround = this.mainModel.onGround;
}
this.mainModel.isRiding = entity.isRiding();
if (this.renderPassModel != null) {
this.renderPassModel.isRiding = this.mainModel.isRiding;
}
this.mainModel.isChild = entity.isChild();
if (this.renderPassModel != null) {
this.renderPassModel.isChild = this.mainModel.isChild;
}
try {
float f2 = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, p_76986_9_);
float f3 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, p_76986_9_);
float f4;
if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase entitylivingbase1) {
f2 = this.interpolateRotation(
entitylivingbase1.prevRenderYawOffset,
entitylivingbase1.renderYawOffset,
p_76986_9_);
f4 = MathHelper.wrapAngleTo180_float(f3 - f2);
if (f4 < -85.0F) {
f4 = -85.0F;
}
if (f4 >= 85.0F) {
f4 = 85.0F;
}
f2 = f3 - f4;
if (f4 * f4 > 2500.0F) {
f2 += f4 * 0.2F;
}
}
float f13 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_;
this.renderLivingAt(entity, x, y, z);
f4 = this.handleRotationFloat(entity, p_76986_9_);
this.rotateCorpse(entity, f4, f2, p_76986_9_);
float f5 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(entity, p_76986_9_);
GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F);
float f6 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * p_76986_9_;
float f7 = entity.limbSwing - entity.limbSwingAmount * (1.0F - p_76986_9_);
if (entity.isChild()) {
f7 *= 3.0F;
}
if (f6 > 1.0F) {
f6 = 1.0F;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
this.mainModel.setLivingAnimations(entity, f7, f6, p_76986_9_);
this.renderModel(entity, f7, f6, f4, f3 - f2, f13, f5);
int j;
float f8;
float f9;
float f10;
for (int i = 0; i < 4; ++i) {
j = this.shouldRenderPass(entity, i, p_76986_9_);
if (j > 0) {
this.renderPassModel.setLivingAnimations(entity, f7, f6, p_76986_9_);
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
if ((j & 240) == 16) {
this.func_82408_c(entity, i, p_76986_9_);
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
}
// patch start
if (CITUtils.setupArmorEnchantments(entity, i)) {
while (CITUtils.preRenderArmorEnchantment()) {
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
CITUtils.postRenderArmorEnchantment();
}
} else if ((j & 15) == 15) {
// if -> else if
// patch end
f8 = (float) entity.ticksExisted + p_76986_9_;
this.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
f9 = 0.5F;
GL11.glColor4f(f9, f9, f9, 1.0F);
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDepthMask(false);
for (int k = 0; k < 2; ++k) {
GL11.glDisable(GL11.GL_LIGHTING);
f10 = 0.76F;
GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float f11 = f8 * (0.001F + (float) k * 0.003F) * 20.0F;
float f12 = 0.33333334F;
GL11.glScalef(f12, f12, f12);
GL11.glRotatef(30.0F - (float) k * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, f11, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glDepthMask(true);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
GL11.glDepthMask(true);
this.renderEquippedItems(entity, p_76986_9_);
float f14 = entity.getBrightness(p_76986_9_);
j = this.getColorMultiplier(entity, f14, p_76986_9_);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
if ((j >> 24 & 255) > 0 || entity.hurtTime > 0 || entity.deathTime > 0) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthFunc(GL11.GL_EQUAL);
if (entity.hurtTime > 0 || entity.deathTime > 0) {
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.mainModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
for (int l = 0; l < 4; ++l) {
if (this.inheritRenderPass(entity, l, p_76986_9_) >= 0) {
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
}
}
}
if ((j >> 24 & 255) > 0) {
f8 = (float) (j >> 16 & 255) / 255.0F;
f9 = (float) (j >> 8 & 255) / 255.0F;
float f15 = (float) (j & 255) / 255.0F;
f10 = (float) (j >> 24 & 255) / 255.0F;
GL11.glColor4f(f8, f9, f15, f10);
this.mainModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
for (int i1 = 0; i1 < 4; ++i1) {
if (this.inheritRenderPass(entity, i1, p_76986_9_) >= 0) {
GL11.glColor4f(f8, f9, f15, f10);
this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5);
}
}
}
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
} catch (Exception exception) {
logger.error("Couldn't render entity", exception);
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(entity, x, y, z);
MinecraftForge.EVENT_BUS
.post(new RenderLivingEvent.Post(entity, (RendererLivingEntity) (Object) this, x, y, z));
}
}
@@ -0,0 +1,135 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(RenderItem.class)
public abstract class MixinRenderItem extends Render {
@Final
@Shadow
private static ResourceLocation RES_ITEM_GLINT;
@Shadow
public float zLevel;
@Shadow
protected abstract void renderGlint(int p_77018_1_, int p_77018_2_, int p_77018_3_, int p_77018_4_, int p_77018_5_);
// TODO: figure out if ForgeHooksClient#renderEntityItem also needs work
@Redirect(
method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/Item;getIcon(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;",
remap = false))
private IIcon modifyDoRender(Item item, ItemStack itemStack, int pass) {
return CITUtils.getIcon(item.getIcon(itemStack, pass), itemStack, pass);
}
@Inject(
method = "renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glColorMask(ZZZZ)V", remap = false, ordinal = 0),
remap = false)
private void modifyRenderItemIntoGUI1(FontRenderer fontRenderer, TextureManager manager, ItemStack itemStack, int x,
int y, boolean renderEffect, CallbackInfo ci) {
GL11.glDepthMask(false);
}
@Inject(
method = "renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", remap = false, ordinal = 4),
remap = false)
private void modifyRenderItemIntoGUI2(FontRenderer fontRenderer, TextureManager manager, ItemStack itemStack, int x,
int y, boolean renderEffect, CallbackInfo ci) {
GL11.glDepthMask(true);
}
@Redirect(
method = "renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/Item;getIcon(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;",
remap = false),
remap = false)
private IIcon modifyRenderItemIntoGUI3(Item item, ItemStack itemStack, int pass) {
return CITUtils.getIcon(item.getIcon(itemStack, pass), itemStack, pass);
}
// if I don't do this the transparency in the inventory breaks, I'm sure there's a much better way of doing it but
// my open gl knowledge is pretty much none-existent atm
@Redirect(
method = "renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", remap = false, ordinal = 10),
remap = false)
private void cancelAlpha3(int cap) {
}
@Redirect(
method = "renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", remap = false, ordinal = 8),
remap = false)
private void cancelAlpha4(int cap) {
}
@Inject(
method = "renderItemAndEffectIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;II)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;IIZ)V",
remap = false))
private void modifyRenderItemAndEffectIntoGUI1(FontRenderer fontRenderer, TextureManager manager,
ItemStack itemStack, int x, int y, CallbackInfo ci) {
// Moved to before call, will not trigger with forge event
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);
}
/**
* Forge added a false && to the targeted if statement, this adds the entire statement back
* TODO: target forges event render class instead & check compatibility
*/
@SuppressWarnings("DuplicatedCode")
@Inject(
method = "renderItemAndEffectIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/item/ItemStack;II)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/RenderItem;zLevel:F", ordinal = 2))
private void modifyRenderItemAndEffectIntoGUI2(FontRenderer fontRenderer, TextureManager manager,
ItemStack itemStack, int x, int y, CallbackInfo ci) {
if (!CITUtils.renderEnchantmentGUI(itemStack, x, y, this.zLevel) && itemStack.hasEffect(0)) {
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
manager.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
}
@@ -0,0 +1,20 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import com.prupe.mcpatcher.cit.CITUtils;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RenderItem.class)
public class MixinRenderItemRenderDroppedItem {
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z", remap = false),
remap = false)
private boolean modifyRenderDroppedItem(ItemStack instance, int pass) {
return !CITUtils.renderEnchantmentDropped(instance) && instance.hasEffect(pass);
}
}
@@ -0,0 +1,49 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(RenderPlayer.class)
public abstract class MixinRenderPlayer extends RendererLivingEntity {
public MixinRenderPlayer(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/client/entity/AbstractClientPlayer;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderBiped;getArmorResource(Lnet/minecraft/entity/Entity;Lnet/minecraft/item/ItemStack;ILjava/lang/String;)Lnet/minecraft/util/ResourceLocation;",
remap = false))
private ResourceLocation modifyShouldRenderPass(Entity entity, ItemStack stack, int slot, String type,
AbstractClientPlayer player) {
return CITUtils
.getArmorTexture(RenderBiped.getArmorResource(player, stack, slot, type), (EntityLivingBase) entity, stack);
}
@Redirect(
method = "func_82408_c(Lnet/minecraft/client/entity/AbstractClientPlayer;IF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderBiped;getArmorResource(Lnet/minecraft/entity/Entity;Lnet/minecraft/item/ItemStack;ILjava/lang/String;)Lnet/minecraft/util/ResourceLocation;",
remap = false))
private ResourceLocation modifyFunc_82408_c(Entity entity, ItemStack stack, int slot, String type,
AbstractClientPlayer player) {
return CITUtils
.getArmorTexture(RenderBiped.getArmorResource(player, stack, slot, type), (EntityLivingBase) entity, stack);
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(RenderSnowball.class)
public abstract class MixinRenderSnowball {
@Redirect(
method = "doRender(Lnet/minecraft/entity/Entity;DDDFF)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getIconFromDamage(I)Lnet/minecraft/util/IIcon;"))
private IIcon modifyDoRender(Item item, int damage, Entity entity) {
return CITUtils.getEntityIcon(item.getIconFromDamage(damage), entity);
}
}
@@ -0,0 +1,26 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.item;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cit.CITUtils;
@Mixin(Item.class)
public abstract class MixinItem {
@Shadow
public abstract IIcon getIconFromDamage(int meta);
@Redirect(
method = "getIconIndex(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/IIcon;",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getIconFromDamage(I)Lnet/minecraft/util/IIcon;"))
private IIcon modifyGetIconIndex(Item item, int meta, ItemStack itemStack) {
return CITUtils.getIcon(this.getIconFromDamage(meta), itemStack, 0);
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.nbt;
import java.util.Collection;
import java.util.Map;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagCompoundExpansion;
@Mixin(NBTTagCompound.class)
public abstract class MixinNBTTagCompound implements NBTTagCompoundExpansion {
@Shadow
private Map<String, NBTBase> tagMap;
public Collection<NBTBase> getTags() {
return this.tagMap.values();
}
}
@@ -0,0 +1,22 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.nbt;
import java.util.List;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagListExpansion;
@Mixin(NBTTagList.class)
public class MixinNBTTagList implements NBTTagListExpansion {
@Shadow
public List<NBTBase> tagList;
public NBTBase tagAt(final int n) {
return this.tagList.get(n);
}
}
@@ -0,0 +1,115 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.ctm_cc;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.cc.ColorizeBlock;
// TODO: split ctm // cc use and migrate to MixinRenderBlocks & MixinRenderBlocksCC
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@Shadow
public IBlockAccess blockAccess;
@Shadow
public boolean enableAO;
@Shadow
public abstract IIcon getBlockIcon(Block block, IBlockAccess access, int x, int y, int z, int side);
@Shadow
public abstract IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta);
@Unique
private int mcpatcherforge$neededSideRenderBlockLiquid;
@Unique
private float mcpatcherforge$neededFloat1;
@Unique
private float mcpatcherforge$neededFloat2;
@Unique
private float mcpatcherforge$neededFloat3;
// Redirect calls to this.getBlockIcon when possible
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 0))
private IIcon mcpatcherforge$obtainFloatsAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z) {
int l = block.colorMultiplier(this.blockAccess, x, y, z);
this.mcpatcherforge$neededFloat1 = (float) (l >> 16 & 255) / 255.0F;
this.mcpatcherforge$neededFloat2 = (float) (l >> 8 & 255) / 255.0F;
this.mcpatcherforge$neededFloat3 = (float) (l & 255) / 255.0F;
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 2))
private void mcpatcherforge$redirectColor10(Tessellator tessellator, float red, float green, float blue,
Block block, int x, int y, int z) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock.setupBlockSmoothing(
(RenderBlocks) (Object) this,
block,
this.blockAccess,
x,
y,
z,
this.mcpatcherforge$neededSideRenderBlockLiquid + 6))) {
tessellator.setColorOpaque_F(red, green, blue);
}
}
// Capture needed value
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 2))
private IIcon mcpatcherforge$saveSideAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z) {
this.mcpatcherforge$neededSideRenderBlockLiquid = side;
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 1))
private void mcpatcherforge$redirectColor9(Tessellator tessellator, float red, float green, float blue, Block block,
int x, int y, int z) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, x, y, z, 6))) {
tessellator.setColorOpaque_F(
red * this.mcpatcherforge$neededFloat1,
green * this.mcpatcherforge$neededFloat2,
blue * this.mcpatcherforge$neededFloat3);
}
if (ColorizeBlock.isSmooth) {
this.enableAO = true;
}
}
}
@@ -0,0 +1,62 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.ctm_cc;
import java.util.Map;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.mal.tile.TileLoader;
@Mixin(TextureMap.class)
public abstract class MixinTextureMap extends AbstractTexture {
@Shadow
@Final
private Map<String, TextureAtlasSprite> mapRegisteredSprites;
@Shadow
@Final
private String basePath;
@Shadow
protected abstract void registerIcons();
@Inject(
method = "loadTextureAtlas(Lnet/minecraft/client/resources/IResourceManager;)V",
at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V", remap = false, shift = At.Shift.AFTER))
private void modifyLoadTextureAtlas(IResourceManager manager, CallbackInfo ci) {
this.registerIcons();
TileLoader.registerIcons((TextureMap) (Object) this, this.basePath, this.mapRegisteredSprites);
}
@Redirect(
method = "completeResourceLocation(Lnet/minecraft/util/ResourceLocation;I)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Ljava/lang/String;format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;",
ordinal = 0,
remap = false))
private String modifyCompleteResourceLocation(String format, Object[] args, ResourceLocation location,
int p_147634_2_) {
return TileLoader.getOverridePath("", this.basePath, location.getResourcePath(), ".png");
}
// Base game has s.indexOf(47) != -1 || s.indexOf(92) != -1
// However, forge already removes this, so we don't have to patch that
@Redirect(
method = "registerIcon(Ljava/lang/String;)Lnet/minecraft/util/IIcon;",
at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z"))
private boolean modifyRegisterIcon(String instance, Object toCompare) {
return TileLoader.isSpecialTexture((TextureMap) (Object) this, toCompare.toString(), instance);
}
}
@@ -0,0 +1,181 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.hd;
import java.awt.image.BufferedImage;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.hd.FontUtils;
import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererExpansion;
@Mixin(FontRenderer.class)
public abstract class MixinFontRenderer implements FontRendererExpansion {
@Shadow
@Final
private static ResourceLocation[] unicodePageLocations;
@Shadow
protected int[] charWidth;
@Mutable
@Shadow
@Final
protected ResourceLocation locationFontTexture;
@Shadow(remap = false)
protected abstract void bindTexture(ResourceLocation location);
@Shadow(remap = false)
protected abstract void setColor(float r, float g, float b, float a);
@Unique
private float[] mcpatcher_forge$charWidthf;
@Unique
private ResourceLocation mcpatcher_forge$defaultFont;
@Unique
private ResourceLocation mcpatcher_forge$hdFont;
@Unique
private boolean mcpatcher_forge$isHD;
@Unique
private float mcpatcher_forge$fontAdj;
/**
* for custom text colors the index is required when drawing
* unfortunately capturing locals doesn't work with modifyVariable
*/
@Unique
private int mcpatcher_forge$renderStringAtPosIndex;
public float[] getCharWidthf() {
return mcpatcher_forge$charWidthf;
}
public void setCharWidthf(float[] widthf) {
mcpatcher_forge$charWidthf = widthf;
}
public ResourceLocation getDefaultFont() {
return mcpatcher_forge$defaultFont;
}
public void setDefaultFont(ResourceLocation font) {
mcpatcher_forge$defaultFont = font;
}
public ResourceLocation getHDFont() {
return mcpatcher_forge$hdFont;
}
public void setHDFont(ResourceLocation font) {
mcpatcher_forge$hdFont = font;
}
public boolean getIsHD() {
return mcpatcher_forge$isHD;
}
public void setIsHD(boolean isHD) {
this.mcpatcher_forge$isHD = isHD;
}
public float getFontAdj() {
return mcpatcher_forge$fontAdj;
}
public void setFontAdj(float fontAdj) {
this.mcpatcher_forge$fontAdj = fontAdj;
}
@Redirect(
method = "readFontTexture()V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/gui/FontRenderer;locationFontTexture:Lnet/minecraft/util/ResourceLocation;"))
private ResourceLocation modifyReadFontTexture1(FontRenderer instance) {
this.locationFontTexture = FontUtils.getFontName((FontRenderer) (Object) this, this.locationFontTexture, 0.0f);
return this.locationFontTexture;
}
@SuppressWarnings("InvalidInjectorMethodSignature") // IDEA plugin struggles with local capture
@Inject(method = "readFontTexture()V", at = @At(value = "RETURN"), locals = LocalCapture.CAPTURE_FAILHARD)
private void modifyReadFontTexture2(CallbackInfo ci, BufferedImage bufferedimage, int i, int j, int[] aint) {
setCharWidthf(
FontUtils
.computeCharWidthsf((FontRenderer) (Object) this, locationFontTexture, bufferedimage, aint, charWidth));
}
@ModifyConstant(method = "renderCharAtPos(ICZ)F", constant = @Constant(floatValue = 4.0f))
private float modifyRenderCharAtPos(float constant) {
return this.mcpatcher_forge$charWidthf[32];
}
@ModifyConstant(method = "renderDefaultChar(IZ)F", constant = @Constant(floatValue = 1.0f))
private float modifyRenderDefaultChar1(float constant) {
return this.mcpatcher_forge$fontAdj;
}
@Inject(method = "renderDefaultChar(IZ)F", at = @At("RETURN"), cancellable = true)
private void modifyRenderDefaultChar2(int ch, boolean b, CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(FontUtils.getCharWidthf((FontRenderer) (Object) this, this.charWidth, ch));
}
@Inject(
method = "getUnicodePageLocation(I)Lnet/minecraft/util/ResourceLocation;",
at = @At("RETURN"),
cancellable = true)
private void modifyGetUnicodePageLocation(int index, CallbackInfoReturnable<ResourceLocation> cir) {
cir.setReturnValue(FontUtils.getUnicodePage(unicodePageLocations[index]));
}
@Inject(
method = "renderStringAtPos(Ljava/lang/String;Z)V",
locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/FontRenderer;colorCode:[I"))
private void modifyRenderStringAtPos1(String string, boolean bool, CallbackInfo ci, int i, char c0, int j) {
this.mcpatcher_forge$renderStringAtPosIndex = j;
}
// IDEA plugin really struggles with this for some reason
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "renderStringAtPos(Ljava/lang/String;Z)V",
at = @At(value = "STORE", ordinal = 0),
ordinal = 2)
private int modifyRenderStringAtPos2(int color) {
return ColorizeWorld.colorizeText(color, this.mcpatcher_forge$renderStringAtPosIndex);
}
@ModifyVariable(method = "renderString(Ljava/lang/String;IIIZ)I", at = @At("HEAD"), ordinal = 2, argsOnly = true)
private int modifyRenderString(int colorizeText) {
return ColorizeWorld.colorizeText(colorizeText);
}
@Inject(method = "getStringWidth(Ljava/lang/String;)I", at = @At("HEAD"), cancellable = true)
private void modifyGetStringWidth(String p_78256_1_, CallbackInfoReturnable<Integer> cir) {
if (getIsHD()) {
cir.setReturnValue((int) FontUtils.getStringWidthf((FontRenderer) (Object) this, p_78256_1_));
}
}
}
@@ -0,0 +1,33 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.hd;
import net.minecraft.client.renderer.texture.TextureClock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.hd.FancyDial;
@Mixin(TextureClock.class)
public abstract class MixinTextureClock {
@Inject(method = "<init>(Ljava/lang/String;)V", at = @At("RETURN"))
private void modifyConstructor(String iconName, CallbackInfo ci) {
FancyDial.setup((TextureClock) (Object) this);
}
@Inject(
method = "updateAnimation()V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/renderer/texture/TextureClock;field_94239_h:D",
ordinal = 1,
shift = At.Shift.AFTER),
cancellable = true)
private void modifyUpdateAnimation(CallbackInfo ci) {
if (FancyDial.update((TextureClock) (Object) this, false)) {
ci.cancel();
}
}
}
@@ -0,0 +1,49 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.hd;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureCompass;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.hd.FancyDial;
@Mixin(TextureCompass.class)
public abstract class MixinTextureCompass extends TextureAtlasSprite {
@Unique
private boolean mcpatcher_forge$fancyDialUpdateHasRan = false;
public MixinTextureCompass(String iconName) {
super(iconName);
}
@Inject(method = "<init>(Ljava/lang/String;)V", at = @At("RETURN"))
private void modifyConstructor(String iconName, CallbackInfo ci) {
FancyDial.setup((TextureCompass) (Object) this);
}
@Inject(
method = "updateCompass(Lnet/minecraft/world/World;DDDZZ)V",
at = @At(value = "JUMP", ordinal = 12, shift = At.Shift.BEFORE),
cancellable = true)
private void modifyUpdateCompass1(World world, double x, double y, double cameraDirection, boolean p_94241_8_,
boolean itemFrameRenderer, CallbackInfo ci) {
if (!this.mcpatcher_forge$fancyDialUpdateHasRan) {
if (FancyDial.update(this, itemFrameRenderer)) {
ci.cancel();
}
this.mcpatcher_forge$fancyDialUpdateHasRan = true;
}
}
@Inject(method = "updateCompass(Lnet/minecraft/world/World;DDDZZ)V", at = @At("RETURN"))
private void modifyUpdateCompass2(World world, double x, double y, double cameraDirection, boolean p_94241_8_,
boolean itemFrameRenderer, CallbackInfo ci) {
this.mcpatcher_forge$fancyDialUpdateHasRan = false;
}
}
@@ -0,0 +1,19 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.hd;
import net.minecraft.client.renderer.texture.TextureManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.hd.CustomAnimation;
@Mixin(TextureManager.class)
public abstract class MixinTextureManager {
@Inject(method = "tick()V", at = @At("RETURN"))
private void modifyTick(CallbackInfo ci) {
CustomAnimation.updateAll();
}
}
@@ -0,0 +1,25 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(EntityLivingBase.class)
public abstract class MixinEntityLivingBase {
@Inject(method = "writeEntityToNBT(Lnet/minecraft/nbt/NBTTagCompound;)V", at = @At("HEAD"))
private void modifyWriteEntityToNBT(NBTTagCompound tagCompound, CallbackInfo ci) {
MobRandomizer.ExtraInfo.writeToNBT((EntityLivingBase) (Object) this, tagCompound);
}
@Inject(method = "readEntityFromNBT(Lnet/minecraft/nbt/NBTTagCompound;)V", at = @At("HEAD"))
private void modifyReadEntityFromNBT(NBTTagCompound tagCompound, CallbackInfo ci) {
MobRandomizer.ExtraInfo.readFromNBT((EntityLivingBase) (Object) this, tagCompound);
}
}
@@ -0,0 +1,28 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(Render.class)
public abstract class MixinRender {
@Shadow
protected abstract ResourceLocation getEntityTexture(Entity entity);
@Redirect(
method = "bindEntityTexture(Lnet/minecraft/entity/Entity;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/Render;getEntityTexture(Lnet/minecraft/entity/Entity;)Lnet/minecraft/util/ResourceLocation;"))
private ResourceLocation modifyBindEntityTexture(Render instance, Entity entity) {
return MobRandomizer.randomTexture(entity, getEntityTexture(entity));
}
}
@@ -0,0 +1,31 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderEnderman;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(RenderEnderman.class)
public abstract class MixinRenderEnderman extends RenderLiving {
public MixinRenderEnderman(ModelBase p_i1262_1_, float p_i1262_2_) {
super(p_i1262_1_, p_i1262_2_);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/monster/EntityEnderman;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderEnderman;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyShouldRenderPass(RenderEnderman instance, ResourceLocation resourceLocation,
EntityEnderman entity) {
MobRandomizer.randomTexture(entity, resourceLocation);
}
}
@@ -0,0 +1,132 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderFish;
import net.minecraft.entity.projectile.EntityFishHook;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import com.prupe.mcpatcher.mob.LineRenderer;
@Mixin(RenderFish.class)
public abstract class MixinRenderFish extends Render {
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason multi-line code wrapped in if-statement
*/
@SuppressWarnings({ "DuplicatedCode", "ExtractMethodRecommender" })
@Overwrite
public void doRender(EntityFishHook entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.bindEntityTexture(entity);
Tessellator tessellator = Tessellator.instance;
byte b0 = 1;
byte b1 = 2;
float f2 = (float) (b0 * 8) / 128.0F;
float f3 = (float) (b0 * 8 + 8) / 128.0F;
float f4 = (float) (b1 * 8) / 128.0F;
float f5 = (float) (b1 * 8 + 8) / 128.0F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
tessellator.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
tessellator.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
tessellator.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
tessellator.draw();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
if (entity.field_146042_b != null) {
float f9 = entity.field_146042_b.getSwingProgress(p_76986_9_);
float f10 = MathHelper.sin(MathHelper.sqrt_float(f9) * (float) Math.PI);
Vec3 vec3 = Vec3.createVectorHelper(-0.5D, 0.03D, 0.8D);
vec3.rotateAroundX(
-(entity.field_146042_b.prevRotationPitch
+ (entity.field_146042_b.rotationPitch - entity.field_146042_b.prevRotationPitch) * p_76986_9_)
* (float) Math.PI
/ 180.0F);
vec3.rotateAroundY(
-(entity.field_146042_b.prevRotationYaw
+ (entity.field_146042_b.rotationYaw - entity.field_146042_b.prevRotationYaw) * p_76986_9_)
* (float) Math.PI
/ 180.0F);
vec3.rotateAroundY(f10 * 0.5F);
vec3.rotateAroundX(-f10 * 0.7F);
double d3 = entity.field_146042_b.prevPosX
+ (entity.field_146042_b.posX - entity.field_146042_b.prevPosX) * (double) p_76986_9_
+ vec3.xCoord;
double d4 = entity.field_146042_b.prevPosY
+ (entity.field_146042_b.posY - entity.field_146042_b.prevPosY) * (double) p_76986_9_
+ vec3.yCoord;
double d5 = entity.field_146042_b.prevPosZ
+ (entity.field_146042_b.posZ - entity.field_146042_b.prevPosZ) * (double) p_76986_9_
+ vec3.zCoord;
double d6 = entity.field_146042_b == Minecraft.getMinecraft().thePlayer ? 0.0D
: (double) entity.field_146042_b.getEyeHeight();
if (this.renderManager.options.thirdPersonView > 0
|| entity.field_146042_b != Minecraft.getMinecraft().thePlayer) {
float f11 = (entity.field_146042_b.prevRenderYawOffset
+ (entity.field_146042_b.renderYawOffset - entity.field_146042_b.prevRenderYawOffset) * p_76986_9_)
* (float) Math.PI
/ 180.0F;
double d7 = MathHelper.sin(f11);
double d9 = MathHelper.cos(f11);
d3 = entity.field_146042_b.prevPosX
+ (entity.field_146042_b.posX - entity.field_146042_b.prevPosX) * (double) p_76986_9_
- d9 * 0.35D
- d7 * 0.85D;
d4 = entity.field_146042_b.prevPosY + d6
+ (entity.field_146042_b.posY - entity.field_146042_b.prevPosY) * (double) p_76986_9_
- 0.45D;
d5 = entity.field_146042_b.prevPosZ
+ (entity.field_146042_b.posZ - entity.field_146042_b.prevPosZ) * (double) p_76986_9_
- d7 * 0.35D
+ d9 * 0.85D;
}
double d14 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double) p_76986_9_;
double d8 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double) p_76986_9_ + 0.25D;
double d10 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) p_76986_9_;
double d11 = (float) (d3 - d14);
double d12 = (float) (d4 - d8);
double d13 = (float) (d5 - d10);
// patch start (= if statement)
if (!LineRenderer.renderLine(0, x, y, z, d11, d12, d13)) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
tessellator.startDrawing(3);
tessellator.setColorOpaque_I(0);
byte b2 = 16;
for (int i = 0; i <= b2; ++i) {
float f12 = (float) i / (float) b2;
tessellator.addVertex(
x + d11 * (double) f12,
y + d12 * (double) (f12 * f12 + f12) * 0.5D + 0.25D,
z + d13 * (double) f12);
}
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
}
}
@@ -0,0 +1,133 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.EntityLiving;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import com.prupe.mcpatcher.mob.LineRenderer;
@Mixin(RenderLiving.class)
public abstract class MixinRenderLiving extends RendererLivingEntity {
public MixinRenderLiving(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Shadow
protected abstract double func_110828_a(double p_110828_1_, double p_110828_3_, double p_110828_5_);
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason Multi-line wrap into if-statement
*/
@SuppressWarnings("DuplicatedCode")
@Overwrite
protected void func_110827_b(EntityLiving entityLiving, double x, double y, double z, float n, float n2) {
Entity entity = entityLiving.getLeashedToEntity();
if (entity != null) {
y -= (1.6D - (double) entityLiving.height) * 0.5D;
Tessellator tessellator = Tessellator.instance;
double d3 = this.func_110828_a(entity.prevRotationYaw, entity.rotationYaw, n2 * 0.5F)
* 0.01745329238474369D;
double d4 = this.func_110828_a(entity.prevRotationPitch, entity.rotationPitch, n2 * 0.5F)
* 0.01745329238474369D;
double d5 = Math.cos(d3);
double d6 = Math.sin(d3);
double d7 = Math.sin(d4);
if (entity instanceof EntityHanging) {
d5 = 0.0D;
d6 = 0.0D;
d7 = -1.0D;
}
double d8 = Math.cos(d4);
double d9 = this.func_110828_a(entity.prevPosX, entity.posX, n2) - d5 * 0.7D - d6 * 0.5D * d8;
double d10 = this.func_110828_a(
entity.prevPosY + (double) entity.getEyeHeight() * 0.7D,
entity.posY + (double) entity.getEyeHeight() * 0.7D,
n2) - d7 * 0.5D - 0.25D;
double d11 = this.func_110828_a(entity.prevPosZ, entity.posZ, n2) - d6 * 0.7D + d5 * 0.5D * d8;
double d12 = this.func_110828_a(entityLiving.prevRenderYawOffset, entityLiving.renderYawOffset, n2)
* 0.01745329238474369D + (Math.PI / 2D);
d5 = Math.cos(d12) * (double) entityLiving.width * 0.4D;
d6 = Math.sin(d12) * (double) entityLiving.width * 0.4D;
double d13 = this.func_110828_a(entityLiving.prevPosX, entityLiving.posX, n2) + d5;
double d14 = this.func_110828_a(entityLiving.prevPosY, entityLiving.posY, n2);
double d15 = this.func_110828_a(entityLiving.prevPosZ, entityLiving.posZ, n2) + d6;
x += d5;
z += d6;
double d16 = (float) (d9 - d13);
double d17 = (float) (d10 - d14);
double d18 = (float) (d11 - d15);
// patch start (only change is if-wrapper)
if (!LineRenderer.renderLine(1, x, y, z, d16, d17, d18)) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
tessellator.startDrawing(5);
int i;
float f2;
for (i = 0; i <= 24; ++i) {
if (i % 2 == 0) {
tessellator.setColorRGBA_F(0.5F, 0.4F, 0.3F, 1.0F);
} else {
tessellator.setColorRGBA_F(0.35F, 0.28F, 0.21000001F, 1.0F);
}
f2 = (float) i / 24.0F;
tessellator.addVertex(
x + d16 * (double) f2 + 0.0D,
y + d17 * (double) (f2 * f2 + f2) * 0.5D + (double) ((24.0F - (float) i) / 18.0F + 0.125F),
z + d18 * (double) f2);
tessellator.addVertex(
x + d16 * (double) f2 + 0.025D,
y + d17 * (double) (f2 * f2 + f2) * 0.5D
+ (double) ((24.0F - (float) i) / 18.0F + 0.125F)
+ 0.025D,
z + d18 * (double) f2);
}
tessellator.draw();
tessellator.startDrawing(5);
for (i = 0; i <= 24; ++i) {
if (i % 2 == 0) {
tessellator.setColorRGBA_F(0.5F, 0.4F, 0.3F, 1.0F);
} else {
tessellator.setColorRGBA_F(0.35F, 0.28F, 0.21000001F, 1.0F);
}
f2 = (float) i / 24.0F;
tessellator.addVertex(
x + d16 * (double) f2 + 0.0D,
y + d17 * (double) (f2 * f2 + f2) * 0.5D
+ (double) ((24.0F - (float) i) / 18.0F + 0.125F)
+ 0.025D,
z + d18 * (double) f2);
tessellator.addVertex(
x + d16 * (double) f2 + 0.025D,
y + d17 * (double) (f2 * f2 + f2) * 0.5D + (double) ((24.0F - (float) i) / 18.0F + 0.125F),
z + d18 * (double) f2 + 0.025D);
}
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
// patch end
GL11.glEnable(GL11.GL_CULL_FACE);
}
}
}
@@ -0,0 +1,50 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderMooshroom;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.mob.MobOverlay;
@Mixin(RenderMooshroom.class)
public abstract class MixinRenderMooshroom extends RenderLiving {
public MixinRenderMooshroom(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Inject(method = "renderEquippedItems(Lnet/minecraft/entity/passive/EntityMooshroom;F)V", at = @At("RETURN"))
private void modifyRenderEquippedItems1(EntityMooshroom entity, float p_77029_2_, CallbackInfo ci) {
MobOverlay.finishMooshroom();
}
@Redirect(
method = "renderEquippedItems(Lnet/minecraft/entity/passive/EntityMooshroom;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderMooshroom;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyRenderEquippedItems2(RenderMooshroom renderLiving, ResourceLocation resourceLocation,
EntityMooshroom entity, float p_77029_2_) {
this.bindTexture(MobOverlay.setupMooshroom(entity, resourceLocation));
}
@WrapWithCondition(
method = "renderEquippedItems(Lnet/minecraft/entity/passive/EntityMooshroom;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;renderBlockAsItem(Lnet/minecraft/block/Block;IF)V"))
private boolean modifyRenderEquippedItems3(RenderBlocks renderBlock, Block block, int i, float f) {
return !MobOverlay.renderMooshroomOverlay(0.0);
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderSheep;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(RenderSheep.class)
public abstract class MixinRenderSheep extends RenderLiving {
public MixinRenderSheep(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/passive/EntitySheep;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderSheep;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyShouldRenderPass(RenderSheep instance, ResourceLocation resourceLocation, EntitySheep entity) {
this.bindTexture(MobRandomizer.randomTexture(entity, resourceLocation));
}
}
@@ -0,0 +1,26 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.RenderSnowMan;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.mob.MobOverlay;
@Mixin(RenderSnowMan.class)
public abstract class MixinRenderSnowMan {
@WrapWithCondition(
method = "renderEquippedItems(Lnet/minecraft/entity/monster/EntitySnowman;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;I)V"))
private boolean modifyRenderEquippedItems(ItemRenderer renderer, EntityLivingBase entity, ItemStack itemStack,
int i) {
return !MobOverlay.renderSnowmanOverlay(entity);
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderSpider;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(RenderSpider.class)
public abstract class MixinRenderSpider extends RenderLiving {
public MixinRenderSpider(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/monster/EntitySpider;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderSpider;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void modifyShouldRenderPass(RenderSpider instance, ResourceLocation resourceLocation, EntitySpider entity) {
this.bindTexture(MobRandomizer.randomTexture(entity, resourceLocation));
}
}
@@ -0,0 +1,31 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderWolf;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.mob.MobRandomizer;
@Mixin(RenderWolf.class)
public abstract class MixinRenderWolf extends RenderLiving {
public MixinRenderWolf(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Redirect(
method = "shouldRenderPass(Lnet/minecraft/entity/passive/EntityWolf;IF)I",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderWolf;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
ordinal = 1))
private void modifyShouldRenderPass1(RenderWolf instance, ResourceLocation resourceLocation, EntityWolf entity) {
this.bindTexture(MobRandomizer.randomTexture(entity, resourceLocation));
}
}
@@ -0,0 +1,62 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.renderpass;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.EntityLivingBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.renderpass.RenderPass;
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer {
@Shadow
private Minecraft mc;
@Shadow
protected abstract void renderRainSnow(float p_78474_1_);
@WrapWithCondition(
method = "renderWorld(FJ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glShadeModel(I)V", remap = false, ordinal = 0))
private boolean modifyRenderWorld1(int i) {
return RenderPass.setAmbientOcclusion(this.mc.gameSettings.ambientOcclusion != 0);
}
@WrapWithCondition(
method = "renderWorld(FJ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glShadeModel(I)V", remap = false, ordinal = 2))
private boolean modifyRenderWorld2(int i) {
return RenderPass.setAmbientOcclusion(this.mc.gameSettings.ambientOcclusion != 0);
}
@Redirect(
method = "renderWorld(FJ)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderGlobal;sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
ordinal = 0))
private int modifyRenderWorld3(RenderGlobal instance, EntityLivingBase entitylivingbase, int k, double i1) {
int returnValue = instance.sortAndRender(entitylivingbase, k, i1);
instance.sortAndRender(entitylivingbase, 4, i1);
return returnValue;
}
@Inject(
method = "renderWorld(FJ)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDepthMask(Z)V", ordinal = 3, remap = false))
private void modifyRenderWorld4(float partialTickTime, long p_78471_2_, CallbackInfo ci) {
this.mc.renderGlobal.sortAndRender(this.mc.renderViewEntity, 5, partialTickTime);
this.renderRainSnow(partialTickTime);
}
}
@@ -0,0 +1,38 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.renderpass;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.renderpass.RenderPass;
/*
* For readability changes to the biggest methods get their own classes
*/
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@Shadow
public IBlockAccess blockAccess;
@Redirect(
method = { "renderBlockBed(Lnet/minecraft/block/Block;III)Z",
"renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderBlockCactusImpl(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderBlockLiquid(Lnet/minecraft/block/Block;III)Z" },
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/Block;shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;IIII)Z"))
private boolean redirectShouldSideBeRendered(Block block, IBlockAccess worldIn, int x, int y, int z, int side) {
return RenderPass.shouldSideBeRendered(block, worldIn, x, y, z, side);
}
}
@@ -0,0 +1,83 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.renderpass;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.IWorldAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.renderpass.RenderPass;
import com.prupe.mcpatcher.renderpass.RenderPassMap;
@Mixin(RenderGlobal.class)
public abstract class MixinRenderGlobal implements IWorldAccess {
@Redirect(
method = "<init>(Lnet/minecraft/client/Minecraft;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GLAllocation;generateDisplayLists(I)I",
ordinal = 0))
private int modifyRenderGlobal(int n) {
return GLAllocation.generateDisplayLists(n / 3 * 5);
}
@ModifyVariable(
method = "loadRenderers()V",
at = @At(
value = "INVOKE",
target = "Ljava/util/List;add(Ljava/lang/Object;)Z",
remap = false,
shift = At.Shift.AFTER),
ordinal = 1)
private int modifyLoadRenderers(int input) {
return input + 2;
}
// Order important here!
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(value = "HEAD"),
cancellable = true)
private void modifySortAndRender1(EntityLivingBase entity, int map18To17, double partialTickTime,
CallbackInfoReturnable<Integer> cir) {
if (!RenderPass.preRenderPass(RenderPassMap.map17To18(map18To17))) {
cir.setReturnValue(RenderPass.postRenderPass(0));
}
}
@ModifyVariable(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(value = "HEAD"),
ordinal = 0,
argsOnly = true)
private int modifySortAndRender2(int map18To17) {
return RenderPassMap.map18To17(map18To17);
}
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(value = "RETURN"),
cancellable = true)
private void modifySortAndRender3(EntityLivingBase entity, int renderPass, double partialTickTime,
CallbackInfoReturnable<Integer> cir) {
cir.setReturnValue(RenderPass.postRenderPass(cir.getReturnValue()));
}
@Redirect(
method = "renderAllRenderLists(ID)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;enableLightmap(D)V"))
private void modifyRenderAllRenderLists(EntityRenderer instance, double partialTick) {
RenderPass.enableDisableLightmap(instance, partialTick);
}
}
@@ -0,0 +1,146 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.renderpass;
import java.util.HashSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.prupe.mcpatcher.renderpass.RenderPass;
/**
* Note: class is also modified by WorldRendererTransformer
*/
@Mixin(WorldRenderer.class)
public abstract class MixinWorldRenderer {
@Shadow
public boolean[] skipRenderPass;
@Shadow
public boolean needsUpdate;
@Shadow
public boolean isInitialized;
@Shadow
public abstract void setPosition(int x, int y, int z);
@Inject(method = "<init>(Lnet/minecraft/world/World;Ljava/util/List;IIII)V", at = @At("RETURN"))
private void modifyWorldRendererConstructor1(World world, List<TileEntity> tileEntities, int x, int y, int z,
int glRenderList, CallbackInfo ci) {
skipRenderPass = new boolean[4];
this.setPosition(x, y, z);
this.needsUpdate = false;
}
/**
* Cancel first call as skipRenderPass isn't ready yet
*/
@Redirect(
method = "<init>(Lnet/minecraft/world/World;Ljava/util/List;IIII)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;setPosition(III)V"))
private void modifyWorldRendererConstructor2(WorldRenderer renderer, int x, int y, int z) {}
@ModifyArg(
method = "setPosition(III)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glNewList(II)V", remap = false),
index = 0)
private int modifySetPosition(int list) {
return list + 2;
}
@ModifyConstant(
method = "updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V",
constant = @Constant(intValue = 2))
private int adjustRenderpassSizeUpdateRenderer(int constant) {
return 4;
}
@Inject(method = "updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V", at = @At("RETURN"))
private void finishRenderPassUpdateRenderer(EntityLivingBase entityLivingBase, CallbackInfo ci) {
RenderPass.finish();
}
// Dangerous territory with this amount of locals
// Idea doesn't like it, but it does work :shrugs:
@SuppressWarnings({ "InvalidInjectorMethodSignature", "rawtypes" })
@Inject(
method = "updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V",
at = @At(value = "JUMP", ordinal = 4, shift = At.Shift.AFTER),
locals = LocalCapture.CAPTURE_FAILHARD)
private void injectRenderPassStartUpdateRenderer(EntityLivingBase entity, CallbackInfo ci, int i, int j, int k,
int l, int i1, int j1, HashSet hashset, Minecraft minecraft, EntityLivingBase entity1, int l1, int i2, int j2,
byte b0, ChunkCache chunkcache, RenderBlocks renderblocks, int k2) {
RenderPass.start(k2);
}
@Redirect(
method = "updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;canRenderInPass(I)Z", remap = false))
private boolean redirectCanRenderInThisPassUpdateRenderer(Block block, int pass) {
return RenderPass.canRenderInThisPass(block.getRenderBlockPass() == pass);
}
/*
* spotless:off
In the decompilation the flag2 checked is reversed. However, this crashes the game when entering a world so more
investigation is necessary
if (flag2)
{
this.postRenderBlocks(k2, p_147892_1_);
}
else
{
flag1 = false;
}
this is achieved by
@ModifyVariable(method = "updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V", at = @At(value = "LOAD", ordinal = 1), ordinal = 2)
private boolean reverseBool1(boolean input) {
return !input;
}
spotless:on
*/
@ModifyConstant(method = "setDontDraw()V", constant = @Constant(intValue = 2))
private int modifySetDontDraw(int length) {
// Initial draw to setPosition runs before skipRenderPass length is changed, if 4 is used it will throw an out
// of bounds
return this.skipRenderPass.length;
}
@ModifyArg(
method = "callOcclusionQueryList()V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", remap = false),
index = 0)
private int modifyCallOcclusionQueryList(int list) {
return list + 2;
}
/**
* @author Mist475 (adapted from Paul Rupe)
* @reason entire check is different except null check
*/
@Overwrite
public boolean skipAllRenderPasses() {
return this.isInitialized && RenderPass.skipAllRenderPasses(this.skipRenderPass);
}
}
@@ -0,0 +1,88 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.sky;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.prupe.mcpatcher.sky.FireworksHelper;
@SuppressWarnings({ "rawtypes" })
@Mixin(EffectRenderer.class)
public abstract class MixinEffectRenderer {
@Shadow
private List[] fxLayers;
@Unique
private int mcpatcher_forge$renderParticlesIndex;
@Inject(
method = "<init>(Lnet/minecraft/world/World;Lnet/minecraft/client/renderer/texture/TextureManager;)V",
at = @At("RETURN"))
private void modifyConstructor(World world, TextureManager manager, CallbackInfo ci) {
this.fxLayers = new List[5];
for (int i = 0; i < this.fxLayers.length; ++i) {
this.fxLayers[i] = new ArrayList();
}
}
@Redirect(
method = "addEffect(Lnet/minecraft/client/particle/EntityFX;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/EntityFX;getFXLayer()I"))
private int modifyAddEffect(EntityFX instance) {
return FireworksHelper.getFXLayer(instance);
}
@ModifyConstant(
method = { "updateEffects()V", "clearEffects(Lnet/minecraft/world/World;)V" },
constant = @Constant(intValue = 4))
private int modifyListSize(int constant) {
return 5;
}
@ModifyConstant(method = "renderParticles(Lnet/minecraft/entity/Entity;F)V", constant = @Constant(intValue = 3))
private int modifyRenderParticles1(int constant) {
return 5;
}
@Inject(
method = "renderParticles(Lnet/minecraft/entity/Entity;F)V",
at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z"),
locals = LocalCapture.CAPTURE_FAILHARD)
private void modifyRenderParticles2(Entity player, float partialTickTime, CallbackInfo ci, float f1, float f2,
float f3, float f4, float f5, int k, int i) {
this.mcpatcher_forge$renderParticlesIndex = i;
}
@Redirect(
method = "renderParticles(Lnet/minecraft/entity/Entity;F)V",
at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z"))
private boolean modifyRenderParticles3(List layer) {
return FireworksHelper.skipThisLayer(
this.fxLayers[mcpatcher_forge$renderParticlesIndex].isEmpty(),
this.mcpatcher_forge$renderParticlesIndex);
}
@Redirect(
method = "renderParticles(Lnet/minecraft/entity/Entity;F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glBlendFunc(II)V", remap = false))
private void modifyRenderParticles4(int sfactor, int dfactor) {
FireworksHelper.setParticleBlendMethod(this.mcpatcher_forge$renderParticlesIndex, 0, true);
}
}
@@ -0,0 +1,78 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.sky;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.sky.SkyRenderer;
@Mixin(RenderGlobal.class)
public abstract class MixinRenderGlobal {
@Shadow
public WorldClient theWorld;
@Inject(method = "renderSky(F)V", at = @At("HEAD"))
private void modifyRenderSky1(float partialTick, CallbackInfo ci) {
SkyRenderer.setup(this.theWorld, partialTick, this.theWorld.getCelestialAngle(partialTick));
}
@Inject(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glRotatef(FFFF)V", remap = false, ordinal = 9))
private void modifyRenderSky3(float partialTick, CallbackInfo ci) {
SkyRenderer.renderAll();
}
// Ordinal 0 shouldn't be redirected unfortunately
@ModifyArg(
method = "renderSky(F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
ordinal = 1))
private ResourceLocation modifyRenderSky4(ResourceLocation location) {
return SkyRenderer.setupCelestialObject(location);
}
@ModifyArg(
method = "renderSky(F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
ordinal = 2))
private ResourceLocation modifyRenderSky5(ResourceLocation location) {
return SkyRenderer.setupCelestialObject(location);
}
@WrapWithCondition(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glColor4f(FFFF)V", remap = false, ordinal = 1))
private boolean modifyRenderSky6(float f1, float f2, float f3, float f4) {
return !SkyRenderer.active;
}
@WrapWithCondition(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", remap = false, ordinal = 1))
private boolean modifyRenderSky7(int i) {
return !SkyRenderer.active;
}
@ModifyArg(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V", remap = false, ordinal = 2),
index = 1)
private float modifyRenderSky8(float input) {
// -((d0 - 16.0D)) turned into -((d0 - SkyRenderer.horizonHeight))
return (float) (input - 16f + SkyRenderer.horizonHeight);
}
}
@@ -5,12 +5,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = RenderItem.class)
public abstract class MixinRenderItem {
@@ -61,18 +58,6 @@ public abstract class MixinRenderItem {
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
}
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return stack.hasEffect(pass) && (boolean)Settings.MODE_GLINT_WORLD.option.getStore();
}
@Shadow public float zLevel;
}
@@ -0,0 +1,25 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.glint;
import jss.notfine.core.Settings;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// Separated for compat with MCPF
@Mixin(RenderItem.class)
public class MixinRenderItemGlint {
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return stack.hasEffect(pass) && (boolean) Settings.MODE_GLINT_WORLD.option.getStore();
}
}
@@ -0,0 +1,25 @@
package com.gtnewhorizons.angelica.mixins.early.notfine_mcpf_compat;
import com.prupe.mcpatcher.cit.CITUtils;
import jss.notfine.core.Settings;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ItemRenderer.class)
public class MixinItemRenderer {
@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return (boolean) Settings.MODE_GLINT_WORLD.option.getStore() && stack.hasEffect(pass) && !CITUtils.renderEnchantmentHeld(stack, pass);
}
}
@@ -0,0 +1,26 @@
package com.gtnewhorizons.angelica.mixins.early.notfine_mcpf_compat;
import com.prupe.mcpatcher.cit.CITUtils;
import jss.notfine.core.Settings;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RenderItem.class)
public class MixinRenderItem {
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return stack.hasEffect(pass) && !CITUtils.renderEnchantmentDropped(stack) && (boolean) Settings.MODE_GLINT_WORLD.option.getStore();
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.sodium.startup;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import net.coderbot.iris.Iris;
@@ -19,7 +20,7 @@ public class MixinInitDebug {
}
// Temp -- move this into common debug code
Iris.identifyCapabilities();
Iris.setDebug(true);
Iris.setDebug(AngelicaMod.lwjglDebug);
}
}
@@ -0,0 +1,7 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
public interface AbstractTextureExpansion {
void unloadGLTexture();
}
@@ -0,0 +1,8 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
import net.minecraft.client.particle.EntityAuraFX;
public interface EntityAuraFXExpansion {
EntityAuraFX colorize();
}
@@ -0,0 +1,26 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
import net.minecraft.util.ResourceLocation;
public interface FontRendererExpansion {
float[] getCharWidthf();
void setCharWidthf(float[] widthf);
ResourceLocation getDefaultFont();
void setDefaultFont(ResourceLocation defaultFont);
ResourceLocation getHDFont();
void setHDFont(ResourceLocation hdFont);
boolean getIsHD();
void setIsHD(boolean isHD);
float getFontAdj();
void setFontAdj(float fontAdj);
}
@@ -0,0 +1,8 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
public interface MapColorExpansion {
int getOriginalColorValue();
void setOriginalColorValue(int value);
}
Loaded 100 of 238 files, more files were not shown because too many files have changed in this diff. Show more