Skip to content

Commit

Permalink
Fix MC-145260
Browse files Browse the repository at this point in the history
  • Loading branch information
Rektroth committed Oct 24, 2024
1 parent 3af917c commit adcd5fd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Whiteout is an attempt to implement the gameplay and mechanic consistency patche
| [MC-108513](https://bugs.mojang.com/browse/MC-108513) | Paper || End crystal did not spawn/despawn correct after enderdragon respawned |
| [MC-123450](https://bugs.mojang.com/browse/MC-123450) | Paper | ✔️ | Item frames play sounds when the item within them is read from NBT |
| [MC-123848](https://bugs.mojang.com/browse/MC-123848) | Paper | ✔️ | Item frames (and items within) when removed from a ceiling, drop atop, not under, the block |
| [MC-145260](https://bugs.mojang.com/browse/MC-145260) | Paper || Whitelist on state inconsistency |
| [MC-147659](https://bugs.mojang.com/browse/MC-147659) | Paper || Some witch huts spawn the incorrect cat |
| [MC-153086](https://bugs.mojang.com/browse/MC-153086) | Paper | ✔️ | Beacons always play deactivating sound when broken, even when not powered |
| [MC-157464](https://bugs.mojang.com/browse/MC-157464) | Paper | ✔️ | Villagers move around in bed or even leave the bed when food is thrown at them |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Patch for MC-145260
*
* Authored for CraftBukkit/Spigot by Aikar <[email protected]> on March 2, 2019.
* Ported to Fabric by Rektroth <[email protected]> on October 13, 2024.
*/

package io.github.rektroth.whiteout.mixin.mc145260;

import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager;
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.CallbackInfoReturnable;

@Mixin(MinecraftServer.class)
public abstract class MinecraftServerMixin {
@Shadow
private boolean enforceWhitelist;

@Shadow
private PlayerManager playerManager;

/**
* Modifies the target method to return {@code true} only if the whitelist is also enabled.
* @param cir The return callback.
*/
@Inject(at = @At("RETURN"), cancellable = true, method = "isEnforceWhitelist")
private void isEnforceWhitelistAndWhitelistEnabled(CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(this.enforceWhitelist && this.playerManager.isWhitelistEnabled());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mc84789=true
mc108513=false
mc123450=true
mc123848=true
mc145260=false
mc147659=false
mc153086=true
mc157464=true
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/whiteout.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"mc108513.EndSpikeFeatureMixin",
"mc123450.ItemFrameEntityMixin",
"mc123848.ItemFrameEntityMixin",
"mc145260.MinecraftServerMixin",
"mc147659.CatSpawnMixin",
"mc153086.BeaconBlockEntityMixin",
"mc157464.VillagerTaskListProviderMixin",
Expand Down

0 comments on commit adcd5fd

Please sign in to comment.