Updated for 1.7.2
This commit is contained in:
parent
cc178e1a3b
commit
29228e18fe
105 changed files with 1939 additions and 2690 deletions
|
|
@ -6,25 +6,23 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemStaffFire extends ItemStaff {
|
||||
public ItemStaffFire(int id) {
|
||||
super(id);
|
||||
public ItemStaffFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer entityPlayer, EntityLivingBase entityLiving) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
entityLiving.setFire(5);
|
||||
entityLiving.attackEntityFrom(DamageSource.magic, 7);
|
||||
itemStack.damageItem(1, entityLiving);
|
||||
|
|
@ -35,12 +33,12 @@ public class ItemStaffFire extends ItemStaff {
|
|||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -50,12 +48,12 @@ public class ItemStaffFire extends ItemStaff {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
} else {
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlockId(i, j, k), 1, world.getBlockMetadata(i, j, k)));
|
||||
if (!world.isRemote && !(result == null)) {
|
||||
int id = result.itemID;
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlock(i, j, k), 1, world.getBlockMetadata(i, j, k)));
|
||||
if (!world.isRemote && result != null) {
|
||||
Item id = result.getItem();
|
||||
int meta = result.getItemDamage();
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.setBlockToAir(i, j, k);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(id, 1, meta)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
|
|
@ -63,7 +61,7 @@ public class ItemStaffFire extends ItemStaff {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityChargeFire(world, entityPlayer));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue