mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-15 09:44:52 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eef3d2f50a | ||
|
|
3da597ab18 | ||
|
|
0e79380618 | ||
|
|
b639d5c646 | ||
|
|
0d209d426d | ||
|
|
bf24084033 | ||
|
|
9267ecc735 |
No files matched your search
+2
-2
@@ -68,7 +68,7 @@ configurations.all {
|
||||
dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.14:dev")
|
||||
|
||||
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.0.7") { transitive = false }
|
||||
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.1.0") { transitive = false }
|
||||
// runtimeOnlyNonPublishable("com.github.GTNewHorizons:lwjgl3ify:3.0.99")
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.42") { transitive = false }
|
||||
@@ -76,7 +76,7 @@ dependencies {
|
||||
|
||||
// Iris Shaders
|
||||
compileOnly('org.jetbrains:annotations:26.0.2')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.10.0:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.4:dev")
|
||||
|
||||
shadowImplementation(project(":glsm")) { transitive = false }
|
||||
shadowImplementation(project(":lwjgl3-backend")) { transitive = false }
|
||||
|
||||
@@ -1998,7 +1998,14 @@ public class GLStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** Shrink texture to 1x1 to free GPU memory, unbind from all units, but keep the name valid. */
|
||||
/**
|
||||
* Defer deleting textures until it has been reclaimed.
|
||||
* Why you might ask? In compat profile if you bind a texture that doesn't exist, ie a deleted texture,
|
||||
* mesa will silently create it for you, in core this is an error. Why would you be binding a deleted texture?
|
||||
* Damned if I know, but vanilla and mods do it... they create one, delete it, and then bind it....
|
||||
*
|
||||
* So... we shrink the texture to 1x1 to free GPU memory, unbind from all units, but keep the name valid.
|
||||
* */
|
||||
private static void deferDeleteTexture(int id) {
|
||||
if (id == 0) return;
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gtnewhorizons.angelica.event;
|
||||
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
|
||||
/**
|
||||
* Posted from {@link net.coderbot.iris.pipeline.HandRenderer}'s {@code canRender}
|
||||
* <p>
|
||||
* Cancel the event to prevent the hand from rendering.
|
||||
*/
|
||||
public record RenderHandEvent() implements RecordEvent, Cancellable {
|
||||
|
||||
public static final CancellableEventBus<RenderHandEvent> BUS = CancellableEventBus.create(RenderHandEvent.class);
|
||||
|
||||
private static final RenderHandEvent INSTANCE = new RenderHandEvent();
|
||||
|
||||
/**
|
||||
* @return true if a listener cancelled the event, meaning the hand should NOT render.
|
||||
*/
|
||||
public static boolean post() {
|
||||
if (!BUS.hasListeners()) return false;
|
||||
return BUS.post(INSTANCE);
|
||||
}
|
||||
}
|
||||
@@ -53,8 +53,15 @@ public final class AngelicaClientTweaker implements IFMLLoadingPlugin, IEarlyMix
|
||||
Launch.classLoader.addTransformerExclusion("com.gtnewhorizons.angelica.loading");
|
||||
Launch.classLoader.addTransformerExclusion("com.gtnewhorizons.angelica.glsm.GLStateManager");
|
||||
|
||||
if (Launch.blackboard.getOrDefault("angelica.rfbPluginLoaded", Boolean.FALSE) == Boolean.TRUE) {
|
||||
final boolean rfbLoaded = Launch.blackboard.getOrDefault("angelica.rfbPluginLoaded", Boolean.FALSE) == Boolean.TRUE;
|
||||
if (rfbLoaded) {
|
||||
addLwjgl3ifyExclusions();
|
||||
} else {
|
||||
// Fucking java 8 and non RFB
|
||||
try {
|
||||
Class.forName("com.gtnewhorizon.gtnhlib.core.GTNHLibCore", true, Launch.classLoader);
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -84,7 +91,6 @@ public final class AngelicaClientTweaker implements IFMLLoadingPlugin, IEarlyMix
|
||||
// packages to avoid interfering with mixin delegation on game classes. AngelicaLateTweaker removes this registration once
|
||||
// mixins are setup.
|
||||
if (FMLLaunchHandler.side().isClient()) {
|
||||
final boolean rfbLoaded = Launch.blackboard.getOrDefault("angelica.rfbPluginLoaded", Boolean.FALSE) == Boolean.TRUE;
|
||||
if (!rfbLoaded) {
|
||||
final String transformer = "com.gtnewhorizons.angelica.loading.fml.transformers.EarlyRedirectorTransformer";
|
||||
FMLRelaunchLog.finer("Registering transformer %s", transformer);
|
||||
|
||||
+10
-2
@@ -52,12 +52,20 @@ public class RFBAngelicaRedirector implements RfbClassTransformer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
public boolean transformClassIfNeeded(@NotNull ExtensibleClassLoader classLoader,
|
||||
@NotNull RfbClassTransformer.Context context, @Nullable Manifest manifest,
|
||||
@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
final boolean changed = inner.transformClassNode(className, classNode.getNode());
|
||||
if (changed) {
|
||||
classNode.computeMaxs();
|
||||
AngelicaClassDump.dumpRFBClass(className, classNode, this);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
transformClassIfNeeded(classLoader, context, manifest, className, classNode);
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -59,12 +59,20 @@ public class RFBCeleritasBlockTransformer implements RfbClassTransformer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
public boolean transformClassIfNeeded(@NotNull ExtensibleClassLoader classLoader,
|
||||
@NotNull RfbClassTransformer.Context context, @Nullable Manifest manifest,
|
||||
@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
final boolean changed = inner.transformClassNode(className, classNode.getNode());
|
||||
if (changed) {
|
||||
classNode.computeMaxs();
|
||||
AngelicaClassDump.dumpRFBClass(className, classNode, this);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
transformClassIfNeeded(classLoader, context, manifest, className, classNode);
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -49,11 +49,19 @@ public class RFBIsbrhTessellatorAbuseTransformer implements RfbClassTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
public boolean transformClassIfNeeded(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
if (inner.transformClassNode(classNode.getNode(), this.isObf)) {
|
||||
final boolean changed = inner.transformClassNode(classNode.getNode(), this.isObf);
|
||||
if (changed) {
|
||||
classNode.computeMaxs();
|
||||
AngelicaClassDump.dumpRFBClass(className, classNode, this);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
transformClassIfNeeded(classLoader, context, manifest, className, classNode);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.FallbackResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
@@ -50,8 +54,23 @@ public class EmissiveTextureAutoloader {
|
||||
loc.getResourceDomain(),
|
||||
"textures/blocks/" + loc.getResourcePath() + ".png"
|
||||
);
|
||||
|
||||
final IResourceManager resMan = Minecraft.getMinecraft().getResourceManager();
|
||||
if (resMan instanceof SimpleReloadableResourceManager simple) {
|
||||
FallbackResourceManager fallback = simple.domainResourceManagers.get(full.getResourceDomain());
|
||||
if (fallback != null) {
|
||||
for (IResourcePack rp : fallback.resourcePacks) {
|
||||
if (rp != null && rp.resourceExists(full)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback
|
||||
try {
|
||||
Minecraft.getMinecraft().getResourceManager().getResource(full);
|
||||
resMan.getResource(full);
|
||||
return true;
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.coderbot.iris.pipeline;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.Camera;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.GameModeUtil;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.InteractionHand;
|
||||
import com.gtnewhorizons.angelica.event.RenderHandEvent;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
|
||||
@@ -78,7 +79,8 @@ public class HandRenderer {
|
||||
!camera.isSleeping() &&
|
||||
!mc.gameSettings.hideGUI &&
|
||||
!GameModeUtil.isSpectator() &&
|
||||
!mc.playerController.enableEverythingIsScrewedUpMode();
|
||||
!mc.playerController.enableEverythingIsScrewedUpMode() &&
|
||||
!RenderHandEvent.post();
|
||||
}
|
||||
|
||||
public boolean isHandTranslucent(InteractionHand hand) {
|
||||
|
||||
-4
@@ -29,14 +29,10 @@ public abstract class MixinTextureMap extends AbstractTexture {
|
||||
@Final
|
||||
private String basePath;
|
||||
|
||||
@Shadow
|
||||
protected abstract void registerIcons();
|
||||
|
||||
@Inject(
|
||||
method = "loadTextureAtlas(Lnet/minecraft/client/resources/IResourceManager;)V",
|
||||
at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V", remap = false, shift = At.Shift.AFTER))
|
||||
private void modifyLoadTextureAtlas(IResourceManager manager, CallbackInfo ci) {
|
||||
this.registerIcons();
|
||||
TileLoader.registerIcons((TextureMap) (Object) this, this.basePath, this.mapRegisteredSprites);
|
||||
}
|
||||
|
||||
|
||||
+31
-28
@@ -10,43 +10,46 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.SimpleResource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Map;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@Mixin(TextureMap.class)
|
||||
public abstract class MixinTextureMap extends AbstractTexture implements ITickableTextureObject, IIconRegister {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<String, TextureAtlasSprite> mapRegisteredSprites;
|
||||
public abstract ResourceLocation completeResourceLocation(ResourceLocation p_147634_1_, int p_147634_2_);
|
||||
|
||||
@Shadow
|
||||
protected abstract ResourceLocation completeResourceLocation(ResourceLocation p_147634_1_, int p_147634_2_);
|
||||
@ModifyVariable(method = "registerIcon", at = @At(value = "STORE", ordinal = 3))
|
||||
private Object registerInterpolatedIcon(Object original){
|
||||
return createInterpolatedIcon(original);
|
||||
}
|
||||
|
||||
@Inject(method = "registerIcon", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;<init>(Ljava/lang/String;)V"), cancellable = true)
|
||||
private void registerInterpolatedIcon(String textureName, CallbackInfoReturnable<IIcon> cir) {
|
||||
try {
|
||||
IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(completeResourceLocation(new ResourceLocation(textureName), 0));
|
||||
if (resource instanceof SimpleResource) {
|
||||
//This returns IMetadataSections, which seems to already remove unused mcmeta fields in 1.7.10
|
||||
//I'm just running this to populate the mcmetaJson field more easily; this does it for us
|
||||
if (resource.getMetadata("animation") != null) {
|
||||
JsonObject mcmetaJson = ((SimpleResource) resource).mcmetaJson;
|
||||
if (mcmetaJson.getAsJsonObject("animation").getAsJsonPrimitive("interpolate").getAsBoolean()) {
|
||||
InterpolatedIcon interpolatedIcon = new InterpolatedIcon(textureName);
|
||||
mapRegisteredSprites.put(textureName, interpolatedIcon);
|
||||
cir.setReturnValue(interpolatedIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {/*Should quietly fail, no need to fail hard*/}
|
||||
}
|
||||
@ModifyVariable(method = "registerIcon", at = @At(value = "STORE", ordinal = 4))
|
||||
private Object registerInterpolatedIcon2(Object original){
|
||||
return createInterpolatedIcon(original);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private Object createInterpolatedIcon(Object original){
|
||||
TextureAtlasSprite tas = (TextureAtlasSprite) original;
|
||||
String textureName = tas.getIconName();
|
||||
try {
|
||||
IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(completeResourceLocation(new ResourceLocation(textureName), 0));
|
||||
if (resource instanceof SimpleResource) {
|
||||
//This returns IMetadataSections, which seems to already remove unused mcmeta fields in 1.7.10
|
||||
//I'm just running this to populate the mcmetaJson field more easily; this does it for us
|
||||
if (resource.getMetadata("animation") != null) {
|
||||
JsonObject mcmetaJson = ((SimpleResource) resource).mcmetaJson;
|
||||
if (mcmetaJson.getAsJsonObject("animation").getAsJsonPrimitive("interpolate").getAsBoolean()) {
|
||||
return new InterpolatedIcon(textureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {/*Should quietly fail, no need to fail hard*/}
|
||||
return original;
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -52,12 +52,19 @@ public class RFBUmbraRedirector implements RfbClassTransformer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
public boolean transformClassIfNeeded(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
final boolean changed = inner.transformClassNode(className, classNode.getNode());
|
||||
if (changed) {
|
||||
classNode.computeMaxs();
|
||||
UmbraClassDump.dumpRFBClass(className, classNode, this);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
|
||||
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||
transformClassIfNeeded(classLoader, context, manifest, className, classNode);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user