mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 17:52:57 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -11,67 +11,66 @@ import noppes.npcs.constants.EnumParticleType;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemSlingshot extends ItemNpcInterface{
|
||||
public class ItemSlingshot extends ItemNpcInterface {
|
||||
|
||||
public ItemSlingshot(int par1) {
|
||||
super(par1);
|
||||
public ItemSlingshot(int par1) {
|
||||
super(par1);
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(384);
|
||||
setCreativeTab(CustomItems.tabWeapon);
|
||||
}
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World worldObj, EntityPlayer player, int par4) {
|
||||
if(worldObj.isRemote)
|
||||
return;
|
||||
int ticks = getMaxItemUseDuration(par1ItemStack) - par4;
|
||||
|
||||
if(ticks < 6){//prevent rightclick spamming
|
||||
return;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode && !consumeItem(player, Item.getItemFromBlock(Blocks.cobblestone)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
par1ItemStack.damageItem(1, player);
|
||||
EntityProjectile projectile = new EntityProjectile(worldObj, player, new ItemStack(Blocks.cobblestone), false);
|
||||
projectile.damage = 4;
|
||||
projectile.punch = 1;
|
||||
projectile.setRotating(true);
|
||||
if(ticks > 24){
|
||||
projectile.setParticleEffect(EnumParticleType.Crit);
|
||||
projectile.punch = 2;
|
||||
}
|
||||
projectile.setHasGravity(true);
|
||||
projectile.setSpeed(14);
|
||||
projectile.shoot(1);
|
||||
|
||||
worldObj.playSoundAtEntity(player, "random.bow", 1.0F,itemRand.nextFloat() * 0.3F + 0.8F);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSpecial(){
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
GL11.glScalef(0.5f, 0.5f,0.5f);
|
||||
GL11.glTranslatef(0f, 0.5f, 0);
|
||||
}
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World worldObj, EntityPlayer player, int par4) {
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
int ticks = getMaxItemUseDuration(par1ItemStack) - par4;
|
||||
|
||||
if (ticks < 6) {//prevent rightclick spamming
|
||||
return;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode && !consumeItem(player, Item.getItemFromBlock(Blocks.cobblestone))) {
|
||||
return;
|
||||
}
|
||||
par1ItemStack.damageItem(1, player);
|
||||
EntityProjectile projectile = new EntityProjectile(worldObj, player, new ItemStack(Blocks.cobblestone), false);
|
||||
projectile.damage = 4;
|
||||
projectile.punch = 1;
|
||||
projectile.setRotating(true);
|
||||
if (ticks > 24) {
|
||||
projectile.setParticleEffect(EnumParticleType.Crit);
|
||||
projectile.punch = 2;
|
||||
}
|
||||
projectile.setHasGravity(true);
|
||||
projectile.setSpeed(14);
|
||||
projectile.shoot(1);
|
||||
|
||||
worldObj.playSoundAtEntity(player, "random.bow", 1.0F, itemRand.nextFloat() * 0.3F + 0.8F);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSpecial() {
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glTranslatef(0f, 0.5f, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
|
||||
return par1ItemStack;
|
||||
}
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user