mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-22 21:42:44 +01:00
make gui better, fixed item filter
This commit is contained in:
parent
13cc3638a1
commit
e40aa02544
@ -1,6 +1,5 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.ItemReleaseVersionDefinition;
|
||||
import de.florianmichael.viafabricplus.value.ValueHolder;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -15,9 +14,9 @@ public class MixinItemGroup_EntriesImpl {
|
||||
|
||||
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||
public boolean removeUnknownItems(Item instance, FeatureSet featureSet) {
|
||||
if ((ItemReleaseVersionDefinition.getCurrentMap().contains(instance) && ValueHolder.removeNotAvailableItemsFromCreativeTab.getValue()) || MinecraftClient.getInstance().isInSingleplayer()) {
|
||||
return instance.isEnabled(featureSet);
|
||||
}
|
||||
if (!ValueHolder.removeNotAvailableItemsFromCreativeTab.getValue() || MinecraftClient.getInstance().isInSingleplayer()) return instance.isEnabled(featureSet);
|
||||
if (ItemReleaseVersionDefinition.getCurrentMap().contains(instance)) return instance.isEnabled(featureSet);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.value.ValueHolder;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
@ -15,15 +16,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public class MixinItemGroups {
|
||||
|
||||
@Unique
|
||||
private static ComparableProtocolVersion protocolhack_version;
|
||||
private static ComparableProtocolVersion viafabricplus_version;
|
||||
|
||||
@Unique
|
||||
private static boolean viafabricplus_state;
|
||||
|
||||
@Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
|
||||
private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
|
||||
return instance.equals(o) && protocolhack_version == ViaLoadingBase.getTargetVersion();
|
||||
return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getTargetVersion() && viafabricplus_state == ValueHolder.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
}
|
||||
|
||||
@Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE))
|
||||
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable<Boolean> cir) {
|
||||
protocolhack_version = ViaLoadingBase.getTargetVersion();
|
||||
viafabricplus_version = ViaLoadingBase.getTargetVersion();
|
||||
viafabricplus_state = ValueHolder.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class ValuesScreen extends Screen {
|
||||
protocolSyncBooleanValue.setSyncWithProtocol(!protocolSyncBooleanValue.isSyncWithProtocol());
|
||||
ScreenUtil.playClickSound();
|
||||
}
|
||||
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT && !protocolSyncBooleanValue.isSyncWithProtocol()) {
|
||||
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||
protocolSyncBooleanValue.setValue(!protocolSyncBooleanValue.getValue());
|
||||
ScreenUtil.playClickSound();
|
||||
}
|
||||
@ -113,11 +113,10 @@ public class ValuesScreen extends Screen {
|
||||
final boolean isEnabled = booleanValue.getValue();
|
||||
drawCenteredText(matrices, textRenderer, (isEnabled ? Formatting.UNDERLINE : "") + booleanValue.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isEnabled ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
} else if (value instanceof ProtocolSyncBooleanValue protocolSyncBooleanValue) {
|
||||
final boolean isEnabled = protocolSyncBooleanValue.value;
|
||||
final boolean isEnabled = protocolSyncBooleanValue.getValue();
|
||||
Color color = isEnabled ? Color.GREEN : Color.RED;
|
||||
if (protocolSyncBooleanValue.isSyncWithProtocol()) {
|
||||
drawStringWithShadow(matrices, textRenderer, "Sync", entryWidth - textRenderer.getWidth("Sync") - 3, entryHeight / 2 - textRenderer.fontHeight / 2, Color.ORANGE.getRGB());
|
||||
color = color.darker().darker();
|
||||
}
|
||||
drawStringWithShadow(matrices, textRenderer, (isEnabled ? Formatting.UNDERLINE.toString() : "") + protocolSyncBooleanValue.getName(), 3, entryHeight / 2 - textRenderer.fontHeight / 2, color.getRGB());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user