当前位置: 首页>>代码示例>>Java>>正文


Java EntityHanging类代码示例

本文整理汇总了Java中net.minecraft.entity.EntityHanging的典型用法代码示例。如果您正苦于以下问题:Java EntityHanging类的具体用法?Java EntityHanging怎么用?Java EntityHanging使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityHanging类属于net.minecraft.entity包,在下文中一共展示了EntityHanging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moveEntityDefault

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public static void moveEntityDefault(Entity entity, BlockPos dist)
{
    if (entity instanceof EntityHanging)
    {
        EntityHanging entityHanging = (EntityHanging) entity;
        BlockPos hangingPosition = entityHanging.getHangingPosition().add(dist);
        entityHanging.setPosition(hangingPosition.getX(), hangingPosition.getY(), hangingPosition.getZ());
    }
    else
    {
        entity.setPosition(entity.posX + dist.getX(), entity.posY + dist.getY(), entity.posZ + dist.getZ());
    }

    if (entity instanceof EntityCreature)
    {
        EntityCreature entityCreature = (EntityCreature) entity;
        EntityCreatureAccessor.setHomePosition(entityCreature, entityCreature.getHomePosition().add(dist));
    }
}
 
开发者ID:Ivorforce,项目名称:IvToolkit,代码行数:20,代码来源:Mover.java

示例2: moveEntityForGeneration

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public static void moveEntityForGeneration(Entity entity, BlockCoord coord)
{
    if (entity instanceof Movable)
        ((Movable) entity).move(coord.x, coord.y, coord.z);
    else
    {
        entity.setPosition(entity.posX + coord.x, entity.posY + coord.y, entity.posZ + coord.z);

        if (entity instanceof EntityHanging)
        {
            EntityHanging entityHanging = (EntityHanging) entity;
            entityHanging.field_146063_b += coord.x;
            entityHanging.field_146064_c += coord.y;
            entityHanging.field_146062_d += coord.z;
            entityHanging.setDirection(entityHanging.hangingDirection);
        }
    }
}
 
开发者ID:Dennisbonke,项目名称:DBLibOld,代码行数:19,代码来源:IvWorldData.java

示例3: transformEntityPosForGeneration

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public static void transformEntityPosForGeneration(Entity entity, AxisAlignedTransform2D transform, int[] size)
{
    if (entity instanceof Transformable)
        ((Transformable) entity).transform(transform.getRotation(), transform.isMirrorX(), size);
    else
    {
        double[] newEntityPos = transform.apply(new double[]{entity.posX, entity.posY, entity.posZ}, size);
        entity.setPosition(newEntityPos[0], newEntityPos[1], newEntityPos[2]);

        if (entity instanceof EntityHanging)
        {
            EntityHanging entityHanging = (EntityHanging) entity;
            BlockCoord hangingCoord = new BlockCoord(entityHanging.field_146063_b, entityHanging.field_146064_c, entityHanging.field_146062_d);
            BlockCoord newHangingCoord = transform.apply(hangingCoord, size);
            entityHanging.field_146063_b = newHangingCoord.x;
            entityHanging.field_146064_c = newHangingCoord.y;
            entityHanging.field_146062_d = newHangingCoord.z;
            entityHanging.setDirection(entityHanging.hangingDirection);
        }
    }
}
 
开发者ID:Dennisbonke,项目名称:DBLibOld,代码行数:22,代码来源:IvWorldData.java

