本文整理汇总了Java中net.minecraft.entity.item.EntityItem.getEntityItem方法的典型用法代码示例。如果您正苦于以下问题:Java EntityItem.getEntityItem方法的具体用法?Java EntityItem.getEntityItem怎么用?Java EntityItem.getEntityItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.item.EntityItem
的用法示例。
在下文中一共展示了EntityItem.getEntityItem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLivingUpdate
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
super.onLivingUpdate();
this.worldObj.theProfiler.startSection("looting");
if (!this.worldObj.isRemote && this.canPickUpLoot() && !this.dead && this.worldObj.getGameRules().getBoolean("mobGriefing"))
{
for (EntityItem entityitem : this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(1.0D, 0.0D, 1.0D)))
{
if (!entityitem.isDead && entityitem.getEntityItem() != null && !entityitem.cannotPickup())
{
this.updateEquipmentIfNeeded(entityitem);
}
}
}
this.worldObj.theProfiler.endSection();
}
示例2: updateEquipmentIfNeeded
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
* Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is
* better.
*/
protected void updateEquipmentIfNeeded(EntityItem itemEntity)
{
ItemStack itemstack = itemEntity.getEntityItem();
Item item = itemstack.getItem();
if (this.canVillagerPickupItem(item))
{
ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack);
if (itemstack1 == null)
{
itemEntity.setDead();
}
else
{
itemstack.stackSize = itemstack1.stackSize;
}
}
}
示例3: canAdvance
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
for (EntityItem item : items) {
if (!item.isDead && item.getEntityItem() != null) {
if (item.getEntityItem().getItem() == Items.WATER_BUCKET)
{
UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.WATER_DROP, pos.getX(), pos.getY(), pos.getZ(), 6));
item.setEntityItemStack(new ItemStack(Items.BUCKET, 1, 0));
return true;
}
}
}
return false;
}
示例4: onCollideWithPlayer
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
public void onCollideWithPlayer(EntityPlayer player)
{
if (!this.worldObj.isRemote)
{
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
boolean inground = nbt.hasKey("inGround") && nbt.getByte("inGround") == 1;
if(inground)
{
boolean flag = this.canBePickedUp == 1 || (this.canBePickedUp == 2 && player.capabilities.isCreativeMode);
EntityItem ei = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(this.pickupItem, 1, 0));
if (this.canBePickedUp == 1)
{
EntityItemPickupEvent event = new EntityItemPickupEvent(player, ei);
if (MinecraftForge.EVENT_BUS.post(event))
return;
}
ItemStack itemstack = ei.getEntityItem();
if (itemstack.stackSize <= 0)
flag = true;
else if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(itemstack))
flag = false;
if (flag)
{
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
player.onItemPickup(this, 1);
this.setDead();
}
}
}
}
示例5: transformModelCount
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private int transformModelCount(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_)
{
ItemStack itemstack = itemIn.getEntityItem();
Item item = itemstack.getItem();
if (item == null)
{
return 0;
}
else
{
boolean flag = p_177077_9_.isGui3d();
int i = this.getModelCount(itemstack);
float f = 0.25F;
float f1 = shouldBob() ? MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F : 0;
float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
if (flag || this.renderManager.options != null)
{
float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI);
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
return i;
}
}
示例6: transformModelCount
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private int transformModelCount(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_)
{
ItemStack itemstack = itemIn.getEntityItem();
Item item = itemstack.getItem();
if (item == null)
{
return 0;
}
else
{
boolean flag = p_177077_9_.isGui3d();
int i = this.getModelCount(itemstack);
float f = 0.25F;
float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
if (flag || this.renderManager.options != null)
{
float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI);
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
return i;
}
}
示例7: func_177077_a
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private int func_177077_a(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_)
{
ItemStack itemstack = itemIn.getEntityItem();
Item item = itemstack.getItem();
if (item == null)
{
return 0;
}
else
{
boolean flag = p_177077_9_.isGui3d();
int i = this.func_177078_a(itemstack);
float f = 0.25F;
float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
if (flag || this.renderManager.options != null)
{
float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI);
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
}
if (!flag)
{
float f6 = -0.0F * (float)(i - 1) * 0.5F;
float f4 = -0.0F * (float)(i - 1) * 0.5F;
float f5 = -0.046875F * (float)(i - 1) * 0.5F;
GlStateManager.translate(f6, f4, f5);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
return i;
}
}
示例8: renderItem
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void renderItem(EntityItemFrame itemFrame)
{
ItemStack itemstack = itemFrame.getDisplayedItem();
if (itemstack != null)
{
EntityItem entityitem = new EntityItem(itemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack);
Item item = entityitem.getEntityItem().getItem();
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
int i = itemFrame.getRotation();
if (item instanceof net.minecraft.item.ItemMap)
{
i = i % 4 * 2;
}
GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F);
net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(itemFrame, this);
if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
{
if (item instanceof net.minecraft.item.ItemMap)
{
this.renderManager.renderEngine.bindTexture(MAP_BACKGROUND_TEXTURES);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
float f = 0.0078125F;
GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
GlStateManager.translate(-64.0F, -64.0F, 0.0F);
MapData mapdata = Items.FILLED_MAP.getMapData(entityitem.getEntityItem(), itemFrame.worldObj);
GlStateManager.translate(0.0F, 0.0F, -1.0F);
if (mapdata != null)
{
this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, true);
}
}
else
{
GlStateManager.scale(0.5F, 0.5F, 0.5F);
if (!this.itemRenderer.shouldRenderItemIn3D(entityitem.getEntityItem()) || item instanceof ItemSkull)
{
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
}
GlStateManager.pushAttrib();
RenderHelper.enableStandardItemLighting();
this.itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
}
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
示例9: dropItemAndGetStack
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
protected ItemStack dropItemAndGetStack(EntityItem p_184816_1_)
{
this.world.spawnEntityInWorld(p_184816_1_);
return p_184816_1_.getEntityItem();
}
示例10: doRender
import net.minecraft.entity.item.EntityItem; //导入方法依赖的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(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (ModuleManager.getModule(NoRender.class).enabled) return;
ItemStack itemstack = entity.getEntityItem();
this.field_177079_e.setSeed(187L);
boolean flag = false;
if (this.bindEntityTexture(entity))
{
this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).setBlurMipmap(false, false);
flag = true;
}
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.pushMatrix();
IBakedModel ibakedmodel = this.itemRenderer.getItemModelMesher().getItemModel(itemstack);
int i = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel);
for (int j = 0; j < i; ++j)
{
if (ibakedmodel.isGui3d())
{
GlStateManager.pushMatrix();
if (j > 0)
{
float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
GlStateManager.translate(f, f1, f2);
}
GlStateManager.scale(0.5F, 0.5F, 0.5F);
ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND);
this.itemRenderer.renderItem(itemstack, ibakedmodel);
GlStateManager.popMatrix();
}
else
{
GlStateManager.pushMatrix();
ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND);
this.itemRenderer.renderItem(itemstack, ibakedmodel);
GlStateManager.popMatrix();
float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x;
float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y;
float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z;
GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5);
}
}
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
this.bindEntityTexture(entity);
if (flag)
{
this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).restoreLastBlurMipmap();
}
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
示例11: getEntityItemStack
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private static ItemStack getEntityItemStack(EntityItem ent) {
return ent.getEntityItem();
}
示例12: getStack
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
public static ItemStack getStack(EntityItem item) {
return item == null ? null : item.getEntityItem();
}