本文整理汇总了Java中net.minecraft.world.GameType.NOT_SET属性的典型用法代码示例。如果您正苦于以下问题:Java GameType.NOT_SET属性的具体用法?Java GameType.NOT_SET怎么用?Java GameType.NOT_SET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.world.GameType
的用法示例。
在下文中一共展示了GameType.NOT_SET属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeGameType
/**
* if the gameType is currently NOT_SET then change it to par1
*/
public void initializeGameType(GameType type)
{
if (this.gameType == GameType.NOT_SET)
{
this.gameType = type;
}
this.setGameType(this.gameType);
}
示例2: onItemRightClick
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
ItemStack stack = playerIn.getHeldItem(hand);
if (playerIn.isSneaking() && hand == EnumHand.MAIN_HAND) {
/*
}
for (int i = 0; i < 5; ++i) {
RayTraceResult rayTrace = playerIn.rayTrace(i, 1.0F);
if (rayTrace != null) {
BlockPos pos = rayTrace.getBlockPos();
EnumFacing side = rayTrace.sideHit;
float hitX = (float) rayTrace.hitVec.xCoord;
float hitY = (float) rayTrace.hitVec.yCoord;
float hitZ = (float) rayTrace.hitVec.zCoord;
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
boolean flag = block.onBlockActivated(worldIn, pos, state, playerIn, hand, itemStackIn, side, hitX, hitY, hitZ);
if (rayTrace.getBlockPos() != null && (flag || block != Blocks.AIR || block instanceof ITileEntityProvider || (!flag && block.hasTileEntity(state)))) {
if (rayTrace.getBlockPos() != null && (block != Blocks.AIR || block instanceof ITileEntityProvider || block.hasTileEntity(state))) {
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
}
}
}
*/
ModGuiHandler.launchGui(GUIType.DANKNULL, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
}
else {
if (!worldIn.isRemote) {
InventoryDankNull inventory = new InventoryDankNull(stack);
ItemStack selectedStack = DankNullUtils.getSelectedStack(inventory);
if ((selectedStack.getItem() instanceof ItemSnowball) || (selectedStack.getItem() instanceof ItemEnderPearl) || (selectedStack.getItem() instanceof ItemEgg)) {
//TODO soon!
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
}
EntityPFakePlayer fakePlayer = EntityPFakePlayer.getFakePlayerForParent(playerIn);
if (fakePlayer.interactionManager.getGameType() != GameType.NOT_SET) {
fakePlayer.interactionManager.setGameType(GameType.NOT_SET);
}
fakePlayer.setHeldItem(EnumHand.MAIN_HAND, selectedStack);
fakePlayer.setItemInHand(selectedStack);
fakePlayer.posX = playerIn.posX;
fakePlayer.posY = playerIn.posY;
fakePlayer.posZ = playerIn.posZ;
fakePlayer.setRotationYawHead(playerIn.rotationYawHead);
fakePlayer.rotationYaw = playerIn.rotationYaw;
fakePlayer.rotationPitch = playerIn.rotationPitch;
fakePlayer.eyeHeight = playerIn.eyeHeight;
if (selectedStack.copy().getItem().onItemRightClick(worldIn, fakePlayer, hand).getType() == EnumActionResult.SUCCESS) {
DankNullUtils.decrSelectedStackSize(inventory, 0);
}
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
}
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
示例3: getGameModeFromCommand
/**
* Gets the Game Mode specified in the command.
*/
protected GameType getGameModeFromCommand(ICommandSender sender, String gameModeString) throws CommandException, NumberInvalidException
{
GameType gametype = GameType.parseGameTypeWithDefault(gameModeString, GameType.NOT_SET);
return gametype == GameType.NOT_SET ? WorldSettings.getGameTypeById(parseInt(gameModeString, 0, GameType.values().length - 2)) : gametype;
}