Java 类net.minecraft.item.ItemBed 实例源码
项目:ShadowsOfPhysis
文件:PhysisArtifacts.java
public static boolean canItemAcceptSockets(ItemStack stack) {
Item item = stack.getItem();
if (item == PhysisItems.socketable) {
return false;
}
if (item instanceof ItemBlock
|| item instanceof ItemReed
|| item instanceof ItemBed
|| item instanceof ItemFood
|| item instanceof ItemPotion
|| item instanceof ItemMinecart
|| item instanceof ItemBoat
|| item instanceof ItemEnchantedBook
|| item instanceof ItemWritableBook
|| item instanceof ItemBucket
|| item instanceof ItemBucketMilk
|| item instanceof ItemDoor) {
return false;
}
if (item.getItemStackLimit(stack) > 1) {
return false;
}
if (item.hasContainerItem(stack)){
ItemStack container = item.getContainerItem(stack);
if (container != null && container.getItem() instanceof ItemBucket) {
return false;
}
}
if (item.getUnlocalizedName(stack).toLowerCase().contains("bucket")) {
return false;
}
return true;
}
项目:harshencastle
文件:ParticleItem.java
public ParticleItem(World world, double xCoordIn, double yCoordIn, double zCoordIn, double motionXIn,
double motionYIn, double motionZIn, float par14, boolean disableMoving, ItemStack stack) {
super(world, xCoordIn, yCoordIn, zCoordIn, motionXIn, motionYIn, motionZIn, par14, disableMoving);
this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(stack.getItem(), stack.getMetadata()));
if(stack.getItem() instanceof ItemBlock)
this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata())));
if(stack.getItem() instanceof UniversalBucket)
if(new Random().nextBoolean())
this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(((UniversalBucket)stack.getItem()).getFluid(stack).getFluid().getBlock().getDefaultState()));
else
this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(Items.BUCKET));
if(stack.getItem() instanceof ItemBed)
{
fxLayer = 3;
setLocation(new ResourceLocation("textures/entity/bed/" + EnumDyeColor.byMetadata(stack.getMetadata()).getName() + ".png"));
return;
}
List<BakedQuad> quadList = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, Minecraft.getMinecraft().player).getQuads((IBlockState)null, (EnumFacing)null, 0L);
int i = 0;
boolean flag = !stack.isEmpty();
boolean flag2 = false;
ArrayList<Integer> colors = new ArrayList<Integer>();
for (int j = quadList.size(); i < j; ++i)
{
BakedQuad bakedquad = quadList.get(i);
int k = -1;
if (flag && bakedquad.hasTintIndex())
{
flag2 = true;
k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());
if (EntityRenderer.anaglyphEnable)
k = TextureUtil.anaglyphColor(k);
k = k | -16777216;
colors.add(k);
}
}
if(flag2)
{
int color = colors.get(new Random().nextInt(colors.size()));
this.particleRed = ((color >> 16) & 0xFF) * 255;
this.particleGreen = ((color >> 8) & 0xFF) * 255;
this.particleBlue = ((color >> 0) & 0xFF) * 255;
}
}