AmarokIce / CoffeeDelight

An addon for Farmer's Delight!
Other
1 stars 3 forks source link

fabric 1.20.1: placing coffee cups (filled or unfilled) crashes if looking up or down #13

Open s4mothy opened 6 months ago

s4mothy commented 6 months ago

Note: Accessing this required me to recompile the code with the coffee_wafer and berries_wafer initialized the same as wafer. This shouldn't impact this issue, since it utilizes a different item's block placement.

Placing coffee cups as blocks while looking down (i.e. onto the floor below you) or up (i.e. below a block above you) crashes the game. Based on the crash report, this is caused by the method for handling block place directions using the opposite of the player's look direction (i.e. looking down returns up and looking up returns down, and facing needs the value to be north/south/west/east).

crash report placed facing down: crash-2024-04-24_02.00.22-client.txt crash report placed facing up: crash-2024-04-24_02.07.27-client.txt

s4mothy commented 6 months ago

This is also happening for directional blocks using CoffeePotBase, like the turkey_pot. Found the solution: if you replace the context.getPlayerLookDirection() in BlockCap.java:ln39 and CoffeePotBase.java:ln44 with getHorizontalPlayerFacing(), it fixes the crash for both.