当前位置: 首页>>代码示例>>Java>>正文


Java PlayerUser类代码示例

本文整理汇总了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);
			}
		});
	}
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:19,代码来源:AdapterWritingDesk.java

示例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;

			}
		});
	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:19,代码来源:TileEntitySprinkler.java

示例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);
			}
		});
	}
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:15,代码来源:AdapterWritingDesk.java

示例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);
		}
	});

}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:14,代码来源:TileEntityGoldenEgg.java


注:本文中的openmods.fakeplayer.FakePlayerPool.PlayerUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。