mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 05:19:41 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -10,89 +10,88 @@ import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemCrossbow extends ItemNpcInterface{
|
||||
public class ItemCrossbow extends ItemNpcInterface {
|
||||
|
||||
public ItemCrossbow(int par1) {
|
||||
super(par1);
|
||||
public ItemCrossbow(int par1) {
|
||||
super(par1);
|
||||
this.setMaxDamage(129);
|
||||
setCreativeTab(CustomItems.tabWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World par2World, EntityPlayer player, int count) {
|
||||
if(player.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
if(stack.stackTagCompound.getInteger("IsLoaded") == 1 || player.capabilities.isCreativeMode) {
|
||||
if(stack.stackTagCompound.getInteger("Reloading") == 1 && !player.capabilities.isCreativeMode) {
|
||||
stack.stackTagCompound.setInteger("Reloading", 0);
|
||||
return;
|
||||
}
|
||||
stack.damageItem(1, player);
|
||||
EntityProjectile projectile = new EntityProjectile(player.worldObj, player, new ItemStack(Items.arrow, 1, 0), false);
|
||||
projectile.damage = 10;
|
||||
projectile.setSpeed(20);
|
||||
projectile.setHasGravity(true);
|
||||
projectile.shoot(2);
|
||||
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
consumeItem(player, CustomItems.crossbowBolt);
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, "random.bow", 0.9F, itemRand.nextFloat() * 0.3F + 0.8F);
|
||||
player.worldObj.spawnEntityInWorld(projectile);
|
||||
stack.stackTagCompound.setInteger("IsLoaded", 0);
|
||||
}
|
||||
if (player.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
if (stack.stackTagCompound.getInteger("IsLoaded") == 1 || player.capabilities.isCreativeMode) {
|
||||
if (stack.stackTagCompound.getInteger("Reloading") == 1 && !player.capabilities.isCreativeMode) {
|
||||
stack.stackTagCompound.setInteger("Reloading", 0);
|
||||
return;
|
||||
}
|
||||
stack.damageItem(1, player);
|
||||
EntityProjectile projectile = new EntityProjectile(player.worldObj, player, new ItemStack(Items.arrow, 1, 0), false);
|
||||
projectile.damage = 10;
|
||||
projectile.setSpeed(20);
|
||||
projectile.setHasGravity(true);
|
||||
projectile.shoot(2);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
consumeItem(player, CustomItems.crossbowBolt);
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, "random.bow", 0.9F, itemRand.nextFloat() * 0.3F + 0.8F);
|
||||
player.worldObj.spawnEntityInWorld(projectile);
|
||||
stack.stackTagCompound.setInteger("IsLoaded", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
|
||||
{
|
||||
if(player.worldObj.isRemote){
|
||||
return;
|
||||
}
|
||||
|
||||
int ticks = getMaxItemUseDuration(stack) - count;
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if (player.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
if(stack.stackTagCompound.getInteger("Reloading") == 1 && hasItem(player, CustomItems.crossbowBolt)){
|
||||
if(ticks == 20){
|
||||
player.worldObj.playSoundAtEntity(player, "random.click", 1.0F,1);
|
||||
stack.stackTagCompound.setInteger("IsLoaded", 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
int ticks = getMaxItemUseDuration(stack) - count;
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (stack.stackTagCompound.getInteger("Reloading") == 1 && hasItem(player, CustomItems.crossbowBolt)) {
|
||||
if (ticks == 20) {
|
||||
player.worldObj.playSoundAtEntity(player, "random.click", 1.0F, 1);
|
||||
stack.stackTagCompound.setInteger("IsLoaded", 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSpecial(){
|
||||
GL11.glRotatef(96, 1f, 0, 0);
|
||||
GL11.glRotatef(-10, 0, 1f, 0);
|
||||
GL11.glScalef(0.8f, 0.8f,0.8f);
|
||||
GL11.glTranslatef(0.5f, -0.7f, -0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSpecial() {
|
||||
GL11.glRotatef(96, 1f, 0, 0);
|
||||
GL11.glRotatef(-10, 0, 1f, 0);
|
||||
GL11.glScalef(0.8f, 0.8f, 0.8f);
|
||||
GL11.glTranslatef(0.5f, -0.7f, -0.4F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if(stack.stackTagCompound == null)
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
if(!player.capabilities.isCreativeMode && hasItem(player, CustomItems.crossbowBolt) && stack.stackTagCompound.getInteger("IsLoaded") == 0)
|
||||
stack.stackTagCompound.setInteger("Reloading", 1);
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.stackTagCompound == null)
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
if (!player.capabilities.isCreativeMode && hasItem(player, CustomItems.crossbowBolt) && stack.stackTagCompound.getInteger("IsLoaded") == 0)
|
||||
stack.stackTagCompound.setInteger("Reloading", 1);
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
if(stack.stackTagCompound == null || stack.stackTagCompound.getInteger("Reloading") == 0)
|
||||
return EnumAction.bow;
|
||||
|
||||
return EnumAction.block;
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
if (stack.stackTagCompound == null || stack.stackTagCompound.getInteger("Reloading") == 0)
|
||||
return EnumAction.bow;
|
||||
|
||||
return EnumAction.block;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user