added Herobrine

This commit is contained in:
FlorianMichael 2023-03-09 15:02:14 +01:00
parent 7f1af33818
commit e344d1165a
6 changed files with 21 additions and 11 deletions

View File

Before

Width:  |  Height:  |  Size: 401 KiB

After

Width:  |  Height:  |  Size: 401 KiB

View File

@ -41,7 +41,7 @@ ViaFabricPlus uses Gradle, to make sure that it is installed properly you can ch
## Settings
Settings are optional settings that can turn fixes on and off, originally they were used for debugging<br>
![](/image/settings.png)
![](/.github/images/settings.png)
## Addons
To make a ViaFabricPlus addon you just have to implement the ViaFabricPlusAddon interface in your main class:

View File

@ -8,7 +8,7 @@ yarn_mappings=1.19.3+build.5
loader_version=0.14.14
# viafabricplus
mod_version=1.7.5
mod_version=1.7.6
maven_group=de.florianmichael
archives_base_name=viafabricplus

View File

@ -17,8 +17,11 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.bridge;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
import de.florianmichael.viafabricplus.settings.groups.BridgeSettings;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
@ -35,17 +38,22 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.function.Supplier;
@Mixin(OptionsScreen.class)
public abstract class MixinOptionsScreen {
public abstract class MixinOptionsScreen extends Screen {
protected MixinOptionsScreen(Text title) {
super(title);
}
@Shadow protected abstract ButtonWidget createButton(Text message, Supplier<Screen> screenSupplier);
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/ClickableWidget;)Lnet/minecraft/client/gui/widget/ClickableWidget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
if (BridgeSettings.getClassWrapper().optionsButtonInGameOptions.getValue()) {
adder.add(this.createButton(Text.literal("ViaFabricPlus").styled(style -> style.withColor(Formatting.GOLD)).append(" ").append("Settings..."), () -> {
SettingsScreen.INSTANCE.prevScreen = (OptionsScreen) (Object) this;
return SettingsScreen.INSTANCE;
}));
adder.add(this.createButton(Text.literal("ViaFabricPlus").styled(style -> style.withColor(Formatting.GOLD)).append(" ").append("Settings..."), () -> SettingsScreen.get((OptionsScreen) (Object) this)));
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && MinecraftClient.getInstance().player != null) {
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
}
}
}
}

View File

@ -26,9 +26,6 @@ public class ModMenuImpl implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (ConfigScreenFactory<Screen>) parent -> {
SettingsScreen.INSTANCE.prevScreen = parent;
return SettingsScreen.INSTANCE;
};
return (ConfigScreenFactory<Screen>) SettingsScreen::get;
}
}

View File

@ -48,6 +48,11 @@ public class SettingsScreen extends Screen {
super(Text.literal("Values"));
}
public static SettingsScreen get(final Screen prevScreen) {
SettingsScreen.INSTANCE.prevScreen = prevScreen;
return SettingsScreen.INSTANCE;
}
@Override
protected void init() {
super.init();