Make spell scrolls implement IWorkbenchItem and have 1 slot
This means the book doesn't leave the workbench until the scrolls are taken out, which is good for automation - however, canPlace always returns false so they can't be put back in, kinda like the furnace output
This commit is contained in:
@@ -11,6 +11,7 @@ import electroblob.wizardry.util.SpellModifiers;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
@@ -22,7 +23,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemScroll extends Item implements ISpellCastingItem {
|
public class ItemScroll extends Item implements ISpellCastingItem, IWorkbenchItem {
|
||||||
|
|
||||||
/** The maximum number of ticks a continuous spell scroll can be cast for (by holding the use item button). */
|
/** The maximum number of ticks a continuous spell scroll can be cast for (by holding the use item button). */
|
||||||
public static final int CASTING_TIME = 120;
|
public static final int CASTING_TIME = 120;
|
||||||
@@ -222,4 +223,24 @@ public class ItemScroll extends Item implements ISpellCastingItem {
|
|||||||
public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack){
|
public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack){
|
||||||
return Wizardry.proxy.getFontRenderer(stack);
|
return Wizardry.proxy.getFontRenderer(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSpellSlotCount(ItemStack stack){
|
||||||
|
return 1; // Stop spell books immediately leaving the workbench when a scroll is enchanted
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlace(ItemStack stack){
|
||||||
|
return false; // Prevent players putting scrolls back in the workbench
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onApplyButtonPressed(EntityPlayer player, Slot centre, Slot crystals, Slot upgrade, Slot[] spellBooks){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showTooltip(ItemStack stack){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user