本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.isInsideOfMaterial方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.isInsideOfMaterial方法的具体用法?Java EntityPlayer.isInsideOfMaterial怎么用?Java EntityPlayer.isInsideOfMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.isInsideOfMaterial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderAir
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void renderAir(int width, int height)
{
if (pre(AIR)) return;
mc.mcProfiler.startSection("air");
EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
GlStateManager.enableBlend();
int left = width / 2 + 91;
int top = height - right_height;
if (player.isInsideOfMaterial(Material.WATER))
{
int air = player.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;
for (int i = 0; i < full + partial; ++i)
{
drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
}
right_height += 10;
}
GlStateManager.disableBlend();
mc.mcProfiler.endSection();
post(AIR);
}
示例2: onBlockBreak
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void onBlockBreak(BlockEvent.BreakEvent event){
EntityPlayer player = event.getPlayer();
if(player.isInsideOfMaterial(Material.WATER)) {
//Player is inside water, check for lanolin
if (player.getHeldItemMainhand().hasTagCompound() && player.getHeldItemMainhand().getTagCompound().hasKey("lanolin")) {
int newLanolin = player.getHeldItemMainhand().getTagCompound().getInteger("lanolin") - 1;
if (newLanolin <= 0)
player.getHeldItemMainhand().getTagCompound().removeTag("lanolin");
else
player.getHeldItemMainhand().getTagCompound().setInteger("lanolin", newLanolin);
}
}
}
示例3: onArmorTick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onArmorTick(World world, final EntityPlayer player, ItemStack itemStack) {
if (itemStack.getTagCompound().getBoolean("Deployed")) {
player.motionY=Math.max(-0.1f, player.motionY);
player.fallDistance=0f;
/*if (player.ticksExisted % 30 == 0) {
itemStack.damageItem(1, player);
}*/
if (player.onGround || player.isInsideOfMaterial(Material.WATER))
itemStack.getTagCompound().setBoolean("Deployed", false);
}
}
示例4: breakSpeed
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void breakSpeed(PlayerEvent.BreakSpeed event){
// Check if the break speed has been modified due to water
// prevent the modification if there is lanolin on the tool being used
// decrement the lanolin when the block is successfully broken
EntityPlayer player = event.getEntityPlayer();
IBlockState state = event.getState();
BlockPos pos = event.getPos();
if(player.isInsideOfMaterial(Material.WATER)) {
//Player is inside water, check for lanolin
if(player.getHeldItemMainhand().hasTagCompound() && player.getHeldItemMainhand().getTagCompound().hasKey("lanolin")){
// Recalculate ala EntityPlayer.getDigSpeed(), but skip the water portion
float f = player.inventory.getStrVsBlock(state);
if (f > 1.0F)
{
int i = EnchantmentHelper.getEfficiencyModifier(player);
ItemStack itemstack = player.getHeldItemMainhand();
if (i > 0 && !itemstack.isEmpty())
{
f += (float)(i * i + 1);
}
}
if (player.isPotionActive(MobEffects.HASTE))
{
f *= 1.0F + (float)(player.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
}
if (player.isPotionActive(MobEffects.MINING_FATIGUE))
{
float f1;
switch (player.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier())
{
case 0:
f1 = 0.3F;
break;
case 1:
f1 = 0.09F;
break;
case 2:
f1 = 0.0027F;
break;
case 3:
default:
f1 = 8.1E-4F;
}
f *= f1;
}
if(f > event.getNewSpeed()){
event.setNewSpeed(f < 0 ? 0 : f);
}
}
}
}