Just enough wizardry!

- Adds JEI support for arcane workbench 'recipes' (charging, upgrading, and scroll enchantment)
- Adds an item transfer handler for said recipes, including bookshelf virtual slot support
- Prevents conjured items from showing up in JEI
This commit is contained in:
Electroblob77
2020-04-15 23:01:45 +01:00
parent 945c789482
commit 8301a24afe
12 changed files with 641 additions and 78 deletions
@@ -197,12 +197,8 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
// Show however many spell book slots are necessary
for(int i = 0; i < spellSlots; i++){
float angle = i * (2 * (float)Math.PI)/spellSlots;
int x = centreX + Math.round(SLOT_RADIUS * MathHelper.sin(angle));
// -cos because +y is downwards
int y = centreY + Math.round(SLOT_RADIUS * -MathHelper.cos(angle));
int x = centreX + getBookSlotXOffset(i, spellSlots);
int y = centreY + getBookSlotYOffset(i, spellSlots);
showSlot(i, x, y);
}
@@ -216,6 +212,20 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
}
}
/** Returns the x offset (relative to the central slot) of the ith book slot when the total number of book slots is
* equal to {@code bookSlotCount}. */
public static int getBookSlotXOffset(int i, int bookSlotCount){
float angle = i * (2 * (float)Math.PI) / bookSlotCount;
return Math.round(SLOT_RADIUS * MathHelper.sin(angle));
}
/** Returns the y offset (relative to the central slot) of the ith book slot when the total number of book slots is
* equal to {@code bookSlotCount}. */
public static int getBookSlotYOffset(int i, int bookSlotCount){
float angle = i * (2 * (float)Math.PI) / bookSlotCount;
return Math.round(SLOT_RADIUS * -MathHelper.cos(angle)); // -cos because +y is downwards
}
// FIXME: Shift-clicking a stack of special upgrades when in the arcane workbench causes the whole stack to be
// transferred when it should be just one (this is a bug with vanilla as well - try putting a stack of
// bottles into a brewing stand). I have at least made it so only one gets used now, so it has no impact on