本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.isSneaking方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.isSneaking方法的具体用法?Java EntityLivingBase.isSneaking怎么用?Java EntityLivingBase.isSneaking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.isSneaking方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderHeldItem
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide)
{
if (!p_188358_2_.func_190926_b())
{
GlStateManager.pushMatrix();
this.func_191361_a(handSide);
if (p_188358_1_.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
boolean flag = handSide == EnumHandSide.LEFT;
GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag);
GlStateManager.popMatrix();
}
}
示例2: renderHeldItem
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide)
{
if (p_188358_2_ != null)
{
GlStateManager.pushMatrix();
if (p_188358_1_.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
// Forge: moved this call down, fixes incorrect offset while sneaking.
((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide);
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
boolean flag = handSide == EnumHandSide.LEFT;
GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag);
GlStateManager.popMatrix();
}
}
示例3: getStartAndEndLookVec
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static Pair<Vec3d, Vec3d> getStartAndEndLookVec(EntityLivingBase entity, float maxDistance) {
Vec3d entityVec;
if (entity.world.isRemote && entity instanceof EntityPlayer) {
entityVec = new Vec3d(entity.posX, entity.posY + 1.6200000000000001D, entity.posZ);
} else {
entityVec = new Vec3d(entity.posX, entity.posY + entity.getEyeHeight() - (entity.isSneaking() ? 0.08 : 0), entity.posZ);
}
Vec3d entityLookVec = entity.getLook(1.0F);
Vec3d maxDistVec = entityVec.addVector(entityLookVec.x * maxDistance, entityLookVec.y * maxDistance, entityLookVec.z * maxDistance);
return new ImmutablePair<>(entityVec, maxDistVec);
}
示例4: getStateForPlacement
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
if (placer.isSneaking()) {
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
}
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
}
示例5: getStateForPlacement
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
if (!FMLForgePlugin.RUNTIME_DEOBF && placer instanceof EntityPlayer && ((EntityPlayer) placer).isCreative() && placer.isSneaking()) {
return getDefaultState().withProperty(SAP_SIDE, getSideFromFacing(placer.getHorizontalFacing().getOpposite()));
}
return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
示例6: render
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void render(float rotationX, float rotationY, EntityLivingBase entity) {
/*
bipedBody.showModel = false;
bipedLeftLeg.showModel = false;
bipedRightLeg.showModel = false;
bipedLeftArm.showModel = false;
bipedRightArm.showModel = false;
bipedHead.showModel = true;
bipedHeadwear.showModel = true;
bipedHead = head;
bipedHeadwear = overlay;
*/
if (entity != null && entity.isSneaking()) {
GlStateManager.translate(0.0F, 0.25F, 0.0F);
}
else {
GlStateManager.translate(0.0F, 0.02F, 0.0F);
}
head.rotateAngleY = rotationX / (180F / (float) Math.PI);
head.rotateAngleX = rotationY / (180F / (float) Math.PI);
head.render(0.0625F);
if (renderOverlay) {
renderOverlay(rotationX, rotationY);
}
if (entity != null && entity.isSneaking()) {
GlStateManager.translate(0.0F, -0.25F, 0.0F);
}
else {
GlStateManager.translate(0.0F, -0.02F, 0.0F);
}
}
示例7: doRenderLayer
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(3);
if (itemstack != null && itemstack.getItem() != null)
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();
if (!flag && entitylivingbaseIn.isChild())
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.scale(f1 / f, f1 / f, f1 / f);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.field_177209_a.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item instanceof ItemBlock)
{
float f2 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(f2, -f2, -f2);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
else if (item == Items.skull)
{
float f3 = 1.1875F;
GlStateManager.scale(f3, -f3, -f3);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isNullOrEmpty(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1);
}
GlStateManager.popMatrix();
}
}
示例8: doRenderLayer
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (!itemstack.func_190926_b())
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.modelRenderer.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item == Items.SKULL)
{
float f2 = 1.1875F;
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isBlank(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
}
else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
{
float f3 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
GlStateManager.popMatrix();
}
}
示例9: doRenderLayer
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (itemstack != null && itemstack.getItem() != null)
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.modelRenderer.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item == Items.SKULL)
{
float f2 = 1.1875F;
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isNullOrEmpty(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
}
else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
{
float f3 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
GlStateManager.popMatrix();
}
}