當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityItemFrame類代碼示例

本文整理匯總了Java中net.minecraft.entity.item.EntityItemFrame的典型用法代碼示例。如果您正苦於以下問題:Java EntityItemFrame類的具體用法?Java EntityItemFrame怎麽用?Java EntityItemFrame使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityItemFrame類屬於net.minecraft.entity.item包,在下文中一共展示了EntityItemFrame類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleNonLivingEntityDamageEvent

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) {
    if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) {
        return false;
    }

    final EnumMap<DamageModifier, Double> modifiers = new EnumMap<DamageModifier, Double>(DamageModifier.class);
    final EnumMap<DamageModifier, Function<? super Double, Double>> functions = new EnumMap(DamageModifier.class);

    modifiers.put(DamageModifier.BASE, damage);
    functions.put(DamageModifier.BASE, ZERO);

    final EntityDamageEvent event = handleEntityDamageEvent(entity, source, modifiers, functions);
    if (event == null) {
        return false;
    }
    return event.isCancelled() || (event.getDamage() == 0 && !(entity instanceof EntityItemFrame)); // Cauldron - fix frame removal
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:18,代碼來源:CraftEventFactory.java

示例2: apply

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) {
      	 if (entityIn == null && !stack.isOnItemFrame()) return 0.0F;
           else {
               boolean flag = entityIn != null;
               Entity entity = (Entity)(flag ? entityIn : stack.getItemFrame());

               if (worldIn == null) worldIn = entity.world;
               double d0;

               if (worldIn.provider.isSurfaceWorld()) {
              	 double d1 = flag ? (double)entity.rotationYaw : this.getFrameRotation((EntityItemFrame)entity);
                   d1 = MathHelper.positiveModulo(d1 / 360.0D, 1.0D);
                   double d2 = this.getSpawnToAngle(worldIn, entity) / (Math.PI * 2D);
                   d0 = 0.5D - (d1 - 0.25D - d2);
               }
               else  d0 = Math.random();

               if (flag)
              	 d0 = this.wobble(worldIn, d0);
               
               return MathHelper.positiveModulo((float)d0, 1.0F);
           }
}
 
開發者ID:MrNobody98,項目名稱:morecommands,代碼行數:25,代碼來源:PacketHandlerClient.java

