From 8d8dd537176dfea0b1e4fe06f94afb1a5d191842 Mon Sep 17 00:00:00 2001 From: Mist475 Date: Mon, 18 Dec 2023 14:23:05 +0100 Subject: [PATCH] refactor mixins into toggleable modules --- .../com/prupe/mcpatcher/cc/ColorizeBlock.java | 4 +- .../mal/block/RenderBlocksUtils.java | 2 +- .../mcpatcherforge/asm/AsmTransformers.java | 9 +- .../mist475/mcpatcherforge/mixins/Mixins.java | 235 +++-- .../MixinAbstractTexture.java | 2 +- .../mixins/early/base/MixinBlockGrass.java | 33 + .../{block => base}/MixinBlockMycelium.java | 2 +- .../{client => base}/MixinMinecraft.java | 19 +- .../MixinSimpleReloadableResourceManager.java | 2 +- .../MixinTextureAtlasSprite.java | 2 +- .../early/{ => cc}/block/MixinBlock.java | 2 +- .../{ => cc}/block/MixinBlockDoublePlant.java | 2 +- .../early/{ => cc}/block/MixinBlockGrass.java | 20 +- .../{ => cc}/block/MixinBlockLeaves.java | 2 +- .../{ => cc}/block/MixinBlockLilyPad.java | 2 +- .../{ => cc}/block/MixinBlockLiquid.java | 2 +- .../{ => cc}/block/MixinBlockOldLeaf.java | 2 +- .../block/MixinBlockRedstoneWire.java | 2 +- .../early/{ => cc}/block/MixinBlockReed.java | 2 +- .../early/{ => cc}/block/MixinBlockStem.java | 2 +- .../{ => cc}/block/MixinBlockTallGrass.java | 2 +- .../early/{ => cc}/block/MixinBlockVine.java | 2 +- .../block/material/MixinMapColor.java | 2 +- .../client/particle/MixinEntityAuraFX.java | 2 +- .../client/particle/MixinEntityBubbleFX.java | 2 +- .../particle/MixinEntityDropParticleFX.java | 3 +- .../client/particle/MixinEntityPortalFX.java | 2 +- .../client/particle/MixinEntityRainFX.java | 2 +- .../client/particle/MixinEntityRedDustFX.java | 2 +- .../client/particle/MixinEntitySplashFX.java | 2 +- .../client/particle/MixinEntitySuspendFX.java | 2 +- .../client/renderer/MixinEntityRenderer.java | 60 +- .../cc/client/renderer/MixinItemRenderer.java | 29 + .../cc/client/renderer/MixinRenderBlocks.java | 800 ++++++++++++++++++ .../cc/client/renderer/MixinRenderGlobal.java | 29 + .../renderer/entity/MixinRenderWolf.java | 27 + .../renderer/entity/MixinRenderXPOrb.java | 2 +- .../MixinTileEntitySignRenderer.java | 2 +- .../{ => cc}/entity/MixinEntityList.java | 2 +- .../early/{ => cc}/item/MixinItemArmor.java | 2 +- .../early/{ => cc}/item/MixinItemBlock.java | 2 +- .../{ => cc}/item/MixinItemMonsterPlacer.java | 2 +- .../item/crafting/MixinRecipesArmorDyes.java | 2 +- .../early/{ => cc}/potion/MixinPotion.java | 2 +- .../{ => cc}/potion/MixinPotionHelper.java | 2 +- .../early/{ => cc}/world/MixinWorld.java | 2 +- .../{ => cc}/world/MixinWorldProvider.java | 2 +- .../{ => cc}/world/MixinWorldProviderEnd.java | 4 +- .../world/MixinWorldProviderHell.java | 4 +- .../client/renderer/MixinItemRenderer.java | 18 +- .../renderer/entity/MixinRenderBiped.java | 2 +- .../entity/MixinRenderEntityLiving.java | 2 +- .../renderer/entity/MixinRenderItem.java | 2 +- .../renderer/entity/MixinRenderPlayer.java | 2 +- .../renderer/entity/MixinRenderSnowball.java | 2 +- .../early/{ => cit}/item/MixinItem.java | 2 +- .../{ => cit}/nbt/MixinNBTTagCompound.java | 2 +- .../early/{ => cit}/nbt/MixinNBTTagList.java | 2 +- .../client/renderer/MixinRenderGlobal.java | 163 ---- .../MixinRenderBlocksRenderBlockLiquid.java | 522 ------------ .../MixinRenderBlocks.java | 437 +--------- .../early/ctm_cc/MixinRenderBlocks.java | 115 +++ .../texture => ctm_cc}/MixinTextureMap.java | 2 +- .../{client/gui => hd}/MixinFontRenderer.java | 2 +- .../texture => hd}/MixinTextureClock.java | 2 +- .../texture => hd}/MixinTextureCompass.java | 2 +- .../texture => hd}/MixinTextureManager.java | 2 +- .../MixinEntityLivingBase.java | 2 +- .../renderer/entity => mob}/MixinRender.java | 2 +- .../entity => mob}/MixinRenderEnderman.java | 2 +- .../entity => mob}/MixinRenderFish.java | 3 +- .../entity => mob}/MixinRenderLiving.java | 2 +- .../entity => mob}/MixinRenderMooshroom.java | 2 +- .../entity => mob}/MixinRenderSheep.java | 2 +- .../entity => mob}/MixinRenderSnowMan.java | 2 +- .../entity => mob}/MixinRenderSpider.java | 2 +- .../entity => mob}/MixinRenderWolf.java | 16 +- .../early/renderpass/MixinEntityRenderer.java | 60 ++ .../early/renderpass/MixinRenderBlocks.java | 36 + .../early/renderpass/MixinRenderGlobal.java | 81 ++ .../MixinWorldRenderer.java | 2 +- .../particle => sky}/MixinEffectRenderer.java | 2 +- .../mixins/early/sky/MixinRenderGlobal.java | 78 ++ 83 files changed, 1562 insertions(+), 1359 deletions(-) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => base}/MixinAbstractTexture.java (89%) create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockGrass.java rename src/main/java/mist475/mcpatcherforge/mixins/early/{block => base}/MixinBlockMycelium.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client => base}/MixinMinecraft.java (87%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/resources => base}/MixinSimpleReloadableResourceManager.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => base}/MixinTextureAtlasSprite.java (90%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlock.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockDoublePlant.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockGrass.java (65%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockLeaves.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockLilyPad.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockLiquid.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockOldLeaf.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockRedstoneWire.java (97%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockReed.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockStem.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockTallGrass.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/MixinBlockVine.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/block/material/MixinMapColor.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityAuraFX.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityBubbleFX.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityDropParticleFX.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityPortalFX.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityRainFX.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntityRedDustFX.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntitySplashFX.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/particle/MixinEntitySuspendFX.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/renderer/MixinEntityRenderer.java (57%) create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinItemRenderer.java create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderBlocks.java create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderGlobal.java create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderWolf.java rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/renderer/entity/MixinRenderXPOrb.java (92%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/client/renderer/tileentity/MixinTileEntitySignRenderer.java (90%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/entity/MixinEntityList.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/item/MixinItemArmor.java (90%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/item/MixinItemBlock.java (92%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/item/MixinItemMonsterPlacer.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/item/crafting/MixinRecipesArmorDyes.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/potion/MixinPotion.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/potion/MixinPotionHelper.java (91%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/world/MixinWorld.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/world/MixinWorldProvider.java (97%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/world/MixinWorldProviderEnd.java (87%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cc}/world/MixinWorldProviderHell.java (87%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/MixinItemRenderer.java (62%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/entity/MixinRenderBiped.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/entity/MixinRenderEntityLiving.java (99%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/entity/MixinRenderItem.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/entity/MixinRenderPlayer.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/client/renderer/entity/MixinRenderSnowball.java (91%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/item/MixinItem.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/nbt/MixinNBTTagCompound.java (91%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{ => cit}/nbt/MixinNBTTagList.java (89%) delete mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinRenderGlobal.java delete mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocksRenderBlockLiquid.java rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/renderblocks => ctm}/MixinRenderBlocks.java (76%) create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinRenderBlocks.java rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => ctm_cc}/MixinTextureMap.java (97%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/gui => hd}/MixinFontRenderer.java (99%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => hd}/MixinTextureClock.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => hd}/MixinTextureCompass.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/texture => hd}/MixinTextureManager.java (88%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{entity => mob}/MixinEntityLivingBase.java (95%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRender.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderEnderman.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderFish.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderLiving.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderMooshroom.java (96%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderSheep.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderSnowMan.java (93%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderSpider.java (94%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer/entity => mob}/MixinRenderWolf.java (55%) create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinEntityRenderer.java create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderBlocks.java create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderGlobal.java rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/renderer => renderpass}/MixinWorldRenderer.java (98%) rename src/main/java/mist475/mcpatcherforge/mixins/early/{client/particle => sky}/MixinEffectRenderer.java (98%) create mode 100644 src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinRenderGlobal.java diff --git a/src/main/java/com/prupe/mcpatcher/cc/ColorizeBlock.java b/src/main/java/com/prupe/mcpatcher/cc/ColorizeBlock.java index 98f2fe4..5517900 100644 --- a/src/main/java/com/prupe/mcpatcher/cc/ColorizeBlock.java +++ b/src/main/java/com/prupe/mcpatcher/cc/ColorizeBlock.java @@ -352,10 +352,10 @@ public static boolean colorizeBlock(Block block) { public static boolean colorizeBlock(Block block, int metadata) { IColorMap colorMap = findColorMap(block, metadata); if (colorMap == null) { - RenderBlocksUtils.setupColorMultiplier(block, metadata, false); + RenderBlocksUtils.setupColorMultiplier(block, false); return false; } else { - RenderBlocksUtils.setupColorMultiplier(block, metadata, true); + RenderBlocksUtils.setupColorMultiplier(block, true); blockColor = colorMap.getColorMultiplier(); return true; } diff --git a/src/main/java/com/prupe/mcpatcher/mal/block/RenderBlocksUtils.java b/src/main/java/com/prupe/mcpatcher/mal/block/RenderBlocksUtils.java index 0e134ff..78c01e5 100644 --- a/src/main/java/com/prupe/mcpatcher/mal/block/RenderBlocksUtils.java +++ b/src/main/java/com/prupe/mcpatcher/mal/block/RenderBlocksUtils.java @@ -80,7 +80,7 @@ public static void setupColorMultiplier(Block block, IBlockAccess blockAccess, i } } - public static void setupColorMultiplier(Block block, int metadata, boolean useColor) { + public static void setupColorMultiplier(Block block, boolean useColor) { if (block == grassBlock || !useColor) { colorMultiplierType[0] = NONCOLOR; colorMultiplierType[2] = NONCOLOR; diff --git a/src/main/java/mist475/mcpatcherforge/asm/AsmTransformers.java b/src/main/java/mist475/mcpatcherforge/asm/AsmTransformers.java index 0e1141f..c45e1b8 100644 --- a/src/main/java/mist475/mcpatcherforge/asm/AsmTransformers.java +++ b/src/main/java/mist475/mcpatcherforge/asm/AsmTransformers.java @@ -5,6 +5,9 @@ import java.util.List; import java.util.function.Supplier; +import com.prupe.mcpatcher.Config; +import com.prupe.mcpatcher.MCPatcherUtils; + import cpw.mods.fml.relauncher.FMLLaunchHandler; import mist475.mcpatcherforge.core.MCPatcherForgeCore; @@ -13,9 +16,9 @@ */ public enum AsmTransformers { - RENDERBLOCKS("RenderBlocks transformer", () -> true, Side.CLIENT, - "mist475.mcpatcherforge.asm.RenderBlocksTransformer"), - WORLDRENDERER("RenderBlocks transformer", () -> true, Side.CLIENT, + RENDERBLOCKS("RenderBlocks transformer", () -> Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true), + Side.CLIENT, "mist475.mcpatcherforge.asm.RenderBlocksTransformer"), + WORLDRENDERER("WorldRenderer transformer", () -> true, Side.CLIENT, "mist475.mcpatcherforge.asm.WorldRendererTransformer"); private final Supplier applyIf; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/Mixins.java b/src/main/java/mist475/mcpatcherforge/mixins/Mixins.java index e9b9e29..8229069 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/Mixins.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/Mixins.java @@ -5,101 +5,158 @@ import java.util.List; import java.util.Set; import java.util.function.Supplier; +import java.util.stream.Collectors; + +import com.prupe.mcpatcher.Config; +import com.prupe.mcpatcher.MCPatcherUtils; import cpw.mods.fml.relauncher.FMLLaunchHandler; // Adapted from Hodgepodge public enum Mixins { - BASE_MOD(new Builder("All the default mixins!").setSide(Side.CLIENT) + BASE_MOD(new Builder("Base mod (can't be disabled, sorry)").setSide(Side.CLIENT) .setPhase(Phase.EARLY) .setApplyIf(() -> true) .addTargetedMod(TargetedMod.VANILLA) .addMixinClasses( - "block.material.MixinMapColor", - - "block.MixinBlock", - "block.MixinBlockDoublePlant", - "block.MixinBlockGrass", - "block.MixinBlockLeaves", - "block.MixinBlockLilyPad", - "block.MixinBlockLiquid", - "block.MixinBlockMycelium", - "block.MixinBlockOldLeaf", - "block.MixinBlockRedstoneWire", - "block.MixinBlockReed", - "block.MixinBlockStem", - "block.MixinBlockTallGrass", - "block.MixinBlockVine", - - "client.gui.MixinFontRenderer", - - "client.particle.MixinEffectRenderer", - "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.MixinRender", - "client.renderer.entity.MixinRenderBiped", - "client.renderer.entity.MixinRenderEnderman", - "client.renderer.entity.MixinRenderEntityLiving", - "client.renderer.entity.MixinRenderFish", - "client.renderer.entity.MixinRenderItem", - "client.renderer.entity.MixinRenderLiving", - "client.renderer.entity.MixinRenderMooshroom", - "client.renderer.entity.MixinRenderPlayer", - "client.renderer.entity.MixinRenderSheep", - "client.renderer.entity.MixinRenderSnowball", - "client.renderer.entity.MixinRenderSnowMan", - "client.renderer.entity.MixinRenderSpider", - "client.renderer.entity.MixinRenderWolf", - "client.renderer.entity.MixinRenderXPOrb", - - "client.renderer.texture.MixinAbstractTexture", - "client.renderer.texture.MixinTextureAtlasSprite", - "client.renderer.texture.MixinTextureClock", - "client.renderer.texture.MixinTextureCompass", - "client.renderer.texture.MixinTextureManager", - "client.renderer.texture.MixinTextureMap", - - "client.renderer.tileentity.MixinTileEntitySignRenderer", - - "client.renderer.MixinEntityRenderer", - "client.renderer.MixinItemRenderer", - "client.renderer.renderblocks.MixinRenderBlocks", - "client.renderer.renderblocks.MixinRenderBlocksRenderBlockLiquid", - "client.renderer.MixinRenderGlobal", - "client.renderer.MixinWorldRenderer", - - "client.resources.MixinSimpleReloadableResourceManager", - - "client.MixinMinecraft", - - "entity.MixinEntityList", - "entity.MixinEntityLivingBase", - - "item.crafting.MixinRecipesArmorDyes", - - "item.MixinItem", - "item.MixinItemArmor", - "item.MixinItemBlock", - "item.MixinItemMonsterPlacer", - - "nbt.MixinNBTTagCompound", - "nbt.MixinNBTTagList", - - "potion.MixinPotion", - "potion.MixinPotionHelper", - - "world.MixinWorld", - "world.MixinWorldProvider", - "world.MixinWorldProviderEnd", - "world.MixinWorldProviderHell")); + "base.MixinBlockGrass", + "base.MixinBlockMycelium", + + "base.MixinAbstractTexture", + "base.MixinTextureAtlasSprite", + + "base.MixinSimpleReloadableResourceManager", + + "base.MixinMinecraft", + + "renderpass.MixinEntityRenderer", + "renderpass.MixinRenderBlocks", + "renderpass.MixinRenderGlobal", + "renderpass.MixinWorldRenderer") + + ), + + CUSTOM_COLOURS(new Builder("Custom colors").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses( + addPrefix( + "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"))), + + CUSTOM_ITEM_TEXTURES(new Builder("Custom Item Textures").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses( + addPrefix( + "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"))), + + CONNECTED_TEXTURES(new Builder("Connected Textures").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses("ctm.MixinRenderBlocks")), + + EXTENDED_HD(new Builder("Extended hd").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses( + addPrefix("hd.", "MixinFontRenderer", "MixinTextureClock", "MixinTextureCompass", "MixinTextureManager"))), + + RANDOM_MOBS(new Builder("Random Mobs").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses( + addPrefix( + "mob.", + "MixinRender", + "MixinRenderEnderman", + "MixinRenderFish", + "MixinRenderLiving", + "MixinRenderMooshroom", + "MixinRenderSheep", + "MixinRenderSnowMan", + "MixinRenderSpider", + "MixinRenderWolf", + "MixinEntityLivingBase"))), + + SKY(new Builder("Sky").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf(() -> Config.getBoolean(MCPatcherUtils.BETTER_SKIES, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses(addPrefix("sky.", "MixinEffectRenderer", "MixinRenderGlobal"))), + + CTM_OR_CC(new Builder("Connected textures or Custom Colors enabled").setSide(Side.CLIENT) + .setPhase(Phase.EARLY) + .setApplyIf( + () -> Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true) + || Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true)) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses(addPrefix("ctm_cc.", "MixinRenderBlocks", "MixinTextureMap"))) + + ; public final String name; public final List mixinClasses; @@ -213,6 +270,14 @@ && allModsLoaded(targetedMods, loadedCoreMods, loadedMods) && noModsLoaded(excludedMods, loadedCoreMods, loadedMods)); } + @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]); + } + enum Side { BOTH, CLIENT, diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinAbstractTexture.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinAbstractTexture.java similarity index 89% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinAbstractTexture.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinAbstractTexture.java index ec2110a..13de058 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinAbstractTexture.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinAbstractTexture.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.base; import net.minecraft.client.renderer.texture.AbstractTexture; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockGrass.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockGrass.java new file mode 100644 index 0000000..2edbbde --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockGrass.java @@ -0,0 +1,33 @@ +package mist475.mcpatcherforge.mixins.early.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 cir) { + final IIcon grassTexture = RenderBlocksUtils + .getGrassTexture((Block) (Object) this, worldIn, x, y, z, side, this.field_149991_b); + if (grassTexture != null) { + cir.setReturnValue(grassTexture); + } + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockMycelium.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockMycelium.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockMycelium.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockMycelium.java index 4ceab75..f4df5bf 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockMycelium.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinBlockMycelium.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.base; import net.minecraft.block.Block; import net.minecraft.block.BlockMycelium; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/MixinMinecraft.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinMinecraft.java similarity index 87% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/MixinMinecraft.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinMinecraft.java index cda139c..b041a5c 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/MixinMinecraft.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinMinecraft.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client; +package mist475.mcpatcherforge.mixins.early.base; import java.io.File; import java.io.IOException; @@ -22,6 +22,7 @@ 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; @@ -59,10 +60,18 @@ private void modifyConstructor(Session sessionIn, int displayWidth, int displayH private void modifyStartGame1(CallbackInfo ci) { TileLoader.init(); CTMUtils.reset(); - CITUtils.init(); - FontUtils.init(); - MobRandomizer.init(); - Colorizer.init(); + 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( diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/resources/MixinSimpleReloadableResourceManager.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinSimpleReloadableResourceManager.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/resources/MixinSimpleReloadableResourceManager.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinSimpleReloadableResourceManager.java index a6af171..37ecce4 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/resources/MixinSimpleReloadableResourceManager.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinSimpleReloadableResourceManager.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.resources; +package mist475.mcpatcherforge.mixins.early.base; import net.minecraft.client.resources.SimpleReloadableResourceManager; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureAtlasSprite.java b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinTextureAtlasSprite.java similarity index 90% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureAtlasSprite.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinTextureAtlasSprite.java index f94bfe4..f0e6fc8 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureAtlasSprite.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/base/MixinTextureAtlasSprite.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.base; import java.util.List; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlock.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlock.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlock.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlock.java index 56b2ecd..34b9ee6 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlock.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlock.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockDoublePlant.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockDoublePlant.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockDoublePlant.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockDoublePlant.java index bf3767d..b803f5a 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockDoublePlant.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockDoublePlant.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockDoublePlant; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockGrass.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockGrass.java similarity index 65% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockGrass.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockGrass.java index 164857c..9b5ea00 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockGrass.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockGrass.java @@ -1,37 +1,19 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; 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.cc.ColorizeBlock; -import com.prupe.mcpatcher.mal.block.RenderBlocksUtils; @Mixin(BlockGrass.class) public abstract 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 cir) { - final IIcon grassTexture = RenderBlocksUtils - .getGrassTexture((Block) (Object) this, worldIn, x, y, z, side, this.field_149991_b); - if (grassTexture != null) { - cir.setReturnValue(grassTexture); - } - } - @Inject(method = "getBlockColor()I", at = @At("HEAD"), cancellable = true) private void modifyGetBlockColor(CallbackInfoReturnable cir) { if (ColorizeBlock.colorizeBlock((Block) (Object) this)) { diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLeaves.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLeaves.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLeaves.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLeaves.java index 7eaaaab..2d218c9 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLeaves.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLeaves.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLilyPad.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLilyPad.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLilyPad.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLilyPad.java index 8d5c48e..885ca03 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLilyPad.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLilyPad.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockLilyPad; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLiquid.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLiquid.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLiquid.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLiquid.java index ee6a462..0725457 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockLiquid.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockLiquid.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockOldLeaf.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockOldLeaf.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockOldLeaf.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockOldLeaf.java index e173bed..bb4a2a9 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockOldLeaf.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockOldLeaf.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockOldLeaf; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockRedstoneWire.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockRedstoneWire.java similarity index 97% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockRedstoneWire.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockRedstoneWire.java index e362839..23148fb 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockRedstoneWire.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockRedstoneWire.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import java.util.Random; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockReed.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockReed.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockReed.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockReed.java index 2010ecf..c92029d 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockReed.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockReed.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockReed; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockStem.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockStem.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockStem.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockStem.java index b14df95..8fe5208 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockStem.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockStem.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockStem; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockTallGrass.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockTallGrass.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockTallGrass.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockTallGrass.java index a2d8102..1601635 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockTallGrass.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockTallGrass.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockTallGrass; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockVine.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockVine.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockVine.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockVine.java index 610e008..22c9de1 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/MixinBlockVine.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/MixinBlockVine.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block; +package mist475.mcpatcherforge.mixins.early.cc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockVine; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/block/material/MixinMapColor.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/material/MixinMapColor.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/block/material/MixinMapColor.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/material/MixinMapColor.java index d23d546..06e1e85 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/block/material/MixinMapColor.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/block/material/MixinMapColor.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.block.material; +package mist475.mcpatcherforge.mixins.early.cc.block.material; import net.minecraft.block.material.MapColor; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityAuraFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityAuraFX.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityAuraFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityAuraFX.java index ead9592..20afc7b 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityAuraFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityAuraFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityAuraFX; import net.minecraft.client.particle.EntityFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityBubbleFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityBubbleFX.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityBubbleFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityBubbleFX.java index 184ba53..87fe6e6 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityBubbleFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityBubbleFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityBubbleFX; import net.minecraft.client.particle.EntityFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityDropParticleFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityDropParticleFX.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityDropParticleFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityDropParticleFX.java index ecdbdd6..85dca70 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityDropParticleFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityDropParticleFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; @@ -23,6 +23,7 @@ public abstract class MixinEntityDropParticleFX extends EntityFX { @Shadow private Material materialType; + @Shadow private int bobTimer; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityPortalFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityPortalFX.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityPortalFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityPortalFX.java index b8ad11e..3672019 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityPortalFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityPortalFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityPortalFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRainFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRainFX.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRainFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRainFX.java index 8c983e9..2e4076f 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRainFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRainFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityRainFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRedDustFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRedDustFX.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRedDustFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRedDustFX.java index ec8a5cc..13c9d63 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntityRedDustFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntityRedDustFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityReddustFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySplashFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySplashFX.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySplashFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySplashFX.java index 23952e0..55aabe8 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySplashFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySplashFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntitySplashFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySuspendFX.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySuspendFX.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySuspendFX.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySuspendFX.java index 79b2c49..3e4f4ba 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEntitySuspendFX.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/particle/MixinEntitySuspendFX.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.cc.client.particle; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntitySuspendFX; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinEntityRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinEntityRenderer.java similarity index 57% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinEntityRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinEntityRenderer.java index 1ab2ece..91836ef 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinEntityRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinEntityRenderer.java @@ -1,25 +1,20 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer; +package mist475.mcpatcherforge.mixins.early.cc.client.renderer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; 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.llamalad7.mixinextras.injector.WrapWithCondition; import com.prupe.mcpatcher.cc.ColorizeWorld; import com.prupe.mcpatcher.cc.Colorizer; import com.prupe.mcpatcher.cc.Lightmap; -import com.prupe.mcpatcher.renderpass.RenderPass; @Mixin(EntityRenderer.class) public abstract class MixinEntityRenderer { @@ -28,27 +23,24 @@ public abstract class MixinEntityRenderer { private Minecraft mc; @Shadow - @Final - private DynamicTexture lightmapTexture; - - @Shadow - @Final - private int[] lightmapColors; + float fogColorRed; @Shadow - private boolean lightmapUpdateNeeded; + float fogColorGreen; @Shadow - float fogColorRed; + float fogColorBlue; @Shadow - float fogColorGreen; + @Final + private DynamicTexture lightmapTexture; @Shadow - float fogColorBlue; + @Final + private int[] lightmapColors; @Shadow - protected abstract void renderRainSnow(float p_78474_1_); + private boolean lightmapUpdateNeeded; @Inject(method = "updateLightmap(F)V", at = @At("HEAD"), cancellable = true) private void modifyUpdateLightMap(float partialTick, CallbackInfo ci) { @@ -60,40 +52,6 @@ private void modifyUpdateLightMap(float partialTick, CallbackInfo ci) { } } - @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); - } - @Inject( method = "updateFogColor(F)V", at = @At( diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinItemRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinItemRenderer.java new file mode 100644 index 0000000..6117b08 --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinItemRenderer.java @@ -0,0 +1,29 @@ +package mist475.mcpatcherforge.mixins.early.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())); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderBlocks.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderBlocks.java new file mode 100644 index 0000000..a93656b --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderBlocks.java @@ -0,0 +1,800 @@ +package mist475.mcpatcherforge.mixins.early.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 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 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 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 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 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); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderGlobal.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderGlobal.java new file mode 100644 index 0000000..c95b89d --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/MixinRenderGlobal.java @@ -0,0 +1,29 @@ +package mist475.mcpatcherforge.mixins.early.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; + } + + @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); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderWolf.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderWolf.java new file mode 100644 index 0000000..cca0842 --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderWolf.java @@ -0,0 +1,27 @@ +package mist475.mcpatcherforge.mixins.early.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]); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderXPOrb.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderXPOrb.java similarity index 92% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderXPOrb.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderXPOrb.java index 0052214..253d259 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderXPOrb.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/entity/MixinRenderXPOrb.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cc.client.renderer.entity; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderXPOrb; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/tileentity/MixinTileEntitySignRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/tileentity/MixinTileEntitySignRenderer.java similarity index 90% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/tileentity/MixinTileEntitySignRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/tileentity/MixinTileEntitySignRenderer.java index cb1b876..ef6fce0 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/tileentity/MixinTileEntitySignRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/client/renderer/tileentity/MixinTileEntitySignRenderer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.tileentity; +package mist475.mcpatcherforge.mixins.early.cc.client.renderer.tileentity; import net.minecraft.client.renderer.tileentity.TileEntitySignRenderer; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityList.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/entity/MixinEntityList.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityList.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/entity/MixinEntityList.java index 8e32f45..91114bd 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityList.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/entity/MixinEntityList.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.entity; +package mist475.mcpatcherforge.mixins.early.cc.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemArmor.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemArmor.java similarity index 90% rename from src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemArmor.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemArmor.java index 1fca14f..88e4f52 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemArmor.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemArmor.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.item; +package mist475.mcpatcherforge.mixins.early.cc.item; import net.minecraft.item.ItemArmor; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemBlock.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemBlock.java similarity index 92% rename from src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemBlock.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemBlock.java index 327026d..d886b35 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemBlock.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemBlock.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.item; +package mist475.mcpatcherforge.mixins.early.cc.item; import net.minecraft.block.Block; import net.minecraft.item.Item; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemMonsterPlacer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemMonsterPlacer.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemMonsterPlacer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemMonsterPlacer.java index dd3043b..dcb8b70 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItemMonsterPlacer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/MixinItemMonsterPlacer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.item; +package mist475.mcpatcherforge.mixins.early.cc.item; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/item/crafting/MixinRecipesArmorDyes.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/crafting/MixinRecipesArmorDyes.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/item/crafting/MixinRecipesArmorDyes.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/crafting/MixinRecipesArmorDyes.java index 911c925..9ec361f 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/item/crafting/MixinRecipesArmorDyes.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/item/crafting/MixinRecipesArmorDyes.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.item.crafting; +package mist475.mcpatcherforge.mixins.early.cc.item.crafting; import net.minecraft.block.BlockColored; import net.minecraft.entity.passive.EntitySheep; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotion.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotion.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotion.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotion.java index 6aecfc0..3a0e796 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotion.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotion.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.potion; +package mist475.mcpatcherforge.mixins.early.cc.potion; import net.minecraft.potion.Potion; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotionHelper.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotionHelper.java similarity index 91% rename from src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotionHelper.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotionHelper.java index ae3f926..8ca2e36 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/potion/MixinPotionHelper.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/potion/MixinPotionHelper.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.potion; +package mist475.mcpatcherforge.mixins.early.cc.potion; import net.minecraft.potion.PotionHelper; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorld.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorld.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorld.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorld.java index 4174c4f..f64fc67 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorld.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorld.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.world; +package mist475.mcpatcherforge.mixins.early.cc.world; import net.minecraft.entity.Entity; import net.minecraft.util.Vec3; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProvider.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProvider.java similarity index 97% rename from src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProvider.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProvider.java index 4f48706..d6e02f3 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProvider.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProvider.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.world; +package mist475.mcpatcherforge.mixins.early.cc.world; import net.minecraft.util.Vec3; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderEnd.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderEnd.java similarity index 87% rename from src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderEnd.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderEnd.java index 2aa0df2..d673955 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderEnd.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderEnd.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.world; +package mist475.mcpatcherforge.mixins.early.cc.world; import net.minecraft.util.Vec3; import net.minecraft.world.WorldProviderEnd; @@ -15,7 +15,7 @@ public abstract class MixinWorldProviderEnd { /** - * @author Mist475 (adpated from Paul Rupe) + * @author Mist475 (adapted from Paul Rupe) * @reason customized value */ @SideOnly(Side.CLIENT) diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderHell.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderHell.java similarity index 87% rename from src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderHell.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderHell.java index 38b6ecb..468d81b 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/world/MixinWorldProviderHell.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cc/world/MixinWorldProviderHell.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.world; +package mist475.mcpatcherforge.mixins.early.cc.world; import net.minecraft.util.Vec3; import net.minecraft.world.WorldProviderHell; @@ -15,7 +15,7 @@ public abstract class MixinWorldProviderHell { /** - * @author Mist475 (adpated from Paul Rupe) + * @author Mist475 (adapted from Paul Rupe) * @reason customized value */ @SideOnly(Side.CLIENT) diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinItemRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/MixinItemRenderer.java similarity index 62% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinItemRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/MixinItemRenderer.java index 11a581f..3e2f0e5 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinItemRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/MixinItemRenderer.java @@ -1,19 +1,14 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer; +package mist475.mcpatcherforge.mixins.early.cit.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.minecraft.util.IIcon; -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.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.prupe.mcpatcher.cc.ColorizeBlock; import com.prupe.mcpatcher.cit.CITUtils; @Mixin(ItemRenderer.class) @@ -29,17 +24,6 @@ private IIcon modifyRenderItem1(EntityLivingBase instance, ItemStack item, int r return CITUtils.getIcon(entity.getItemIcon(item2, renderPass1), item2, renderPass1); } - @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())); - } - @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"), diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderBiped.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderBiped.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderBiped.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderBiped.java index d9876e6..2000530 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderBiped.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderBiped.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cit.client.renderer.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderBiped; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEntityLiving.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderEntityLiving.java similarity index 99% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEntityLiving.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderEntityLiving.java index 7bea461..0602229 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEntityLiving.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderEntityLiving.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cit.client.renderer.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.OpenGlHelper; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderItem.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderItem.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderItem.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderItem.java index 40276be..dce3579 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderItem.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderItem.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cit.client.renderer.entity; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.OpenGlHelper; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderPlayer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderPlayer.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderPlayer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderPlayer.java index dbea960..4119a14 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderPlayer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderPlayer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cit.client.renderer.entity; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelBase; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowball.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderSnowball.java similarity index 91% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowball.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderSnowball.java index 8c2c125..e23f923 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowball.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/client/renderer/entity/MixinRenderSnowball.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.cit.client.renderer.entity; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItem.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/item/MixinItem.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItem.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/item/MixinItem.java index ca3ad66..1103cdc 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/item/MixinItem.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/item/MixinItem.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.item; +package mist475.mcpatcherforge.mixins.early.cit.item; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagCompound.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagCompound.java similarity index 91% rename from src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagCompound.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagCompound.java index bd70c0b..425dc6e 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagCompound.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagCompound.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.nbt; +package mist475.mcpatcherforge.mixins.early.cit.nbt; import java.util.Collection; import java.util.Map; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagList.java b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagList.java similarity index 89% rename from src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagList.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagList.java index 0c28f74..1421964 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/nbt/MixinNBTTagList.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/cit/nbt/MixinNBTTagList.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.nbt; +package mist475.mcpatcherforge.mixins.early.cit.nbt; import java.util.List; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinRenderGlobal.java b/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinRenderGlobal.java deleted file mode 100644 index 837b606..0000000 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinRenderGlobal.java +++ /dev/null @@ -1,163 +0,0 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer; - -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.IWorldAccess; - -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.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 com.llamalad7.mixinextras.injector.WrapWithCondition; -import com.prupe.mcpatcher.cc.ColorizeWorld; -import com.prupe.mcpatcher.renderpass.RenderPass; -import com.prupe.mcpatcher.renderpass.RenderPassMap; -import com.prupe.mcpatcher.sky.SkyRenderer; - -@Mixin(RenderGlobal.class) -public abstract class MixinRenderGlobal implements IWorldAccess { - - @Shadow - private WorldClient theWorld; - - @Redirect( - method = "(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 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 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); - } - - @Inject(method = "renderSky(F)V", at = @At("HEAD")) - private void modifyRenderSky1(float partialTick, CallbackInfo ci) { - SkyRenderer.setup(this.theWorld, partialTick, this.theWorld.getCelestialAngle(partialTick)); - } - - @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; - } - - @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); - } - - @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); - } -} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocksRenderBlockLiquid.java b/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocksRenderBlockLiquid.java deleted file mode 100644 index 7468080..0000000 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocksRenderBlockLiquid.java +++ /dev/null @@ -1,522 +0,0 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.renderblocks; - -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.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import com.prupe.mcpatcher.cc.ColorizeBlock; - -@Mixin(RenderBlocks.class) -public abstract class MixinRenderBlocksRenderBlockLiquid { - - @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 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); - - @Shadow - public abstract IIcon getBlockIconFromSide(Block block, int side); - - @Unique - private int mcpatcherforge$neededSideRenderBlockLiquid; - - @Unique - private float mcpatcherforge$neededFloat1; - - @Unique - private float mcpatcherforge$neededFloat2; - - @Unique - private float mcpatcherforge$neededFloat3; - - @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); - } - - // 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/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;", - ordinal = 1)) - private IIcon mcpatcherforge$redirectToGetBlockIcon(RenderBlocks instance, Block block, int side, int meta, - Block specializedBlock, int x, int y, int z) { - return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta) - : this.getBlockIcon(block, this.blockAccess, x, y, z, side); - } - - // 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/RenderBlocks;getBlockIconFromSide(Lnet/minecraft/block/Block;I)Lnet/minecraft/util/IIcon;")) - private IIcon mcpatcherforge$redirectToGetBlockIcon(RenderBlocks instance, Block block, int side, - Block specializedBlock, int x, int y, int z) { - return (this.blockAccess == null) ? this.getBlockIconFromSide(block, side) - : this.getBlockIcon(block, this.blockAccess, x, y, z, side); - } - - // Handle smoothing - - @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); - } - - @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; - } - } - - @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 cir) { - this.enableAO = false; - } - - @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); - } - } - - @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); - } -} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocks.java b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm/MixinRenderBlocks.java similarity index 76% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocks.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/ctm/MixinRenderBlocks.java index f6fb1ad..ea30a08 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/renderblocks/MixinRenderBlocks.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm/MixinRenderBlocks.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.renderblocks; +package mist475.mcpatcherforge.mixins.early.ctm; import static net.minecraftforge.common.util.ForgeDirection.EAST; import static net.minecraftforge.common.util.ForgeDirection.NORTH; @@ -8,7 +8,6 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAnvil; import net.minecraft.block.BlockBrewingStand; -import net.minecraft.block.BlockCauldron; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.BlockFlowerPot; import net.minecraft.block.BlockGrass; @@ -22,33 +21,16 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -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.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.ctm.CTMUtils; import com.prupe.mcpatcher.ctm.GlassPaneRenderer; -import com.prupe.mcpatcher.mal.block.RenderBlocksUtils; -import com.prupe.mcpatcher.renderpass.RenderPass; -/* - * For readability changes to the biggest methods get their own classes - */ @Mixin(RenderBlocks.class) public abstract class MixinRenderBlocks { @@ -73,20 +55,6 @@ public abstract class MixinRenderBlocks { @Shadow public abstract IIcon getIconSafe(IIcon texture); - // 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; - @Redirect( method = "renderBlockMinecartTrack(Lnet/minecraft/block/BlockRailBase;III)Z", at = @At( @@ -113,20 +81,6 @@ private IIcon redirectGetBlockIconFromSide(RenderBlocks instance, Block block, i : this.getBlockIcon(block, this.blockAccess, x, y, z, side); } - @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); - } - @Redirect( method = "renderBlockBrewingStand(Lnet/minecraft/block/BlockBrewingStand;III)Z", at = @At( @@ -138,29 +92,6 @@ private IIcon modifyRenderBlockBrewingStand(RenderBlocks instance, Block block, : this.getBlockIcon(block, this.blockAccess, x, y, z, side); } - @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 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 cir) { - ColorizeBlock.computeWaterColor(); - Tessellator.instance.setColorOpaque_F(Colorizer.setColor[0], Colorizer.setColor[1], Colorizer.setColor[2]); - } - @Redirect( method = "renderBlockFlowerpot(Lnet/minecraft/block/BlockFlowerPot;III)Z", at = @At( @@ -194,86 +125,6 @@ private IIcon modifyRenderRedstoneDiodeMetadata(RenderBlocks instance, Block blo : this.getBlockIcon(block, this.blockAccess, x, y, z, side); } - @Inject(method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z", at = @At("HEAD")) - private void calculateComputeRedstoneWireColor(Block block, int x, int y, int z, - CallbackInfoReturnable 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); - } - } - /** * @author Mist475 (adapted from Paul Rupe) * @reason Significant deviation from Vanilla @@ -1103,269 +954,6 @@ private IIcon modifyRenderBlockDoublePlant(BlockDoublePlant block, boolean top, -1); } - // 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); - } - - @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 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)); - } - @Redirect( method = { "renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z", "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z", @@ -1498,4 +1086,27 @@ private IIcon modifyGetBlockIconFromSide(RenderBlocks instance, IIcon texture, B block, side); } + + @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 = 1)) + private IIcon mcpatcherforge$redirectToGetBlockIcon(RenderBlocks instance, Block block, int side, int meta, + Block specializedBlock, int x, int y, int z) { + 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/RenderBlocks;getBlockIconFromSide(Lnet/minecraft/block/Block;I)Lnet/minecraft/util/IIcon;")) + private IIcon mcpatcherforge$redirectToGetBlockIcon(RenderBlocks instance, Block block, int side, + Block specializedBlock, int x, int y, int z) { + return (this.blockAccess == null) ? this.getBlockIconFromSide(block, side) + : this.getBlockIcon(block, this.blockAccess, x, y, z, side); + } } diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinRenderBlocks.java b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinRenderBlocks.java new file mode 100644 index 0000000..7fbb428 --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinRenderBlocks.java @@ -0,0 +1,115 @@ +package mist475.mcpatcherforge.mixins.early.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; + } + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureMap.java b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinTextureMap.java similarity index 97% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureMap.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinTextureMap.java index a91079a..633bc83 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureMap.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/ctm_cc/MixinTextureMap.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.ctm_cc; import java.util.Map; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/gui/MixinFontRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinFontRenderer.java similarity index 99% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/gui/MixinFontRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinFontRenderer.java index b84bcac..b511077 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/gui/MixinFontRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinFontRenderer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.gui; +package mist475.mcpatcherforge.mixins.early.hd; import java.awt.image.BufferedImage; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureClock.java b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureClock.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureClock.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureClock.java index 27db2d0..a2f1481 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureClock.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureClock.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.hd; import net.minecraft.client.renderer.texture.TextureClock; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureCompass.java b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureCompass.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureCompass.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureCompass.java index ecec457..4f0e2c8 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureCompass.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureCompass.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.hd; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureCompass; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureManager.java b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureManager.java similarity index 88% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureManager.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureManager.java index a6a3333..eaaac96 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/texture/MixinTextureManager.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/hd/MixinTextureManager.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.texture; +package mist475.mcpatcherforge.mixins.early.hd; import net.minecraft.client.renderer.texture.TextureManager; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityLivingBase.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinEntityLivingBase.java similarity index 95% rename from src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityLivingBase.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinEntityLivingBase.java index 289fc52..3fd3e91 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/entity/MixinEntityLivingBase.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinEntityLivingBase.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRender.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRender.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRender.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRender.java index 736c273..2f9dc39 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRender.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRender.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEnderman.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderEnderman.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEnderman.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderEnderman.java index cbfa359..dec108e 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderEnderman.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderEnderman.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderEnderman; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderFish.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderFish.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderFish.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderFish.java index 304b4b3..1f6d825 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderFish.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderFish.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; @@ -107,6 +107,7 @@ public void doRender(EntityFishHook entity, double x, double y, double z, float 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); diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderLiving.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderLiving.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderLiving.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderLiving.java index 77b741e..a854932 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderLiving.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderLiving.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.Tessellator; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderMooshroom.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderMooshroom.java similarity index 96% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderMooshroom.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderMooshroom.java index 54dad5f..615b807 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderMooshroom.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderMooshroom.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.block.Block; import net.minecraft.client.model.ModelBase; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSheep.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSheep.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSheep.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSheep.java index 2ea0f3c..0ec30f0 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSheep.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSheep.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowMan.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSnowMan.java similarity index 93% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowMan.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSnowMan.java index 0743571..fdaab9c 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSnowMan.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSnowMan.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.entity.RenderSnowMan; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSpider.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSpider.java similarity index 94% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSpider.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSpider.java index 9e01fe7..a0a7270 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderSpider.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderSpider.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.mob; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderWolf.java b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderWolf.java similarity index 55% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderWolf.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderWolf.java index d75422c..3b8911a 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/entity/MixinRenderWolf.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/mob/MixinRenderWolf.java @@ -1,18 +1,15 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer.entity; +package mist475.mcpatcherforge.mixins.early.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.EntitySheep; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.util.ResourceLocation; -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; import com.prupe.mcpatcher.mob.MobRandomizer; @Mixin(RenderWolf.class) @@ -31,15 +28,4 @@ public MixinRenderWolf(ModelBase modelBase, float shadowSize) { private void modifyShouldRenderPass1(RenderWolf instance, ResourceLocation resourceLocation, EntityWolf entity) { this.bindTexture(MobRandomizer.randomTexture(entity, resourceLocation)); } - - @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]); - } } diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinEntityRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinEntityRenderer.java new file mode 100644 index 0000000..e9c2e7e --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinEntityRenderer.java @@ -0,0 +1,60 @@ +package mist475.mcpatcherforge.mixins.early.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); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderBlocks.java b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderBlocks.java new file mode 100644 index 0000000..7a27a68 --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderBlocks.java @@ -0,0 +1,36 @@ +package mist475.mcpatcherforge.mixins.early.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); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderGlobal.java b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderGlobal.java new file mode 100644 index 0000000..1d1ceae --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinRenderGlobal.java @@ -0,0 +1,81 @@ +package mist475.mcpatcherforge.mixins.early.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 = "(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 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 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); + } +} diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinWorldRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinWorldRenderer.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinWorldRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinWorldRenderer.java index f748b58..c770831 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/renderer/MixinWorldRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/renderpass/MixinWorldRenderer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.renderer; +package mist475.mcpatcherforge.mixins.early.renderpass; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEffectRenderer.java b/src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinEffectRenderer.java similarity index 98% rename from src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEffectRenderer.java rename to src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinEffectRenderer.java index 4c09c58..7bac17e 100644 --- a/src/main/java/mist475/mcpatcherforge/mixins/early/client/particle/MixinEffectRenderer.java +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinEffectRenderer.java @@ -1,4 +1,4 @@ -package mist475.mcpatcherforge.mixins.early.client.particle; +package mist475.mcpatcherforge.mixins.early.sky; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinRenderGlobal.java b/src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinRenderGlobal.java new file mode 100644 index 0000000..3976d2b --- /dev/null +++ b/src/main/java/mist475/mcpatcherforge/mixins/early/sky/MixinRenderGlobal.java @@ -0,0 +1,78 @@ +package mist475.mcpatcherforge.mixins.early.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 + private 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); + } +}