示例4: func_77648_a

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public boolean func_77648_a(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
   if(p_77648_7_ == 0) {
      return false;
   } else if(p_77648_7_ == 1) {
      return false;
   } else {
      int var11 = Direction.field_71579_d[p_77648_7_];
      EntityHanging var12 = this.func_82810_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, var11);
      if(!p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)) {
         return false;
      } else {
         if(var12 != null && var12.func_70518_d()) {
            if(!p_77648_3_.field_72995_K) {
               p_77648_3_.func_72838_d(var12);
            }

            --p_77648_1_.field_77994_a;
         }

         return true;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:ItemHangingEntity.java

示例5: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (side == EnumFacing.DOWN)
    {
        return false;
    }
    else if (side == EnumFacing.UP)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = pos.offset(side);

        if (!playerIn.canPlayerEdit(blockpos, side, stack))
        {
            return false;
        }
        else
        {
            EntityHanging entityhanging = this.createEntity(worldIn, blockpos, side);

            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!worldIn.isRemote)
                {
                    worldIn.spawnEntityInWorld(entityhanging);
                }

                --stack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:ItemHangingEntity.java

示例6: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    ItemStack itemstack = stack.getHeldItem(pos);
    BlockPos blockpos = worldIn.offset(hand);

    if (hand != EnumFacing.DOWN && hand != EnumFacing.UP && stack.canPlayerEdit(blockpos, hand, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(playerIn, blockpos, hand);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!playerIn.isRemote)
            {
                entityhanging.playPlaceSound();
                playerIn.spawnEntityInWorld(entityhanging);
            }

            itemstack.func_190918_g(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:ItemHangingEntity.java

示例7: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    BlockPos blockpos = pos.offset(facing);

    if (facing != EnumFacing.DOWN && facing != EnumFacing.UP && playerIn.canPlayerEdit(blockpos, facing, stack))
    {
        EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!worldIn.isRemote)
            {
                entityhanging.playPlaceSound();
                worldIn.spawnEntityInWorld(entityhanging);
            }

            --stack.stackSize;
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:ItemHangingEntity.java

示例8: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    ItemStack itemstack = player.getHeldItem(hand);
    BlockPos blockpos = pos.offset(facing);

    if (facing != EnumFacing.DOWN && facing != EnumFacing.UP && player.canPlayerEdit(blockpos, facing, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!worldIn.isRemote)
            {
                entityhanging.playPlaceSound();
                worldIn.spawnEntity(entityhanging);
            }

            itemstack.shrink(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:28,代码来源:ItemArtifactFrame.java

示例9: updateEntityHangingBoundingBox

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
private static void updateEntityHangingBoundingBox (EntityHanging entity)
{
       double d0 = (double)entity.getHangingPosition().getX() + 0.5D;
       double d1 = (double)entity.getHangingPosition().getY() + 0.5D;
       double d2 = (double)entity.getHangingPosition().getZ() + 0.5D;
       double d3 = 0.46875D;
       double d4 = entity.getWidthPixels() % 32 == 0 ? 0.5D : 0.0D;;
       double d5 = entity.getHeightPixels() % 32 == 0 ? 0.5D : 0.0D;;
       d0 = d0 - (double)entity.facingDirection.getFrontOffsetX() * 0.46875D;
       d2 = d2 - (double)entity.facingDirection.getFrontOffsetZ() * 0.46875D;
       d1 = d1 + d5;
       EnumFacing enumfacing = entity.facingDirection.rotateYCCW();
       d0 = d0 + d4 * (double)enumfacing.getFrontOffsetX();
       d2 = d2 + d4 * (double)enumfacing.getFrontOffsetZ();
       entity.posX = d0;
       entity.posY = d1;
       entity.posZ = d2;
       double d6 = (double)entity.getWidthPixels();
       double d7 = (double)entity.getHeightPixels();
       double d8 = (double)entity.getWidthPixels();

       if (entity.facingDirection.getAxis() == EnumFacing.Axis.Z)
       {
           d8 = 1.0D;
       }
       else
       {
           d6 = 1.0D;
       }

       d6 = d6 / 32.0D;
       d7 = d7 / 32.0D;
       d8 = d8 / 32.0D;
       entity.setEntityBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:36,代码来源:ModEventHandler.java

示例10: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
    if (p_77648_7_ == 0)
    {
        return false;
    }
    else if (p_77648_7_ == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[p_77648_7_];
        EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);

        if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!p_77648_3_.isRemote)
                {
                    p_77648_3_.spawnEntityInWorld(entityhanging);
                }

                --p_77648_1_.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:40,代码来源:ItemEpicProportionsPainting.java

示例11: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (par7 == 0)
    {
        return false;
    }
    else if (par7 == 1)
    {
        return false;
    }
    else
    {
        int var11 = Direction.facingToDirection[par7];
        EntityHanging var12 = this.createHangingEntity(par3World, par4, par5, par6, var11);

        if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            if (var12 != null && var12.onValidSurface())
            {
                if (!par3World.isClient)
                {
                    par3World.spawnEntityInWorld(var12);
                }

                --par1ItemStack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:40,代码来源:ItemHangingEntity.java

示例12: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
    if (p_77648_7_ == 0)
    {
        return false;
    }
    else if (p_77648_7_ == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[p_77648_7_];
        EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);

        if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!p_77648_3_.isRemote)
                {
                    p_77648_3_.spawnEntityInWorld(entityhanging);
                }

                --p_77648_1_.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:36,代码来源:ItemHangingEntity.java

示例13: onItemUse

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (par7 == 0)
    {
        return false;
    }
    else if (par7 == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[par7];
        EntityHanging entityhanging = this.createHangingEntity(par3World, par4, par5, par6, i1);

        if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!par3World.isRemote)
                {
                    par3World.spawnEntityInWorld(entityhanging);
                }

                --par1ItemStack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:40,代码来源:ItemHangingEntity.java

示例14: ItemHangingEntity

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
public ItemHangingEntity(Class <? extends EntityHanging > entityClass)
{
    this.hangingEntityClass = entityClass;
    this.setCreativeTab(CreativeTabs.tabDecorations);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:ItemHangingEntity.java

示例15: createEntity

import net.minecraft.entity.EntityHanging; //导入依赖的package包/类
private EntityHanging createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide)
{
    return (EntityHanging)(this.hangingEntityClass == EntityPainting.class ? new EntityPainting(worldIn, pos, clickedSide) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(worldIn, pos, clickedSide) : null));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:ItemHangingEntity.java


注:本文中的net.minecraft.entity.EntityHanging类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。