示例3: doRender

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(EntityItemFrame par1EntityItemFrame, double par2, double par4, double par6, float par8, float par9)
{
    GL11.glPushMatrix();
    double var10 = par1EntityItemFrame.posX - par2 - 0.5D;
    double var12 = par1EntityItemFrame.posY - par4 - 0.5D;
    double var14 = par1EntityItemFrame.posZ - par6 - 0.5D;
    int var16 = par1EntityItemFrame.field_146063_b + Direction.offsetX[par1EntityItemFrame.hangingDirection];
    int var17 = par1EntityItemFrame.field_146064_c;
    int var18 = par1EntityItemFrame.field_146062_d + Direction.offsetZ[par1EntityItemFrame.hangingDirection];
    GL11.glTranslated((double)var16 - var10, (double)var17 - var12, (double)var18 - var14);

    if (par1EntityItemFrame.getDisplayedItem() != null && par1EntityItemFrame.getDisplayedItem().getItem() == Items.filled_map)
    {
        this.func_147915_b(par1EntityItemFrame);
    }
    else
    {
        this.renderFrameItemAsBlock(par1EntityItemFrame);
    }

    this.func_82402_b(par1EntityItemFrame);
    GL11.glPopMatrix();
    this.func_147914_a(par1EntityItemFrame, par2 + (double)((float)Direction.offsetX[par1EntityItemFrame.hangingDirection] * 0.3F), par4 - 0.25D, par6 + (double)((float)Direction.offsetZ[par1EntityItemFrame.hangingDirection] * 0.3F));
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:31,代碼來源:RenderItemFrame.java

示例4: doRender

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
public void doRender(EntityItemFrame p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    GL11.glPushMatrix();
    double d3 = p_76986_1_.posX - p_76986_2_ - 0.5D;
    double d4 = p_76986_1_.posY - p_76986_4_ - 0.5D;
    double d5 = p_76986_1_.posZ - p_76986_6_ - 0.5D;
    int i = p_76986_1_.field_146063_b + Direction.offsetX[p_76986_1_.hangingDirection];
    int j = p_76986_1_.field_146064_c;
    int k = p_76986_1_.field_146062_d + Direction.offsetZ[p_76986_1_.hangingDirection];
    GL11.glTranslated((double)i - d3, (double)j - d4, (double)k - d5);

    if (p_76986_1_.getDisplayedItem() != null && p_76986_1_.getDisplayedItem().getItem() == Items.filled_map)
    {
        this.func_147915_b(p_76986_1_);
    }
    else
    {
        this.renderFrameItemAsBlock(p_76986_1_);
    }

    this.func_82402_b(p_76986_1_);
    GL11.glPopMatrix();
    this.func_147914_a(p_76986_1_, p_76986_2_ + (double)((float)Direction.offsetX[p_76986_1_.hangingDirection] * 0.3F), p_76986_4_ - 0.25D, p_76986_6_ + (double)((float)Direction.offsetZ[p_76986_1_.hangingDirection] * 0.3F));
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:25,代碼來源:RenderItemFrame.java

示例5: doRender

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
@Override
public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    ItemStack frameItemStack = ItemStack.EMPTY;

    if (!CheckVisibleState(entity))
    {
        frameItemStack = entity.getDisplayedItem();
        entity.setDisplayedItem(ItemStack.EMPTY);
    }

    if ((!SkipSignCore.ModSetting.HideBoard.Bool()) ||
        (SkipSignCore.ModSetting.HideBoard.Bool() && CheckVisibleState(entity)))
    {
        super.doRender(entity, x, y, z, entityYaw, partialTicks);
    }

    if (!frameItemStack.isEmpty())
    {
        entity.setDisplayedItem(frameItemStack);
    }
}
 
開發者ID:TTTA2,項目名稱:SkipSignGUI,代碼行數:23,代碼來源:RenderItemFrameEx.java

示例6: CheckVisibleState

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
public boolean CheckVisibleState(EntityItemFrame entityItemFrame)
{
    if (SkipSignCore.ModSetting.FrameVisible.Int() == 1)
        return true;
    if (SkipSignCore.ModSetting.FrameVisible.Int() == 2)
        return false;

    if (Keyboard.isKeyDown(SkipSignCore.ModSetting.Zoom_Key.Int()))
        return true;

    if (SkipSignHelper.IsInRangeToRenderDist(
            SkipSignHelper.GetDistancePlayerToEntity(entityItemFrame),
            SkipSignCore.ModSetting.FrameRange.Int()))
        return true;
    return false;
}
 
開發者ID:TTTA2,項目名稱:SkipSignGUI,代碼行數:17,代碼來源:RenderItemFrameEx.java

示例7: getEntityTrackingRange

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:38,代碼來源:TrackingRange.java

示例8: findMeeCreepChests

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
/**
 * Find all chests that have an item frame attached to them with an meecreep cube in them
 */
private List<BlockPos> findMeeCreepChests(AxisAlignedBB box) {
    List<EntityItemFrame> frames = entity.getEntityWorld().getEntitiesWithinAABB(EntityItemFrame.class, box, input -> {
        if (!input.getDisplayedItem().isEmpty() && input.getDisplayedItem().getItem() instanceof CreepCubeItem) {
            BlockPos position = input.getHangingPosition().offset(input.facingDirection.getOpposite());
            if (InventoryTools.isInventory(entity.getEntityWorld(), position)) {
                return true;
            }
        }
        return false;
    });
    return frames.stream().map(entityItemFrame -> entityItemFrame.getHangingPosition().offset(entityItemFrame.facingDirection.getOpposite())).collect(Collectors.toList());
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:16,代碼來源:WorkerHelper.java

示例9: getEntityColor

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
private int getEntityColor(Entity entity) {
    if(entity instanceof EntityMinecartChest)
        return Utils.Colors.ORANGE;
    else if(entity instanceof EntityItemFrame &&
            ((EntityItemFrame) entity).getDisplayedItem().getItem() instanceof ItemShulkerBox)
        return Utils.Colors.YELLOW;
    else
        return -1;
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:10,代碼來源:StorageESPMod.java

示例10: calculateInputStrength

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    int i = super.calculateInputStrength(worldIn, pos, state);
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    Block block = worldIn.getBlockState(blockpos).getBlock();

    if (block.hasComparatorInputOverride())
    {
        i = block.getComparatorInputOverride(worldIn, blockpos);
    }
    else if (i < 15 && block.isNormalCube())
    {
        blockpos = blockpos.offset(enumfacing);
        block = worldIn.getBlockState(blockpos).getBlock();

        if (block.hasComparatorInputOverride())
        {
            i = block.getComparatorInputOverride(worldIn, blockpos);
        }
        else if (block.getMaterial() == Material.air)
        {
            EntityItemFrame entityitemframe = this.findItemFrame(worldIn, enumfacing, blockpos);

            if (entityitemframe != null)
            {
                i = entityitemframe.func_174866_q();
            }
        }
    }

    return i;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:BlockRedstoneComparator.java

示例11: findItemFrame

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos)
{
    List<EntityItemFrame> list = worldIn.<EntityItemFrame>getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate<Entity>()
    {
        public boolean apply(Entity p_apply_1_)
        {
            return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing;
        }
    });
    return list.size() == 1 ? (EntityItemFrame)list.get(0) : null;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:12,代碼來源:BlockRedstoneComparator.java

示例12: doRender

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    BlockPos blockpos = entity.getHangingPosition();
    double d0 = (double)blockpos.getX() - entity.posX + x;
    double d1 = (double)blockpos.getY() - entity.posY + y;
    double d2 = (double)blockpos.getZ() - entity.posZ + z;
    GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D);
    GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F);
    this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
    BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
    ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager();
    IBakedModel ibakedmodel;

    if (entity.getDisplayedItem() != null && entity.getDisplayedItem().getItem() == Items.filled_map)
    {
        ibakedmodel = modelmanager.getModel(this.mapModel);
    }
    else
    {
        ibakedmodel = modelmanager.getModel(this.itemFrameModel);
    }

    GlStateManager.pushMatrix();
    GlStateManager.translate(-0.5F, -0.5F, -0.5F);
    blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
    GlStateManager.translate(0.0F, 0.0F, 0.4375F);
    this.renderItem(entity);
    GlStateManager.popMatrix();
    this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:RenderItemFrame.java

