Skip to content

Commit

Permalink
Fix MC-147659
Browse files Browse the repository at this point in the history
  • Loading branch information
Rektroth committed Oct 24, 2024
1 parent 959a73a commit 3af917c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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-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 |
| [MC-158900](https://bugs.mojang.com/browse/MC-158900) | Paper || "bad packet id 26" upon connecting after tempban expire |
Expand Down Expand Up @@ -52,7 +53,6 @@ If you wish to enable them, you will have to do so in `.minecraft/configs/whiteo
| [MC-99075](https://bugs.mojang.com/browse/MC-99075) | Paper | Cancelled block place (spawn protection) causes inventory desync |
| [MC-121706](https://bugs.mojang.com/browse/MC-121706) | Purpur | Skeletons and illusioners aren't looking up / down at their target while strafing |
| [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-157395](https://bugs.mojang.com/browse/MC-157395) | Spigot | Small armor stands drop no loot table |
| [MC-174630](https://bugs.mojang.com/browse/MC-174630) | Paper | Secondary beacon effect remains when switching primary effect |
| [MC-179072](https://bugs.mojang.com/browse/MC-179072) | Paper | Creepers do not defuse when switching from Survival to Creative/Spectator |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Patch for MC-147659
*
* Authored for CraftBukkit/Spigot by Jake Potrebic <[email protected]> on July 11, 2022.
* Ported to Fabric by Rektroth <[email protected]> on July 4, 2024.
*/

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

import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import net.minecraft.entity.passive.CatEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.spawner.CatSpawner;
import org.spongepowered.asm.mixin.Mixin;
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;

@Mixin(CatSpawner.class)
public abstract class CatSpawnMixin {
/**
* Sets the cat's position before it's type is set.
* @param pos The cat's spawn position.
* @param world boilerplate
* @param cir boilerplate
* @param catEntity The cat.
*/
@Inject(
at = @At(
target = "Lnet/minecraft/entity/passive/CatEntity;initialize(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;)Lnet/minecraft/entity/EntityData;",
value = "INVOKE"
),
method = "spawn(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/server/world/ServerWorld;)I"
)
private void refreshPositionAndAnglesBeforeInitialize(
BlockPos pos,
ServerWorld world,
CallbackInfoReturnable<Integer> cir,
@Local LocalRef<CatEntity> catEntity
) {
CatEntity cat2 = catEntity.get();
cat2.refreshPositionAndAngles(pos, 0.0F, 0.0F);
catEntity.set(cat2);
}

/**
* Skips the old position set.
* @param instance boilerplate
* @param blockPos boilerplate
* @param yaw boilerplate
* @param pitch boilerplate
*/
@Redirect(
at = @At(
target = "Lnet/minecraft/entity/passive/CatEntity;refreshPositionAndAngles(Lnet/minecraft/util/math/BlockPos;FF)V",
value = "INVOKE"
),
method = "spawn(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/server/world/ServerWorld;)I"
)
private void skipRefreshPositionAndAngles(CatEntity instance, BlockPos blockPos, float yaw, float pitch) {
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mc84789=true
mc108513=false
mc123450=true
mc123848=true
mc147659=false
mc153086=true
mc157464=true
mc158900=false
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",
"mc147659.CatSpawnMixin",
"mc153086.BeaconBlockEntityMixin",
"mc157464.VillagerTaskListProviderMixin",
"mc158900.PlayerManagerMixin",
Expand Down

0 comments on commit 3af917c

Please sign in to comment.