基本概念和实用工具
Ponder场景是什么
BlockPos basin = util.grid.at(1, 2, 2);
BlockPos pressPos = util.grid.at(1, 4, 2); //辊压机位置
Vec3 basinSide = util.vector.blockSurface(basin, Direction.WEST); //工作盆侧面
ItemStack copper = new ItemStack(Items.COPPER_INGOT); //铜物品
ItemStack copperBlock = new ItemStack(Items.COPPER_BLOCK); //铜块物品
scene.overlay.showText(60)
.pointAt(basinSide)
.placeNearTarget()
.attachKeyFrame()
.text("Pressing items held in a Basin will cause them to be Compacted");
scene.idle(40);
scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basin), Pointing.DOWN).withItem(copper),
30);
scene.idle(30);
Class<MechanicalPressBlockEntity> type = MechanicalPressBlockEntity.class;
scene.world.modifyBlockEntity(pressPos, type, pte -> pte.getPressingBehaviour()
.start(Mode.BASIN)); //开始辊压
scene.idle(30); //等待辊压动画(是的,只能这样等,没有别的方法!)
scene.world.modifyBlockEntity(pressPos, type, pte -> pte.getPressingBehaviour()
.makeCompactingParticleEffect(util.vector.centerOf(basin), copper)); //生成辊压粒子效果
scene.world.modifyBlockEntityNBT(util.select.position(basin), BasinBlockEntity.class, nbt -> {
nbt.put("VisualizedItems",
NBTHelper.writeCompoundList(ImmutableList.of(IntAttached.with(1, copperBlock)), ia -> ia.getValue()
.serializeNBT()));
}); //给工作盆追加VisualizedItems nbt tag,从而产生物品输出动画
scene.idle(4); //等待物品下落动画(是的,只能这样等,没有别的方法!)
scene.world.createItemOnBelt(util.grid.at(1, 1, 1), Direction.UP, copperBlock);//在传送带上生成"落"在上面的工作盆输出物品
scene.idle(30);一个效果应该怎样实现
scene utils

Last updated