本文整理汇总了Java中net.minecraft.entity.projectile.EntityFishHook类的典型用法代码示例。如果您正苦于以下问题:Java EntityFishHook类的具体用法?Java EntityFishHook怎么用?Java EntityFishHook使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityFishHook类属于net.minecraft.entity.projectile包,在下文中一共展示了EntityFishHook类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
if (playerIn.fishEntity != null)
{
int i = playerIn.fishEntity.handleHookRetraction();
itemStackIn.damageItem(i, playerIn);
playerIn.swingItem();
}
else
{
worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
}
playerIn.swingItem();
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
}
return itemStackIn;
}
示例2: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
if (playerIn.fishEntity != null)
{
int i = playerIn.fishEntity.handleHookRetraction();
itemStackIn.damageItem(i, playerIn);
playerIn.swingArm(hand);
}
else
{
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
}
playerIn.swingArm(hand);
playerIn.addStat(StatList.getObjectUseStats(this));
}
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
示例3: onEntitySpawn
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.getEntity().world.isRemote)
{
Minecraft mc = Minecraft.getMinecraft();
if(event.getEntity() instanceof EntityFishHook)
{
fishHooks.add((EntityFishHook)event.getEntity());
}
if(event.getEntity() instanceof EntityZombie && !(event.getEntity() instanceof EntityZombieVillager) || event.getEntity() instanceof EntitySkeleton || MobAmputation.config.playerGibs == 1 && event.getEntity() instanceof EntityPlayer && event.getEntity() != mc.player)
{
EntityLivingBase living = (EntityLivingBase)event.getEntity();
if(!amputationMap.containsKey(living) && !living.isChild())
{
attachGibs(event.getEntity().world, living);
}
}
}
}
示例4: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
@SideOnly( Side.CLIENT )
public ItemStack onItemRightClick( ItemStack stack, World world, EntityPlayer player )
{
ItemStack ret = super.onItemRightClick( stack, world, player );
if ( world.isRemote )
{
Minecraft mc = FMLClientHandler.instance().getClient();
EntityFishHook hook = player.fishEntity;
if ( player == mc.thePlayer && hook != null )
{
stagnated = false;
prevMotionY = 0;
timeSinceCasted = 0;
}
}
return ret;
}
示例5: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.fishEntity != null)
{
int var4 = par3EntityPlayer.fishEntity.func_146034_e();
par1ItemStack.damageItem(var4, par3EntityPlayer);
par3EntityPlayer.swingItem();
}
else
{
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isClient)
{
par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
}
par3EntityPlayer.swingItem();
}
return par1ItemStack;
}
示例6: onBobberSplashDetected
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public void onBobberSplashDetected(float x, float y, float z) {
if (playerHookInWater(this.player)) {
EntityFishHook hook = this.player.fishEntity;
// double yDifference = Math.abs(hook.posY - y);
// Ignore Y component when calculating distance from hook
double xzDistanceFromHook = hook.getDistanceSq(x, hook.posY, z);
if (xzDistanceFromHook <= CLOSE_BOBBER_SPLASH_THRESHOLD) {
// AutoFishLogger.info("[%d] Close bobber splash at %f / %f", this.minecraft.world.getTotalWorldTime(), xzDistanceFromHook, yDifference);
this.closeBobberSplashDetectedAt = this.minecraftClient.world.getTotalWorldTime();
// if (xzDistanceFromHook <= EXACT_BOBBER_SPLASH_THRESHOLD) {
// // AutoFishLogger.info("[%d] Exact bobber splash at %f / %f", this.minecraft.world.getTotalWorldTime(), xzDistanceFromHook, yDifference);
// this.exactBobberSplashDetectedAt = this.minecraft.world.getTotalWorldTime();
// }
}
}
}
示例7: onWaterWakeDetected
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
/**
* Callback from the WorldEventListener to tell us whenever a WATER_WAKE particle
* is spawned in the world.
*
* @param x
* @param y
* @param z
*/
public void onWaterWakeDetected(double x, double y, double z) {
if (this.minecraftClient != null && this.minecraftClient.player != null && playerHookInWater(this.minecraftClient.player)) {
EntityFishHook hook = this.minecraftClient.player.fishEntity;
double distanceFromHook = new BlockPos(x, y, z).distanceSq(hook.posX, hook.posY, hook.posZ);
if (distanceFromHook <= CLOSE_WATER_WAKE_THRESHOLD) {
if (this.closeWaterWakeDetectedAt <= 0) {
// AutoFishLogger.info("[%d] Close water wake at %f", this.minecraft.world.getTotalWorldTime(), distanceFromHook);
this.closeWaterWakeDetectedAt = this.minecraftClient.world.getTotalWorldTime();
}
// if (distanceFromHook <= EXACT_WATER_WAKE_THRESHOLD) {
// if (this.exactWaterWakeDetectedAt <=0) {
//// AutoFishLogger.info("[%d] Exact water wake at %f", this.minecraft.world.getTotalWorldTime(), distanceFromHook);
// this.exactWaterWakeDetectedAt = this.minecraft.world.getTotalWorldTime();
// }
// }
}
}
}
示例8: isFishBiting_fromAll
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
private boolean isFishBiting_fromAll() {
/** Assume a bit if the following conditions are true:
* (1) There is at least a little Y motion of the fish hook
* (2) Either (a) There has been a "close" bobber splash very recently; OR
* (b) A "close" water wake was detected long enough ago
*/
EntityFishHook fishEntity = this.player.fishEntity;
if (fishEntity != null
// Checking for no X and Z motion prevents a false alarm when the hook is moving through the air
&& fishEntity.motionX == 0
&& fishEntity.motionZ == 0
&& fishEntity.motionY < MOTION_Y_MAYBE_THRESHOLD) {
// long totalWorldTime = this.minecraft.world.getTotalWorldTime();
if (recentCloseBobberSplash() || recentCloseWaterWake()) {
Logger.debug("[%d] Detected bite by ALL", this.minecraftClient.world.getTotalWorldTime());
return true;
}
}
return false;
}
示例9: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.fishEntity != null)
{
int i = par3EntityPlayer.fishEntity.func_146034_e();
par1ItemStack.damageItem(i, par3EntityPlayer);
par3EntityPlayer.swingItem();
}
else
{
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
}
par3EntityPlayer.swingItem();
}
return par1ItemStack;
}
示例10: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
if (p_77659_3_.fishEntity != null)
{
int i = p_77659_3_.fishEntity.func_146034_e();
p_77659_1_.damageItem(i, p_77659_3_);
p_77659_3_.swingItem();
}
else
{
p_77659_2_.playSoundAtEntity(p_77659_3_, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!p_77659_2_.isRemote)
{
p_77659_2_.spawnEntityInWorld(new EntityFishHook(p_77659_2_, p_77659_3_));
}
p_77659_3_.swingItem();
}
return p_77659_1_;
}
示例11: func_77659_a
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
if(p_77659_3_.field_71104_cf != null) {
int var4 = p_77659_3_.field_71104_cf.func_70198_d();
p_77659_1_.func_77972_a(var4, p_77659_3_);
p_77659_3_.func_71038_i();
} else {
p_77659_2_.func_72956_a(p_77659_3_, "random.bow", 0.5F, 0.4F / (field_77697_d.nextFloat() * 0.4F + 0.8F));
if(!p_77659_2_.field_72995_K) {
p_77659_2_.func_72838_d(new EntityFishHook(p_77659_2_, p_77659_3_));
}
p_77659_3_.func_71038_i();
}
return p_77659_1_;
}
示例12: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.fishEntity != null)
{
int i = par3EntityPlayer.fishEntity.catchFish();
par1ItemStack.damageItem(i, par3EntityPlayer);
par3EntityPlayer.swingItem();
}
else
{
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
}
par3EntityPlayer.swingItem();
}
return par1ItemStack;
}
示例13: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
///LoggerHelper.log(Level.INFO, "Right Clicked");
if (par3EntityPlayer.fishEntity != null)
{
int i = par3EntityPlayer.fishEntity.catchFish();
par1ItemStack.damageItem(i, par3EntityPlayer);
par3EntityPlayer.swingItem();
//LoggerHelper.log(Level.INFO, "Entity!=null");
}
else
{
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
// LoggerHelper.log(Level.INFO, "Entity=null");
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
}
par3EntityPlayer.swingItem();
}
return par1ItemStack;
}
示例14: getBiteChance
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public double getBiteChance() {
EntityFishHook hook = getHandle();
if (this.biteChance == -1) {
if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
return 1/300.0;
}
return 1/500.0;
}
return this.biteChance;
}
示例15: onItemRightClick
import net.minecraft.entity.projectile.EntityFishHook; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
ItemStack itemstack = worldIn.getHeldItem(playerIn);
if (worldIn.fishEntity != null)
{
int i = worldIn.fishEntity.handleHookRetraction();
itemstack.damageItem(i, worldIn);
worldIn.swingArm(playerIn);
}
else
{
itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!itemStackIn.isRemote)
{
EntityFishHook entityfishhook = new EntityFishHook(itemStackIn, worldIn);
int j = EnchantmentHelper.func_191528_c(itemstack);
if (j > 0)
{
entityfishhook.func_191516_a(j);
}
int k = EnchantmentHelper.func_191529_b(itemstack);
if (k > 0)
{
entityfishhook.func_191517_b(k);
}
itemStackIn.spawnEntityInWorld(entityfishhook);
}
worldIn.swingArm(playerIn);
worldIn.addStat(StatList.getObjectUseStats(this));
}
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}