Fix crash: defer ItemStack creation in InventoryMixin to avoid premature class init
This commit is contained in:
parent
983ee89eda
commit
dc24c2c39a
|
|
@ -40,7 +40,9 @@ import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
public class InventoryMixin
|
public class InventoryMixin
|
||||||
{
|
{
|
||||||
@Unique
|
@Unique
|
||||||
private static final ItemStack DUMMY_STACK = new ItemStack(Blocks.COBBLESTONE, 1);
|
private static ItemStack getDummyStack() {
|
||||||
|
return new ItemStack(Blocks.COBBLESTONE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public Player player;
|
public Player player;
|
||||||
|
|
@ -56,7 +58,7 @@ public class InventoryMixin
|
||||||
{
|
{
|
||||||
if(slot == selected && CarryOnDataManager.getCarryData(player).isCarrying())
|
if(slot == selected && CarryOnDataManager.getCarryData(player).isCarrying())
|
||||||
{
|
{
|
||||||
return DUMMY_STACK;
|
return getDummyStack();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return original.call(instance, slot);
|
return original.call(instance, slot);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user