Skip to content

Commit

Permalink
Merge branch 'build-0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainyaphthyl committed Sep 16, 2023
2 parents 907c89a + d51dc44 commit e514ebf
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 4 deletions.
21 changes: 19 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,39 @@ This is a **pre-release** version.

### Mod Versions

- Current version: `0.1.3`
- Previous version: `0.1.2`
- Current version: `0.1.4`
- Previous version: `0.1.3`
- Previous annotated version: `0.1.2`
- Previous release version: `null`

## Abstract

## New Features

### Game Phases

New sub-phase details in Game Phase Clocks:

| abbr | phase | arg 0 | arg 1 | arg 2 |
|:----:|:------------------:|:-------------:|:--------------:|:-----------------:|
| TT | Tile Tick | `long` delay | `int` priority | `long` relativeID |
| TEU | Tile Entity Update | `int` ordinal | \ | \ |

### Fix LAN Bugs

| Config | Issue | Side | Default |
|:-----------------------:|:---------------------------------------------------:|:----------:|:-------:|
| Fix LAN Quitting Freeze | [MC-72943](https://bugs.mojang.com/browse/MC-72943) | **server** | `true` |
| Fix LAN Skin Absence | [MC-52974](https://bugs.mojang.com/browse/MC-52974) | **server** | `true` |

### Miscellaneous

- Realm Page Access
- Side: client
- Type: Option List
- Default: `disabled`
- Values: `vanilla`, `disabled`, `invisible`

## Modified Features

## Code Changes
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ modId=potato_tech_kit
modName=Potato Tech Kit
# lowercase, without hyphens
modPureName=potteckit
modVersion=0.1.3
modVersion=0.1.4

malilibVersion=0.54.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import fi.dy.masa.malilib.config.option.HotkeyConfig;
import fi.dy.masa.malilib.config.option.HotkeyedBooleanConfig;
import fi.dy.masa.malilib.config.option.IntegerConfig;
import fi.dy.masa.malilib.config.option.OptionListConfig;
import fi.dy.masa.malilib.config.option.list.BlockListConfig;
import fi.dy.masa.malilib.registry.Registry;
import io.github.rainyaphthyl.potteckit.config.annotation.Config;
import io.github.rainyaphthyl.potteckit.config.annotation.Domain;
import io.github.rainyaphthyl.potteckit.config.annotation.Type;
import io.github.rainyaphthyl.potteckit.config.option.EnumRealmStatus;
import io.github.rainyaphthyl.potteckit.config.option.InvIntegerConfig;
import io.github.rainyaphthyl.potteckit.gui.GuiConfigScreen;
import io.github.rainyaphthyl.potteckit.gui.InvIntegerConfigWidget;
Expand Down Expand Up @@ -52,6 +54,12 @@ public class Configs {
public static final BlockListConfig blockStateTextureSyncList = BlockListConfig.create("block_state_texture_sync_list", ImmutableList.of(Blocks.HOPPER, Blocks.DROPPER, Blocks.DISPENSER));
@Config(types = {Type.TOGGLE, Type.HOTKEY}, domains = Domain.FIX, serverSide = true)
public static final HotkeyedBooleanConfig optifineSpawningFix = new HotkeyedBooleanConfig("optifine_spawning_fix", false, "", "optifine_spawning_fix", "optifine_spawning_fix");
@Config(types = {Type.TOGGLE, Type.HOTKEY}, domains = Domain.FIX, serverSide = true)
public static final HotkeyedBooleanConfig fixLanQuittingFreeze = new HotkeyedBooleanConfig("fix_lan_quit_freeze", true, "", "fix_lan_quit_freeze", "fix_lan_quit_freeze");
@Config(types = {Type.TOGGLE, Type.HOTKEY}, domains = Domain.FIX, serverSide = true)
public static final HotkeyedBooleanConfig fixLanSkinAbsence = new HotkeyedBooleanConfig("fix_lan_skin_absence", true, "", "fix_lan_skin_absence", "fix_lan_skin_absence");
@Config(types = {Type.TOGGLE, Type.HOTKEY}, domains = Domain.YEET)
public static final OptionListConfig<EnumRealmStatus> yeetRealmPage = new OptionListConfig<>("yeet_realm_page", EnumRealmStatus.DISABLED, EnumRealmStatus.list, "yeet_realm_page", "yeet_realm_page");

public static void registerOnInit() {
JsonModConfig jsonModConfig = new JsonModConfig(Reference.MOD_INFO, Reference.CONFIG_VERSION, ConfigHandler.optionCategoryList);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.github.rainyaphthyl.potteckit.config.option;

import com.google.common.collect.ImmutableList;
import fi.dy.masa.malilib.config.value.OptionListConfigValue;

public enum EnumRealmStatus implements OptionListConfigValue {
VANILLA("vanilla", "Vanilla"),
DISABLED("disabled", "Disabled"),
INVISIBLE("invisible", "Invisible");
public static final ImmutableList<EnumRealmStatus> list = ImmutableList.copyOf(values());
public final String name;
public final String description;

EnumRealmStatus(String name, String description) {
this.name = name;
this.description = description;
}

@Override
public String getName() {
return name;
}

@Override
public String getDisplayName() {
return description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.github.rainyaphthyl.potteckit.mixin.core;

import io.github.rainyaphthyl.potteckit.config.Configs;
import io.github.rainyaphthyl.potteckit.config.option.EnumRealmStatus;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiMainMenu.class)
public abstract class MixinGuiMainMenu {
@Shadow
private GuiButton realmsButton;

@Inject(method = "addSingleplayerMultiplayerButtons", at = @At(value = "RETURN"))
public void yeetRealmButton(int y1, int y2, CallbackInfo ci) {
EnumRealmStatus value = Configs.enablePotteckit.getValue() ? Configs.yeetRealmPage.getValue() : EnumRealmStatus.VANILLA;
switch (value) {
case INVISIBLE:
realmsButton.visible = false;
case DISABLED:
realmsButton.enabled = false;
break;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.github.rainyaphthyl.potteckit.mixin.core;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.PropertyMap;
import io.github.rainyaphthyl.potteckit.config.Configs;
import net.minecraft.client.Minecraft;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.Session;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import javax.annotation.Nonnull;

@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
@Shadow
@Final
private Session session;
@Shadow
@Final
private PropertyMap profileProperties;

@Shadow
public abstract MinecraftSessionService getSessionService();

@Redirect(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/integrated/IntegratedServer;initiateShutdown()V"))
public void skipDuplicateShutdown(@Nonnull IntegratedServer serverIn) {
boolean flag = Configs.fixLanQuittingFreeze.getBooleanValue() && Configs.enablePotteckit.getBooleanValue();
if (!flag) {
serverIn.initiateShutdown();
}
}

@Inject(method = "getProfileProperties", at = @At(value = "HEAD"))
public void addSignature(CallbackInfoReturnable<PropertyMap> cir) {
boolean flag = Configs.fixLanSkinAbsence.getBooleanValue() && Configs.enablePotteckit.getBooleanValue();
if (flag) {
if (profileProperties.isEmpty()) {
GameProfile profile = getSessionService().fillProfileProperties(session.getProfile(), true);
profileProperties.putAll(profile.getProperties());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.apache.logging.log4j.Logger;

public class Reference {
public static final String VERSION = "0.1.3";
public static final String VERSION = "0.1.4";
public static final ModVersion versionObj = ModVersion.getVersion(VERSION);
public static final String NAME = "PotatoTechKit";
public static final String SHORT_NAME = "potteckit";
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/assets/potteckit/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@ potteckit.config.comment.block_state_texture_sync_list=§6(Server-side Modificat
potteckit.config.name.optifine_spawning_fix=§6Optifine Spawning Fix§r
potteckit.config.comment.optifine_spawning_fix=§6(Server-side Modification)§r\nFixes the bug of Optifine that mob spawning is suppressed when a player has just joined the world, or that mob spawning continues when a player has just swapped to spectator mode, before the player moves across chunks.\nThis is unnecessary in liteloaded vanilla without Optifine.

potteckit.config.name.fix_lan_quit_freeze=§6Fix LAN Quitting Freeze§r
potteckit.config.comment.fix_lan_quit_freeze=§6(Single-player Only)§r\nFixes MC-72943 that the client probably gets frozen when quitting an "Open to LAN" server.
potteckit.config.name.fix_lan_skin_absence=§6Fix LAN Skin Absence§r
potteckit.config.comment.fix_lan_skin_absence=§6(Single-player Only)§r\nFixes MC-52974: Host's skin not visible to other players when in LAN world.\nThis option should be enabled on the host's client.
potteckit.config.name.yeet_realm_page=Realm Page Access
potteckit.config.comment.yeet_realm_page=Your client has been outdated and not compatible with Realms! You should not keep the button clickable! Keep playing 1.12.2 and forget it! :P

potteckit.hotkey.name.open_config_screen=Open Config Screen
potteckit.hotkey.comment.open_config_screen=Open the config screen of Potato Tech Kit.
2 changes: 2 additions & 0 deletions src/main/resources/mixins.potteckit.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"access.AccessRenderChunk",
"chunkgraph.MixinChunkProviderServer",
"chunkgraph.MixinTileEntityHopper",
"core.MixinGuiMainMenu",
"core.MixinMinecraft",
"core.MixinNetHandlerPlayClient",
"gamephase.MixinEntityTracker",
"gamephase.MixinIntegratedServer",
Expand Down

0 comments on commit e514ebf

Please sign in to comment.