Compare commits

..
18 changed files with 98 additions and 70 deletions

No files matched your search

@@ -15,8 +15,13 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
modid = "angelica",
name = "Angelica",
version = Tags.VERSION,
dependencies = " before:lwjgl3ify@[1.5.3,);" + " after:hodgepodge@[2.4.4,);" + " after:CodeChickenCore@[1.2.0,);"
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.6.6,);",
dependencies = """
required-after:gtnhlib@[0.6.6,);\
before:lwjgl3ify@[1.5.3,);\
after:hodgepodge@[2.4.4,);\
after:CodeChickenCore@[1.2.0,);\
after:archaicfix@[0.7.0,);\
""",
acceptedMinecraftVersions = "[1.7.10]",
acceptableRemoteVersions = "*",
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
@@ -1,7 +1,6 @@
package com.gtnewhorizons.angelica.compat;
import com.gtnewhorizons.angelica.compat.backhand.BackhandReflectionCompat;
import com.gtnewhorizons.angelica.compat.holoinventory.HoloInventoryReflectionCompat;
import com.gtnewhorizons.angelica.helpers.LoadControllerHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
@@ -53,9 +52,7 @@ public class ModStatus {
isThaumicHorizonsLoaded = Loader.isModLoaded("ThaumicHorizons");
isBaublesLoaded = Loader.isModLoaded("Baubles");
if (isHoloInventoryLoaded) {
isHoloInventoryLoaded = HoloInventoryReflectionCompat.isHoloInventoryLoaded();
}
isHoloInventoryLoaded = Loader.isModLoaded("holoinventory");
// remove compat with original release of BG2
if (isBattlegearLoaded){
@@ -0,0 +1,15 @@
package com.gtnewhorizons.angelica.compat.battlegear2;
import mods.battlegear2.api.core.IInventoryPlayerBattle;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This class exists to isolate classes that exist in Battlegear 2 but not
* in Battlegear 2 for Backhand in order to avoid class loading exceptions.
*/
public class Battlegear2Compat {
public static ItemStack getBattlegear2Offhand(EntityPlayer player) {
return ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon();
}
}
@@ -67,10 +67,6 @@ public class HoloInventoryReflectionCompat {
angelicaOverrideSetter = angelicaOverrideSetterTemp;
}
public static boolean isHoloInventoryLoaded() {
return isLoaded;
}
public static void renderEvent(RenderGameOverlayEvent event) {
if (!isLoaded) return;
try {
@@ -6,12 +6,12 @@ import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;
import com.gtnewhorizon.gtnhlib.util.CoordinatePacker;
import com.gtnewhorizons.angelica.api.IDynamicLightProducer;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.battlegear2.Battlegear2Compat;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import mods.battlegear2.api.core.IBattlePlayer;
import mods.battlegear2.api.core.IInventoryPlayerBattle;
import net.irisshaders.iris.api.v0.IrisApi;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -376,7 +376,7 @@ public class DynamicLights {
player instanceof IBattlePlayer battlePlayer &&
battlePlayer.battlegear2$isBattlemode()
) {
ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon();
ItemStack offhand = Battlegear2Compat.getBattlegear2Offhand(player);
if (offhand != null) {
luminance = Math.max(luminance, getLuminanceFromItemStack(offhand, inWater));
}
@@ -86,7 +86,7 @@ public enum Mixins {
// Not compatible with the lwjgl debug callbacks, so disable if that's enabled
ARCHAIC_SPLASH(new Builder("ArchaicFix Splash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.showSplashMemoryBar && !AngelicaMod.lwjglDebug).addMixinClasses(
"angelica.archaic.MixinSplashProgress"
"angelica.archaic.MixinSplashProgress$3"
,"angelica.archaic.AccessorSplashProgress"
)
),
@@ -104,7 +104,7 @@ public enum Mixins {
IRIS_STARTUP(new Builder("Start Iris").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
"shaders.startup.MixinGameSettings"
,"shaders.startup.MixinGuiMainMenu"
,"shaders.startup.MixinMinecraft"
,"shaders.startup.MixinInitRenderer"
,"shaders.startup.MixinAbstractTexture"
,"shaders.startup.MixinTextureAtlasSprite"
+4 -4
View File
@@ -668,14 +668,14 @@ public class Iris {
int blockId = getShaderMaterialOverrideId(block, meta);
CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
tess.setShaderBlockId(blockId);
if (TessellatorManager.get() instanceof CapturingTessellator tess)
tess.setShaderBlockId(blockId);
}
public static void resetShaderMaterialOverride() {
if (!AngelicaConfig.enableIris)
return;
CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
tess.setShaderBlockId(-1);
if (TessellatorManager.get() instanceof CapturingTessellator tess)
tess.setShaderBlockId(-1);
}
}
@@ -68,4 +68,6 @@ public net.minecraft.client.renderer.EntityRenderer field_78510_Z #renderEndNano
public net.minecraft.client.multiplayer.PlayerControllerMP field_78779_k #currentGameType
public net.minecraft.world.World field_72993_I # activeChunkSet
public net.minecraft.world.World field_72993_I # activeChunkSet
public cpw.mods.fml.client.SplashProgress$SplashFontRenderer
Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 852 B

@@ -1,6 +1,8 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.archaic;
import cpw.mods.fml.client.SplashProgress;
import cpw.mods.fml.client.SplashProgress.SplashFontRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@@ -12,12 +14,19 @@ public interface AccessorSplashProgress {
static int getBarBorderColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static int getBarBackgroundColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static int getFontColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static SplashFontRenderer getFontRenderer() {
throw new AssertionError();
}
}
@@ -5,9 +5,9 @@ package com.gtnewhorizons.angelica.mixins.early.angelica.archaic;
import com.gtnewhorizons.angelica.Tags;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.client.SplashProgress;
import net.minecraft.client.gui.FontRenderer;
import cpw.mods.fml.client.SplashProgress.SplashFontRenderer;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.opengl.Display;
import org.spongepowered.asm.mixin.Final;
@@ -18,8 +18,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.lang.reflect.Field;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
@@ -30,29 +28,19 @@ import static org.lwjgl.opengl.GL11.glTranslatef;
@SuppressWarnings("deprecation")
@Mixin(targets = { "cpw/mods/fml/client/SplashProgress$3" })
public class MixinSplashProgress {
private static final int memoryGoodColor = 0x78CB34;
private static final int memoryWarnColor = 0xE6E84A;
private static final int memoryLowColor = 0xE42F2F;
public class MixinSplashProgress$3 {
private static final int MEMORY_GOOD_COLOR = 0x78CB34;
private static final int MEMORY_WARN_COLOR = 0xE6E84A;
private static final int MEMORY_LOW_COLOR = 0xE42F2F;
private static float memoryColorPercent;
private static long memoryColorChangeTime;
private static FontRenderer fontRenderer = null;
@Unique
private static Boolean angelica$isArchaicFixPresent = null;
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 1, remap = false, shift = At.Shift.AFTER), remap = false, require = 0)
private void injectDrawMemoryBar(CallbackInfo ci) {
// NOTE: Disable this if you're checking for off thread GL calls via `-Dangelica.assertMainThread=true`
if(fontRenderer == null) {
try {
Field f = SplashProgress.class.getDeclaredField("fontRenderer");
f.setAccessible(true);
fontRenderer = (FontRenderer)f.get(null);
} catch(ReflectiveOperationException e) {
AngelicaTweaker.LOGGER.error(e);
return;
}
}
// This runs before Loader.isModLoaded() works
if (angelica$isArchaicFixPresent == null) {
try {
@@ -68,7 +56,7 @@ public class MixinSplashProgress {
glTranslatef(320 - Display.getWidth() / 2 + 4, 240 + Display.getHeight() / 2 - textHeight2, 0);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString("Angelica " + Tags.VERSION, 0, angelica$isArchaicFixPresent ? -10 : 0, 0x000000);
AccessorSplashProgress.getFontRenderer().drawString("Angelica " + Tags.VERSION, 0, angelica$isArchaicFixPresent ? -10 : 0, 0x000000);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
if(AngelicaConfig.showSplashMemoryBar) {
@@ -95,6 +83,7 @@ public class MixinSplashProgress {
final int freeMemory = bytesToMb(Runtime.getRuntime().freeMemory());
final int usedMemory = totalMemory - freeMemory;
final float usedMemoryPercent = usedMemory / (float) maxMemory;
final SplashFontRenderer fontRenderer = AccessorSplashProgress.getFontRenderer();
glPushMatrix();
// title - message
@@ -123,13 +112,13 @@ public class MixinSplashProgress {
final int memoryBarColor;
if (memoryColorPercent < 0.75f) {
memoryBarColor = memoryGoodColor;
memoryBarColor = MEMORY_GOOD_COLOR;
} else if (memoryColorPercent < 0.85f) {
memoryBarColor = memoryWarnColor;
memoryBarColor = MEMORY_WARN_COLOR;
} else {
memoryBarColor = memoryLowColor;
memoryBarColor = MEMORY_LOW_COLOR;
}
setColor(memoryLowColor);
setColor(MEMORY_LOW_COLOR);
glPushMatrix();
glTranslatef((barWidth - 2) * (totalMemory) / (maxMemory) - 2, 0, 0);
drawBox(2, barHeight - 2);
@@ -17,16 +17,19 @@ public class MixinRenderGlobal_ItemRenderDist {
@Unique private static final int[] sodium$entityItemCount = new int[256];
@Unique private static int sodium$itemRenderDist = 255;
@Unique private static int sodium$itemRenderedCount;
@Unique private static int sodium$itemLimit = Integer.MAX_VALUE;
@Inject(method = "renderEntities", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderGlobal;countEntitiesRendered:I", ordinal = 0))
private void sodium$resetEntitycount(CallbackInfo ci) {
sodium$itemRenderedCount = 0;
int entityCount = 0;
boolean reachedLimit = false;
final int itemLimit = AngelicaConfig.droppedItemLimit == 2048 ? Integer.MAX_VALUE : AngelicaConfig.droppedItemLimit;
sodium$itemLimit = AngelicaConfig.droppedItemLimit == 2048 ? Integer.MAX_VALUE : AngelicaConfig.droppedItemLimit;
for (int i = 0; i < sodium$entityItemCount.length; i++) {
entityCount += sodium$entityItemCount[i];
sodium$entityItemCount[i] = 0;
if (!reachedLimit && entityCount > itemLimit) {
if (!reachedLimit && entityCount > sodium$itemLimit) {
reachedLimit = true;
sodium$itemRenderDist = i == 0 ? 1 : i;
}
@@ -45,7 +48,9 @@ public class MixinRenderGlobal_ItemRenderDist {
if (flag && entity instanceof EntityItem) {
final int i = Math.min((int) (entity.getDistanceSq(d0, d1, d2) / 4.0D), 255);
sodium$entityItemCount[i]++;
return i <= sodium$itemRenderDist;
final boolean doRender = i <= sodium$itemRenderDist && sodium$itemRenderedCount < sodium$itemLimit;
if (doRender) sodium$itemRenderedCount++;
return doRender;
}
return flag;
}
@@ -30,7 +30,6 @@ public abstract class MixinEntityLivingBase extends Entity {
vec31.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec31.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
vec31 = vec31.addVector(posX, posY + (double)getEyeHeight(), posZ);
NotFine.logger.info("Item broken, calling IWorldSpawnItemBreakParticle spawnItemBreakParticle");
((IWorldSpawnItemBreakParticle)worldObj).spawnItemBreakParticle(itemStack,
"iconcrack_" + Item.getIdFromItem(itemStack.getItem()),
vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05, vec3.zCoord);
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = RenderItem.class)
@Mixin(value = RenderItem.class, priority = 900)
public abstract class MixinRenderItem {
/**
@@ -1,18 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.shaders.startup;
import net.coderbot.iris.Iris;
import net.minecraft.client.gui.GuiMainMenu;
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;
@Mixin(GuiMainMenu.class)
public class MixinGuiMainMenu {
@Inject(method = "initGui", at = @At("RETURN"))
public void angelica$shadersOnLoadingComplete(CallbackInfo ci) {
Iris.onLoadingComplete();
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.shaders.startup;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import net.coderbot.iris.Iris;
import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft {
@Unique
private static boolean angelica$hasFirstInit;
@Inject(method = "startGame",
at = @At(value = "INVOKE",
remap = false,
shift = At.Shift.BEFORE,
target = "Lcpw/mods/fml/client/SplashProgress;clearVanillaResources(Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/util/ResourceLocation;)V"))
public void angelica$shadersOnLoadingComplete(CallbackInfo ci) {
if (!angelica$hasFirstInit && GLStateManager.isMainThread()) {
angelica$hasFirstInit = true;
Iris.onLoadingComplete();
}
}
}