Fixed fishes going above the player's head when fished

master
Wynd 2023-04-06 23:56:45 +03:00
parent 127e17d470
commit 02905fb0fc
4 changed files with 40 additions and 2 deletions

View File

@ -118,6 +118,16 @@ After:
</details>
<details><summary>Fixes fishes going above the player's head</summary>
Before:<br>
<video controls src="https://i.imgur.com/jrjL1tW.mp4" />
After:<br>
<video controls src="https://i.imgur.com/5JPT81N.mp4" />
</details>
## Troubleshooting
**Q: My achievements screen is all messed up**

View File

@ -4,6 +4,8 @@ import java.lang.management.ManagementFactory;
import java.util.Random;
import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
public class WyHelper {
@ -24,7 +26,7 @@ public class WyHelper {
Random rand = new Random();
// player.level.playSound(player, "random.break", 1, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
// player.dropItem(new ItemInstance(ItemType.pickaxeGold, 1, 100), false);
player.dropItem(new ItemInstance(ItemType.fishingRod, 1), false);
// player.dropItem(new ItemInstance(Tile.STONE, 64), false);
// player.level.playLevelEvent((Player)null, 1005, (int)player.x, (int)player.y, (int)player.z, 0);

View File

@ -0,0 +1,25 @@
package xyz.pixelatedw.betterbeta.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import net.minecraft.entity.FishHook;
import net.minecraft.entity.ItemEntity;
@Mixin(FishHook.class)
public class FishHookMixin {
@ModifyArgs(method = "method_956", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/Level;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
private void onFishCaught(Args args) {
ItemEntity item = args.get(0);
FishHook hook = (FishHook) (Object) this;
double x = hook.field_1067.x - hook.x;
double y = hook.field_1067.y - hook.y;
double z = hook.field_1067.z - hook.z;
item.velocityX = x * 0.1D;
item.velocityY = y * 0.1D + Math.sqrt(Math.sqrt(x * x + y * y + z * z)) * 0.05D;
item.velocityZ = z * 0.1D;
}
}

View File

@ -20,7 +20,8 @@
"ItemInstanceMixin",
"MinecraftMixin",
"MinecartMixin",
"LivingEntityRendererMixin"
"LivingEntityRendererMixin",
"FishHookMixin"
],
"injectors": {
"defaultRequire": 1