From f7f238036aa0c41825e8ced569b38ec7ff312d81 Mon Sep 17 00:00:00 2001 From: ACGaming <4818419+ACGaming@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:06:06 +0200 Subject: [PATCH] Remove Model Gap bugfix Currently not working with Forge's model code --- .../bugfixes/misc/modelgap/UTModelFix.java | 85 ------------------- .../mixin/UTItemModelGeneratorMixin.java | 39 --------- .../config/UTConfigBugfixes.java | 30 ------- .../universaltweaks/core/UTLoadingPlugin.java | 1 - .../assets/universaltweaks/lang/en_us.lang | 1 - .../assets/universaltweaks/lang/es_mx.lang | 1 - .../mixins.bugfixes.misc.modelgap.json | 7 -- src/main/resources/universaltweaks_at.cfg | 4 - 8 files changed, 168 deletions(-) delete mode 100644 src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/UTModelFix.java delete mode 100644 src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/mixin/UTItemModelGeneratorMixin.java delete mode 100644 src/main/resources/mixins.bugfixes.misc.modelgap.json diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/UTModelFix.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/UTModelFix.java deleted file mode 100644 index 92081d17..00000000 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/UTModelFix.java +++ /dev/null @@ -1,85 +0,0 @@ -package mod.acgaming.universaltweaks.bugfixes.misc.modelgap; - -import java.util.List; -import java.util.Set; - -import org.lwjgl.util.vector.Vector3f; -import net.minecraft.client.renderer.block.model.BlockPart; -import net.minecraft.client.renderer.block.model.ItemModelGenerator; -import net.minecraft.util.EnumFacing; - -import mod.acgaming.universaltweaks.config.UTConfigBugfixes; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -// Courtesy of MehVahdJukaar -public class UTModelFix -{ - public static boolean isHorizontal(ItemModelGenerator.SpanFacing spanFacing) - { - return spanFacing == ItemModelGenerator.SpanFacing.DOWN || spanFacing == ItemModelGenerator.SpanFacing.UP; - } - - public static void createOrExpandSpan(List listSpans, ItemModelGenerator.SpanFacing spanFacing, int pixelX, int pixelY) - { - int length; - ItemModelGenerator.Span existingSpan = null; - for (ItemModelGenerator.Span span2 : listSpans) - { - if (span2.getFacing() == spanFacing) - { - int i = isHorizontal(spanFacing) ? pixelY : pixelX; - if (span2.getAnchor() != i) continue; - // Skips faces with transparent pixels, so we can enlarge safely - if (UTConfigBugfixes.MISC.MODEL_GAP.utModelGapExpansion != 0 && span2.getMax() != (!isHorizontal(spanFacing) ? pixelY : pixelX) - 1) continue; - existingSpan = span2; - break; - } - } - length = isHorizontal(spanFacing) ? pixelX : pixelY; - if (existingSpan == null) - { - int newStart = isHorizontal(spanFacing) ? pixelY : pixelX; - listSpans.add(new ItemModelGenerator.Span(spanFacing, length, newStart)); - } - else existingSpan.expand(length); - } - - public static void enlargeFaces(CallbackInfoReturnable> cir) - { - float inc = (float) UTConfigBugfixes.MISC.MODEL_GAP.utModelGapRecess; - float inc2 = (float) UTConfigBugfixes.MISC.MODEL_GAP.utModelGapExpansion; - for (BlockPart e : cir.getReturnValue()) - { - Vector3f from = e.positionFrom; - Vector3f to = e.positionTo; - Set set = e.mapFaces.keySet(); - if (set.size() == 1) - { - EnumFacing dir = set.stream().findAny().get(); - switch (dir) - { - case UP: - { - from.set(from.getX() - inc2, from.getY() - inc, from.getZ() - inc2); - to.set(to.getX() + inc2, to.getY() - inc, to.getZ() + inc2); - } - case DOWN: - { - from.set(from.getX() - inc2, from.getY() + inc, from.getZ() - inc2); - to.set(to.getX() + inc2, to.getY() + inc, to.getZ() + inc2); - } - case WEST: - { - from.set(from.getX() - inc, from.getY() + inc2, from.getZ() - inc2); - to.set(to.getX() - inc, to.getY() - inc2, to.getZ() + inc2); - } - case EAST: - { - from.set(from.getX() + inc, from.getY() + inc2, from.getZ() - inc2); - to.set(to.getX() + inc, to.getY() - inc2, to.getZ() + inc2); - } - } - } - } - } -} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/mixin/UTItemModelGeneratorMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/mixin/UTItemModelGeneratorMixin.java deleted file mode 100644 index 75e4ec2a..00000000 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/modelgap/mixin/UTItemModelGeneratorMixin.java +++ /dev/null @@ -1,39 +0,0 @@ -package mod.acgaming.universaltweaks.bugfixes.misc.modelgap.mixin; - -import java.util.List; - -import net.minecraft.client.renderer.block.model.BlockPart; -import net.minecraft.client.renderer.block.model.ItemModelGenerator; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.bugfixes.misc.modelgap.UTModelFix; -import mod.acgaming.universaltweaks.config.UTConfigBugfixes; -import mod.acgaming.universaltweaks.config.UTConfigGeneral; -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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -// Courtesy of MehVahdJukaar -@Mixin(ItemModelGenerator.class) -public class UTItemModelGeneratorMixin -{ - @Inject(method = "getBlockParts(Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Ljava/lang/String;I)Ljava/util/List;", at = @At("RETURN")) - public void utEnlargeFaces(TextureAtlasSprite sprite, String texture, int tintIndex, CallbackInfoReturnable> cir) - { - if (!UTConfigBugfixes.MISC.MODEL_GAP.utModelGapToggle) return; - if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTItemModelGenerator ::: Enlarge faces"); - UTModelFix.enlargeFaces(cir); - } - - @Inject(method = "createOrExpandSpan", at = @At(value = "HEAD"), cancellable = true) - public void utCreateOrExpandSpan(List listSpans, ItemModelGenerator.SpanFacing spanFacing, int pixelX, int pixelY, CallbackInfo ci) - { - if (!UTConfigBugfixes.MISC.MODEL_GAP.utModelGapToggle) return; - if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTItemModelGenerator ::: Create or expand span"); - UTModelFix.createOrExpandSpan(listSpans, spanFacing, pixelX, pixelY); - ci.cancel(); - } -} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java index e1f3b7cc..fe34b3e0 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java @@ -327,10 +327,6 @@ public static class EntityListsCategory public static class MiscCategory { - @Config.LangKey("cfg.universaltweaks.bugfixes.misc.modelgap") - @Config.Name("Model Gap") - public final ModelGapCategory MODEL_GAP = new ModelGapCategory(); - @Config.RequiresMcRestart @Config.Name("Accurate Smooth Lighting") @Config.Comment("Improves the accuracy of smooth lighting by checking for suffocation and light opacity") @@ -383,32 +379,6 @@ public static class MiscCategory "Incompatible with SpongeForge and RandomPatches" }) public int utPacketSize = 0x1000000; - - public static class ModelGapCategory - { - @Config.RequiresMcRestart - @Config.Name("[1] Model Gap Toggle") - @Config.Comment("Fixes transparent gaps in all 3D models of blocks and items") - public boolean utModelGapToggle = true; - - @Config.Name("[2] Recess Value") - @Config.Comment - ({ - "Quad X/Y offset", - "Moves the quad toward the center of the item", - "Use to hide gaps, keep as close to 0 as possible" - }) - public double utModelGapRecess = 0.007D; - - @Config.Name("[3] Expansion Value") - @Config.Comment - ({ - "Quad expansion increment", - "Enlarges each quad", - "Use to hide gaps, keep as close to 0 as possible" - }) - public double utModelGapExpansion = 0.008D; - } } public static class WorldCategory diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 8683570f..21c9e3b6 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -175,7 +175,6 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.bugfixes.entities.entitylists.client.json", () -> UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utWorldAdditionsToggle); put("mixins.bugfixes.entities.villagermantle.json", () -> UTConfigBugfixes.ENTITIES.utVillagerMantleToggle); put("mixins.bugfixes.misc.depthmask.json", () -> UTConfigBugfixes.MISC.utDepthMaskToggle); - put("mixins.bugfixes.misc.modelgap.json", () -> UTConfigBugfixes.MISC.MODEL_GAP.utModelGapToggle); put("mixins.bugfixes.misc.potionamplifier.json", () -> UTConfigBugfixes.MISC.utPotionAmplifierVisibilityToggle); put("mixins.bugfixes.misc.smoothlighting.json", () -> UTConfigBugfixes.MISC.utAccurateSmoothLighting); put("mixins.bugfixes.misc.spectatormenu.json", () -> UTConfigBugfixes.MISC.utSpectatorMenuToggle); diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 219dbced..c7d70cc6 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -46,7 +46,6 @@ cfg.universaltweaks.config.world=World cfg.universaltweaks.bugfixes.blocks.blockoverlay=Block Overlay cfg.universaltweaks.bugfixes.entities.desync=Entity Desync cfg.universaltweaks.bugfixes.entities.entitylists=Entity Lists -cfg.universaltweaks.bugfixes.misc.modelgap=Model Gap cfg.universaltweaks.modintegration.abyssalcraft=AbyssalCraft cfg.universaltweaks.modintegration.actuallyadditions=Actually Additions diff --git a/src/main/resources/assets/universaltweaks/lang/es_mx.lang b/src/main/resources/assets/universaltweaks/lang/es_mx.lang index 3bd236e9..48b6e140 100644 --- a/src/main/resources/assets/universaltweaks/lang/es_mx.lang +++ b/src/main/resources/assets/universaltweaks/lang/es_mx.lang @@ -30,7 +30,6 @@ cfg.universaltweaks.config.world=Mundo cfg.universaltweaks.bugfixes.blocks.blockoverlay=Block Overlay cfg.universaltweaks.bugfixes.entities.desync=Entity Desync -cfg.universaltweaks.bugfixes.misc.modelgap=Brechas en modelos cfg.universaltweaks.modintegration.abyssalcraft=AbyssalCraft cfg.universaltweaks.modintegration.actuallyadditions=Actually Additions diff --git a/src/main/resources/mixins.bugfixes.misc.modelgap.json b/src/main/resources/mixins.bugfixes.misc.modelgap.json deleted file mode 100644 index 7d6d490c..00000000 --- a/src/main/resources/mixins.bugfixes.misc.modelgap.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "package": "mod.acgaming.universaltweaks.bugfixes.misc.modelgap.mixin", - "refmap": "universaltweaks.refmap.json", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_8", - "client": ["UTItemModelGeneratorMixin"] -} \ No newline at end of file diff --git a/src/main/resources/universaltweaks_at.cfg b/src/main/resources/universaltweaks_at.cfg index 9a95326e..a7878d23 100644 --- a/src/main/resources/universaltweaks_at.cfg +++ b/src/main/resources/universaltweaks_at.cfg @@ -2,10 +2,6 @@ public-f net.minecraft.entity.ai.attributes.RangedAttribute field_111118_b # maximumValue public-f net.minecraft.entity.ai.attributes.RangedAttribute field_111120_a # minimumValue -# Model Gap -public net.minecraft.client.renderer.block.model.ItemModelGenerator$Span -public net.minecraft.client.renderer.block.model.ItemModelGenerator$SpanFacing - # Parry public net.minecraft.entity.projectile.EntityThrowable field_70192_c # EntityThrowable thrower public net.minecraft.entity.EntityLivingBase func_184583_d(Lnet/minecraft/util/DamageSource;)Z # EntityLivingBase canBlockDamageSource