本文整理了Java中net.minecraft.util.NonNullList.removeIf()
方法的一些代码示例,展示了NonNullList.removeIf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NonNullList.removeIf()
方法的具体详情如下:
包路径:net.minecraft.util.NonNullList
类名称:NonNullList
方法名:removeIf
暂无
代码示例来源:origin: ForestryMC/ForestryMC
@Override
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
NonNullList<ItemStack> harvested = NonNullList.create();
harvested.add(new ItemStack(Blocks.CHORUS_FLOWER));
float chance = ForgeEventFactory.fireBlockHarvesting(harvested, world, pos, BLOCK_STATE, 0, 1.0F, false, null);
harvested.removeIf(next -> world.rand.nextFloat() > chance);
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, BLOCK_STATE);
NetworkUtil.sendNetworkPacket(packet, pos, world);
world.setBlockToAir(pos);
return harvested;
}
}
代码示例来源:origin: lorddusk/HQM
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
drops.removeIf(ItemStack::isEmpty);
state = world.getBlockState(pos.down());
block.getDrops(drops, world, pos.down(), state, 0);
drops.removeIf(ItemStack::isEmpty);
内容来源于网络,如有侵权,请联系作者删除!