Initial 1.11.2 update
This commit is contained in:
@@ -16,57 +16,57 @@ import net.minecraft.world.World;
|
||||
|
||||
public class PocketFurnace extends Spell {
|
||||
|
||||
public PocketFurnace() {
|
||||
public PocketFurnace(){
|
||||
super(Tier.APPRENTICE, 30, Element.FIRE, "pocket_furnace", SpellType.UTILITY, 40, EnumAction.BOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers) {
|
||||
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
int usesLeft = 5;
|
||||
|
||||
|
||||
ItemStack stack, result;
|
||||
|
||||
for(int i=0; i<caster.inventory.getSizeInventory() && usesLeft > 0; i++){
|
||||
|
||||
|
||||
for(int i = 0; i < caster.inventory.getSizeInventory() && usesLeft > 0; i++){
|
||||
|
||||
stack = caster.inventory.getStackInSlot(i);
|
||||
|
||||
if(stack != null){
|
||||
|
||||
if(!stack.isEmpty()){
|
||||
|
||||
result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
||||
|
||||
|
||||
if(result != null){
|
||||
if(stack.stackSize <= usesLeft){
|
||||
ItemStack stack2 = new ItemStack(result.getItem(), stack.stackSize, result.getItemDamage());
|
||||
if(stack.getCount() <= usesLeft){
|
||||
ItemStack stack2 = new ItemStack(result.getItem(), stack.getCount(), result.getItemDamage());
|
||||
if(WizardryUtilities.doesPlayerHaveItem(caster, result.getItem())){
|
||||
caster.inventory.addItemStackToInventory(stack2);
|
||||
caster.inventory.setInventorySlotContents(i, null);
|
||||
}else{
|
||||
caster.inventory.setInventorySlotContents(i, stack2);
|
||||
}
|
||||
usesLeft -= stack.stackSize;
|
||||
usesLeft -= stack.getCount();
|
||||
}else{
|
||||
caster.inventory.decrStackSize(i, usesLeft);
|
||||
caster.inventory.addItemStackToInventory(new ItemStack(result.getItem(), usesLeft, result.getItemDamage()));
|
||||
caster.inventory.addItemStackToInventory(
|
||||
new ItemStack(result.getItem(), usesLeft, result.getItemDamage()));
|
||||
usesLeft = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, 1, 0.75f);
|
||||
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i=0; i<10; i++){
|
||||
double x1 = (double)((float)caster.posX + world.rand.nextFloat()*2 - 1.0F);
|
||||
for(int i = 0; i < 10; i++){
|
||||
double x1 = (double)((float)caster.posX + world.rand.nextFloat() * 2 - 1.0F);
|
||||
double y1 = (double)((float)WizardryUtilities.getPlayerEyesPos(caster) - 0.5F + world.rand.nextFloat());
|
||||
double z1 = (double)((float)caster.posZ + world.rand.nextFloat()*2 - 1.0F);
|
||||
double z1 = (double)((float)caster.posZ + world.rand.nextFloat() * 2 - 1.0F);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, x1, y1, z1, 0, 0.01F, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return usesLeft < 5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user