Skip to content

Commit

Permalink
Merge branch 'main' into bossbar-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest authored Dec 30, 2024
2 parents bfcb129 + 3dd2fba commit f808bff
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

@Mixin(EventBus.class)
public interface EventBusAccessor {
@Accessor
@Accessor(remap = false)
int getBusID();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Mixin(targets = "Config")
public interface ConfigAccessor {
@Dynamic("OptiFine")
@Invoker
@Invoker(remap = false)
static boolean invokeIsCustomColors() {
throw new AssertionError("Mixin did not inject");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Mixin(targets = "net.optifine.CustomColors")
public interface CustomColorsAccessor {
@Dynamic("OptiFine")
@Invoker
@Invoker(remap = false)
public static int invokeGetTextColor(int index, int color) {
throw new AssertionError("Mixin failed to inject into OptiFine");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Mixin(BlockChest.class)
public class BlockChestMixin_VanillaSlabChests {
//#if MC<11200
@Redirect(method = "isBelowSolidBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSideSolid(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;Z)Z"))
@Redirect(method = "isBelowSolidBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSideSolid(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;Z)Z", remap = false), remap = true)
public boolean patcher$isBelowSolidBlock(World instance, BlockPos blockPos, EnumFacing enumFacing, boolean b) {
return ((BlockExt) instance.getBlockState(blockPos).getBlock()).patcher$doesSideBlockChestOpening(instance, blockPos, enumFacing);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
@Mixin(Block.class)
public abstract class BlockMixin_VanillaSlabChests implements BlockExt {
//#if MC<11200
@Shadow
@Shadow(remap = false)
public abstract String getRegistryName();

@Shadow
public abstract boolean isNormalCube();

@Shadow
@Shadow(remap = false)
public abstract boolean isSideSolid(IBlockAccess par1, BlockPos par2, EnumFacing par3);

public boolean patcher$doesSideBlockChestOpening(IBlockAccess world, BlockPos pos, EnumFacing side) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import org.spongepowered.asm.mixin.injection.ModifyArg;

@Pseudo
@Mixin(targets = "club.sk1er.mods.levelhead.render.AboveHeadRender")
@Mixin(targets = "club.sk1er.mods.levelhead.render.AboveHeadRender", remap = false)
public class AboveHeadRender_ReFixNametagPerspective {

@Dynamic("Levelhead")
@ModifyArg(method = "renderName", at = @org.spongepowered.asm.mixin.injection.At(value = "INVOKE", target = "Lgg/essential/universal/UGraphics$GL;rotate(FFFF)V", ordinal = 1), index = 0)
@ModifyArg(method = "renderName", at = @org.spongepowered.asm.mixin.injection.At(value = "INVOKE", target = "Lgg/essential/universal/UGraphics$GL;rotate(FFFF)V", ordinal = 1), index = 0, remap = false)
private float patcher$fixNametagPerspective(float f) {
GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
if (gameSettings != null && gameSettings.thirdPersonView == 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class RenderGlobalMixin_FixSkyVBOs {

@Dynamic("OptiFine")
@Shadow
@Shadow(remap = false)
private int renderDistance;

@Dynamic("OptiFine")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Mixin(GuiModList.class)
public class GuiModListMixin_RemoveDummyPatcherMod {

@Shadow
@Shadow(remap = false)
private ArrayList<ModContainer> mods;

@Inject(method = "<init>", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class ImageBufferDownload_EarsMod {

@Dynamic("Ears Mod")
@Redirect(method = "parseUserSkin", at = @At(value = "INVOKE", target = "Lcom/unascribed/ears/Ears;preprocessSkin(Lnet/minecraft/client/renderer/ImageBufferDownload;Ljava/awt/image/BufferedImage;Ljava/awt/image/BufferedImage;)V"))
@Redirect(method = "parseUserSkin", at = @At(value = "INVOKE", target = "Lcom/unascribed/ears/Ears;preprocessSkin(Lnet/minecraft/client/renderer/ImageBufferDownload;Ljava/awt/image/BufferedImage;Ljava/awt/image/BufferedImage;)V", remap = false), remap = true)
private void preprocessSkin(ImageBufferDownload subject, BufferedImage rawImg, BufferedImage img) {
// this will never work because the way they find the locals is really really fragile and doesn't work with this mixin
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,26 @@ public abstract class WorldMixin_CameraPerspective {
Blocks.iron_bars
);

@Redirect(method = "rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;getCollisionBoundingBox(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/util/AxisAlignedBB;", ordinal = 1))
private AxisAlignedBB patcher$shouldCancel(Block instance, World world, BlockPos blockPos, IBlockState iBlockState) {
@Redirect(method = "rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;", at = @At(value = "INVOKE", target =
//#if MC<=10809
"Lnet/minecraft/block/Block;getCollisionBoundingBox(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/util/AxisAlignedBB;"
//#else
//$$ "Lnet/minecraft/block/state/IBlockState;getCollisionBoundingBox(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/AxisAlignedBB;"
//#endif
, ordinal = 1))
private AxisAlignedBB patcher$shouldCancel(
//#if MC<=10809
Block instance, World world, BlockPos blockPos, IBlockState iBlockState
//#else
//$$ IBlockState iBlockState, net.minecraft.world.IBlockAccess iBlockAccess, BlockPos blockPos
//#endif
) {
if (PatcherConfig.betterCamera && patcher$ignoredBlocks.contains(iBlockState.getBlock())) return null;
return instance.getCollisionBoundingBox(world, blockPos, iBlockState);
return
//#if MC<=10809
instance.getCollisionBoundingBox(world, blockPos, iBlockState);
//#else
//$$ iBlockState.getCollisionBoundingBox(iBlockAccess, blockPos);
//#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class EntityRendererMixin_LeftHandedness {
@Dynamic("OptiFine adds its own version of renderHand")
@Inject(
method = {"renderHand(FI)V", "renderHand(FIZZZ)V", "func_78476_b"},
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;enableLightmap()V", shift = At.Shift.AFTER)
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;enableLightmap()V", shift = At.Shift.AFTER, remap = true),
remap = false
)
private void patcher$flipHandSide(CallbackInfo ci) {
ItemRendererHook.isRenderingItemInFirstPerson = true;
Expand All @@ -41,7 +42,8 @@ public class EntityRendererMixin_LeftHandedness {
@Dynamic("OptiFine adds its own version of renderHand")
@Inject(
method = {"renderHand(FI)V", "renderHand(FIZZZ)V", "func_78476_b"},
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;disableLightmap()V")
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;disableLightmap()V", remap = true),
remap = false
)
private void patcher$resetFrontFace(CallbackInfo ci) {
if (PatcherConfig.leftHandInFirstPerson) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

@Mixin(ItemRenderer.class)
public class ItemRendererMixin_LeftHandedness {
//#if MC==10809
@ModifyConstant(method = "rotateWithPlayerRotations", constant = @Constant(floatValue = 1f, ordinal = 1))
private float leftHandRotate(float constant) {
return PatcherConfig.leftHandInFirstPerson ? -constant : constant;
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@

@Mixin(RenderFish.class)
public class RenderFishMixin_LeftHandedness {
//#if MC==10809
@ModifyVariable(method = "doRender(Lnet/minecraft/entity/projectile/EntityFishHook;DDDFF)V", at = @At(value = "STORE", ordinal = 0))
private Vec3 patcher$flipFishingLine(Vec3 original) {
if (PatcherConfig.leftHandInFirstPerson) {
return new Vec3(-original.xCoord, original.yCoord, original.zCoord);
}
return original;
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private List<IResourceManagerReloadListener> redirectNotifyReloadListeners(Simpl
}
}

@Inject(method = "notifyReloadListeners", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/ProgressManager;pop(Lnet/minecraftforge/fml/common/ProgressManager$ProgressBar;)V"))
@Inject(method = "notifyReloadListeners", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/ProgressManager;pop(Lnet/minecraftforge/fml/common/ProgressManager$ProgressBar;)V", remap = false), remap = true)
private void callOptiFineLanguage(CallbackInfo ci) {
if (ResourceReloadHooks.shouldLoadLanguage()) {
ResourceReloadHooks.reloadOptiFineLanguage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class TileEntityRendererDispatcherMixin_BatchDraw {
patcher$drawingBatch = false;
}

@Redirect(method = "renderTileEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z"))
@Redirect(method = "renderTileEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z", remap = false), remap = true)
private boolean patcher$renderTileEntity(TileEntity instance) {
return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer();
}

@Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntity;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z"))
@Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntity;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z", remap = false), remap = true)
private boolean patcher$renderTileEntityAt(TileEntity instance) {
return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@
import org.spongepowered.asm.mixin.Shadow;

@Mixin(FMLClientHandler.class)
public class FMLClientHandlerMixin_GetErrors implements FMLClientHandlerExt {
@Shadow
public class FMLClientHandlerMixin_GetErrors
//#if MC==10809
implements FMLClientHandlerExt
//#endif
{
//#if MC==10809
@Shadow(remap = false)
private MissingModsException modsMissing;

@Shadow
@Shadow(remap = false)
private WrongMinecraftVersionException wrongMC;

@Shadow
@Shadow(remap = false)
private CustomModLoadingErrorDisplayException customError;

@Shadow
@Shadow(remap = false)
private DuplicateModsFoundException dupesFound;

@Shadow
@Shadow(remap = false)
private ModSortingException modSorting;

@Override
public boolean patcher$hasErrors() {
return this.modsMissing != null || this.wrongMC != null || this.customError != null || this.dupesFound != null || this.modSorting != null;
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ModelLoader_SkipFirstBaking
{

//#if MC==10809
@Shadow
@Shadow(remap = false)
@Final
private Map<ModelResourceLocation, IModel> stateModels;
@Unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
public class MathHelperMixin_OFFastMath {

@Dynamic("OptiFine")
@Shadow
@Shadow(remap = false)
private static float[] SIN_TABLE_FAST;

@Dynamic("OptiFine")
@Shadow
@Shadow(remap = false)
private static float radToIndex;

@Dynamic("OptiFine")
@Shadow
@Shadow(remap = false)
public static boolean fastMath;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private EntrypointCaching() {

@SuppressWarnings("unused")
public List<ModContainer> discoverCachedEntrypoints(ModCandidate candidate, ASMDataTable table, JarFile file, MetadataCollection mc) {
if (!PatcherConfig.cacheEntrypoints) return null;
if (!PatcherConfig.cacheEntrypoints || readMap == null) return null;
File modFile = candidate.getModContainer();

String hash = getHash(modFile);
Expand Down Expand Up @@ -127,7 +127,7 @@ private void iterateThroughClass(boolean entry, ModCandidate candidate, ASMDataT

@SuppressWarnings("unused")
public void putCachedEntrypoints(ModCandidate candidate, ZipEntry ze) {
if (!PatcherConfig.cacheEntrypoints) return;
if (!PatcherConfig.cacheEntrypoints || readMap == null) return;
File modFile = candidate.getModContainer();
String modClass = ze.getName();

Expand All @@ -142,7 +142,7 @@ public void putCachedEntrypoints(ModCandidate candidate, ZipEntry ze) {

@SuppressWarnings("unused")
public void putCachedClassEntries(ModCandidate candidate, ZipEntry ze) {
if (!PatcherConfig.cacheEntrypoints) return;
if (!PatcherConfig.cacheEntrypoints || readMap == null) return;

File modFile = candidate.getModContainer();
String modClass = ze.getName();
Expand All @@ -155,7 +155,7 @@ public void putCachedClassEntries(ModCandidate candidate, ZipEntry ze) {
}

public void onInit() {
if (!PatcherConfig.cacheEntrypoints) return;
if (!PatcherConfig.cacheEntrypoints || readMap == null) return;
readMap = null;

File patcherDir = new File("patcher");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public List<String> getAvailableDevices(boolean useCache) {
private String[] getAvailableDevicesString() {
try {
return ALC10.alcGetString(null, ALC11.ALC_ALL_DEVICES_SPECIFIER).split("\0");
} catch (Exception ignored) {
} catch (Throwable ignored) {
try {
return ALC10.alcGetString(null, ALC10.ALC_DEVICE_SPECIFIER).split("\0");
} catch (Exception ignored2) {
} catch (Throwable ignored2) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void createAL() throws LWJGLException {
} else {
AL.create();
}
} catch (Exception e) {
} catch (Throwable e) {
Patcher.instance.getLogger().error("Failed to create device, using system default.", e);
AL.destroy();
AL.create();
Expand Down

0 comments on commit f808bff

Please sign in to comment.