示例13: handleDataMarker

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
protected void handleDataMarker(String p_186175_1_, BlockPos p_186175_2_, World p_186175_3_, Random p_186175_4_, StructureBoundingBox p_186175_5_)
{
    if (p_186175_1_.startsWith("Chest"))
    {
        BlockPos blockpos = p_186175_2_.down();

        if (p_186175_5_.isVecInside(blockpos))
        {
            TileEntity tileentity = p_186175_3_.getTileEntity(blockpos);

            if (tileentity instanceof TileEntityChest)
            {
                ((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_END_CITY_TREASURE, p_186175_4_.nextLong());
            }
        }
    }
    else if (p_186175_1_.startsWith("Sentry"))
    {
        EntityShulker entityshulker = new EntityShulker(p_186175_3_);
        entityshulker.setPosition((double)p_186175_2_.getX() + 0.5D, (double)p_186175_2_.getY() + 0.5D, (double)p_186175_2_.getZ() + 0.5D);
        entityshulker.setAttachmentPos(p_186175_2_);
        p_186175_3_.spawnEntityInWorld(entityshulker);
    }
    else if (p_186175_1_.startsWith("Elytra"))
    {
        EntityItemFrame entityitemframe = new EntityItemFrame(p_186175_3_, p_186175_2_, this.rotation.rotate(EnumFacing.SOUTH));
        entityitemframe.setDisplayedItem(new ItemStack(Items.ELYTRA));
        p_186175_3_.spawnEntityInWorld(entityitemframe);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:31,代碼來源:StructureEndCityPieces.java

示例14: getItemFrame

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
@Nullable

    /**
     * Return the item frame this stack is on. Returns null if not on an item frame.
     */
    public EntityItemFrame getItemFrame()
    {
        return this.field_190928_g ? null : this.itemFrame;
    }
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:10,代碼來源:ItemStack.java

示例15: calculateInputStrength

import net.minecraft.entity.item.EntityItemFrame; //導入依賴的package包/類
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    int i = super.calculateInputStrength(worldIn, pos, state);
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);

    if (iblockstate.hasComparatorInputOverride())
    {
        i = iblockstate.getComparatorInputOverride(worldIn, blockpos);
    }
    else if (i < 15 && iblockstate.isNormalCube())
    {
        blockpos = blockpos.offset(enumfacing);
        iblockstate = worldIn.getBlockState(blockpos);

        if (iblockstate.hasComparatorInputOverride())
        {
            i = iblockstate.getComparatorInputOverride(worldIn, blockpos);
        }
        else if (iblockstate.getMaterial() == Material.AIR)
        {
            EntityItemFrame entityitemframe = this.findItemFrame(worldIn, enumfacing, blockpos);

            if (entityitemframe != null)
            {
                i = entityitemframe.getAnalogOutput();
            }
        }
    }

    return i;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:34,代碼來源:BlockRedstoneComparator.java


注:本文中的net.minecraft.entity.item.EntityItemFrame類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。