-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds some changes for mixins, revises a bit of the caching, and provi…
…des some context for clickable widgets. Tested with continuity as well to ensure compatibility
- Loading branch information
1 parent
7d7ffd1
commit 6389dd9
Showing
8 changed files
with
123 additions
and
66 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/theomenden/bismuth/mixin/client/ClickableWidgetMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.theomenden.bismuth.mixin.client; | ||
|
||
import com.theomenden.bismuth.utils.BismuthColormaticResolution; | ||
import net.minecraft.client.gui.components.AbstractButton; | ||
import net.minecraft.client.gui.components.AbstractWidget; | ||
import net.minecraft.network.chat.Component; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(AbstractButton.class) | ||
public abstract class ClickableWidgetMixin extends AbstractWidget{ | ||
|
||
public ClickableWidgetMixin(int x, int y, int width, int height, Component message) { | ||
super(x, y, width, height, message); | ||
} | ||
|
||
@ModifyConstant(method="renderWidget", constant = @Constant(intValue = 16777215)) | ||
private int hoverColorProxy(int original) { | ||
var hoverColors = ObjectUtils.firstNonNull( | ||
BismuthColormaticResolution.COLORMATIC_COLOR_PROPERTIES, | ||
BismuthColormaticResolution.COLOR_PROPERTIES | ||
); | ||
|
||
int hoverColor = hoverColors.getProperties().getHoveredButtonText(); | ||
return hoverColor != 0 | ||
&& this.isActive() | ||
? hoverColor | ||
: original; | ||
} | ||
|
||
@ModifyConstant(method="renderWidget", constant = @Constant(intValue = 10526880)) | ||
private int disabledColorProxy(int original) { | ||
var hoverColors = ObjectUtils.firstNonNull( | ||
BismuthColormaticResolution.COLORMATIC_COLOR_PROPERTIES, | ||
BismuthColormaticResolution.COLOR_PROPERTIES | ||
); | ||
|
||
int disabledColor = hoverColors.getProperties().getDisabledButtonText(); | ||
return disabledColor != 0 ? disabledColor : original; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters