Added GLSL Mod block ID override feature
This commit is contained in:
@@ -22,7 +22,7 @@ minecraft {
|
|||||||
|
|
||||||
jar.baseName = 'BetterFoliage-1.7.2'
|
jar.baseName = 'BetterFoliage-1.7.2'
|
||||||
group = 'com.github.octarine-noise'
|
group = 'com.github.octarine-noise'
|
||||||
version='0.9.2b'
|
version='0.9.3b'
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|||||||
@@ -87,6 +87,14 @@ public class BetterFoliageClient implements ILeafTextureRecognizer {
|
|||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getGLSLBlockIdOverride(int original, Block block) {
|
||||||
|
if (leaves.matchesID(original & 0xFFFF))
|
||||||
|
return Block.blockRegistry.getIDForObject(Blocks.leaves) & 0xFFFF | block.getRenderType() << 16;
|
||||||
|
if (crops.matchesID(original & 0xFFFF))
|
||||||
|
return Block.blockRegistry.getIDForObject(Blocks.tallgrass) & 0xFFFF | block.getRenderType() << 16;
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerRenderer(IRenderBlockDecorator decorator) {
|
public static void registerRenderer(IRenderBlockDecorator decorator) {
|
||||||
int renderId = RenderingRegistry.getNextAvailableRenderId();
|
int renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||||
decorators.put(renderId, decorator);
|
decorators.put(renderId, decorator);
|
||||||
|
|||||||
@@ -54,4 +54,18 @@ public class DeobfNames {
|
|||||||
|
|
||||||
/** SRG name of TextureMap.mapRegisteredSprites */
|
/** SRG name of TextureMap.mapRegisteredSprites */
|
||||||
public static final String TM_MRS_SRG = "field_110574_e";
|
public static final String TM_MRS_SRG = "field_110574_e";
|
||||||
|
|
||||||
|
/** MCP signature of Shaders.pushEntity() */
|
||||||
|
public static final String SHADERS_PE_SIG_MCP = "(Lnet/minecraft/client/renderer/RenderBlocks;Lnet/minecraft/block/Block;III)V";
|
||||||
|
|
||||||
|
/** Obfuscated signature of Shaders.pushEntity() */
|
||||||
|
public static final String SHADERS_PE_SIG_OBF = "(Lble;Lahu;III)V";
|
||||||
|
|
||||||
|
/** MCP signature of BetterFoliageClient.getGLSLBlockIdOverride() */
|
||||||
|
public static final String BFC_GLSLID_SIG_MCP = "(ILnet/minecraft/block/Block;)I";
|
||||||
|
|
||||||
|
/** Obfuscated signature of BetterFoliageClient.getGLSLBlockIdOverride() */
|
||||||
|
public static final String BFC_GLSLID_SIG_OBF = "(ILahu;)I";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,4 +32,17 @@ public class BetterFoliageTransformer extends EZTransformerBase {
|
|||||||
new VarInsnNode(Opcodes.ISTORE, 5)
|
new VarInsnNode(Opcodes.ISTORE, 5)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MethodTransform(className="shadersmodcore.client.Shaders",
|
||||||
|
obf=@MethodMatch(name="pushEntity", signature=DeobfNames.SHADERS_PE_SIG_OBF),
|
||||||
|
deobf=@MethodMatch(name="pushEntity", signature=DeobfNames.SHADERS_PE_SIG_MCP),
|
||||||
|
log="Applying Shaders.pushEntity() block id ovverride")
|
||||||
|
public void handleGLSLBlockIDOverride(MethodNode method, boolean obf) {
|
||||||
|
AbstractInsnNode arrayStore = findNext(method.instructions.getFirst(), matchOpcode(Opcodes.IASTORE));
|
||||||
|
insertAfter(method.instructions, arrayStore.getPrevious(),
|
||||||
|
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||||
|
obf ? new MethodInsnNode(Opcodes.INVOKESTATIC, "mods/betterfoliage/client/BetterFoliageClient", "getGLSLBlockIdOverride", DeobfNames.BFC_GLSLID_SIG_OBF) :
|
||||||
|
new MethodInsnNode(Opcodes.INVOKESTATIC, "mods/betterfoliage/client/BetterFoliageClient", "getGLSLBlockIdOverride", DeobfNames.BFC_GLSLID_SIG_MCP)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user