本文整理汇总了Java中openmods.fakeplayer.FakePlayerPool.PlayerUser类的典型用法代码示例。如果您正苦于以下问题:Java PlayerUser类的具体用法?Java PlayerUser怎么用?Java PlayerUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerUser类属于openmods.fakeplayer.FakePlayerPool包,在下文中一共展示了PlayerUser类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeSymbol
import openmods.fakeplayer.FakePlayerPool.PlayerUser; //导入依赖的package包/类
@ScriptCallable(description = "Create a symbol page from the target symbol")
public void writeSymbol(final TileEntity desk,
@Arg(name = "deskSlot") Index deskSlot,
@Arg(name = "notebookSlot", description = "The source symbol to copy") Index notebookSlot) {
Preconditions.checkNotNull(MystcraftAccess.pageApi, "Functionality not available");
final NotebookWrapper wrapper = createInventoryWrapper(desk, deskSlot);
ItemStack page = wrapper.getPageFromSlot(notebookSlot);
final String symbol = MystcraftAccess.pageApi.getPageSymbol(page);
if (symbol != null) {
FakePlayerPool.instance.executeOnPlayer((WorldServer)desk.getWorldObj(), new PlayerUser() {
@Override
public void usePlayer(OpenModsFakePlayer fakePlayer) {
WRITE_SYMBOL.call(desk, fakePlayer, symbol);
}
});
}
}
示例2: attemptFertilize
import openmods.fakeplayer.FakePlayerPool.PlayerUser; //导入依赖的package包/类
private void attemptFertilize() {
if (!(world instanceof WorldServer)) return;
final int fertilizerChance = hasBonemeal? Config.sprinklerBonemealFertizizeChance : Config.sprinklerFertilizeChance;
if (RANDOM.nextDouble() < 1.0 / fertilizerChance) {
FakePlayerPool.instance.executeOnPlayer((WorldServer)world, (PlayerUser)fakePlayer -> {
final int x = selectFromRange(Config.sprinklerEffectiveRange);
final int z = selectFromRange(Config.sprinklerEffectiveRange);
for (int y = -1; y <= 1; y++) {
BlockPos target = pos.add(x, y, z);
if (ItemDye.applyBonemeal(BONEMEAL.copy(), world, target, fakePlayer, EnumHand.MAIN_HAND))
break;
}
});
}
}
示例3: writeSymbol
import openmods.fakeplayer.FakePlayerPool.PlayerUser; //导入依赖的package包/类
@ScriptCallable(description = "Create a symbol page from the target symbol")
public void writeSymbol(final TileEntity desk,
@Arg(name = "deskSlot") Index deskSlot,
@Arg(name = "notebookSlot", description = "The source symbol to copy") Index notebookSlot) {
final String symbol = getSymbolFromPage(getNotebookStackInSlot(desk, deskSlot, notebookSlot));
if (symbol != null) {
FakePlayerPool.instance.executeOnPlayer((WorldServer)desk.getWorldObj(), new PlayerUser() {
@Override
public void usePlayer(OpenModsFakePlayer fakePlayer) {
WRITE_SYMBOL.call(desk, fakePlayer, symbol);
}
});
}
}
示例4: pickUpBlock
import openmods.fakeplayer.FakePlayerPool.PlayerUser; //导入依赖的package包/类
private void pickUpBlock(final WorldServer world, final BlockPos pos) {
FakePlayerPool.instance.executeOnPlayer(world, (PlayerUser)fakePlayer -> {
EntityBlock block = EntityBlock.create(fakePlayer, world, pos);
if (block != null) {
block.setHasAirResistance(false);
block.setHasGravity(false);
block.motionY = 0.1;
blocks.add(block);
world.spawnEntity(block);
}
});
}