本文整理汇总了Java中net.minecraft.world.GameType.CREATIVE属性的典型用法代码示例。如果您正苦于以下问题:Java GameType.CREATIVE属性的具体用法?Java GameType.CREATIVE怎么用?Java GameType.CREATIVE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.world.GameType
的用法示例。
在下文中一共展示了GameType.CREATIVE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doVoidFogParticles
public void doVoidFogParticles(int posX, int posY, int posZ)
{
int i = 32;
Random random = new Random();
ItemStack itemstack = this.mc.player.getHeldItemMainhand();
if (itemstack == null || Block.getBlockFromItem(itemstack.getItem()) != Blocks.BARRIER)
{
itemstack = this.mc.player.getHeldItemOffhand();
}
boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && !itemstack.func_190926_b() && itemstack.getItem() == Item.getItemFromBlock(Blocks.BARRIER);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int j = 0; j < 667; ++j)
{
this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
}
}
示例2: doVoidFogParticles
public void doVoidFogParticles(int posX, int posY, int posZ)
{
int i = 32;
Random random = new Random();
ItemStack itemstack = this.mc.thePlayer.getHeldItemMainhand();
boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.BARRIER;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int j = 0; j < 667; ++j)
{
this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
}
}
示例3: isCreative
public boolean isCreative() {
NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getConnection().getPlayerInfo(this.getGameProfile().getId());
return networkplayerinfo != null && networkplayerinfo.getGameType() == GameType.CREATIVE;
}
示例4: isCreative
public boolean isCreative()
{
return this.interactionManager.getGameType() == GameType.CREATIVE;
}
示例5: auxHarvestBlock
/**
* Destroys and tries to harvest a block with the currently active tool, except that instead of calling
* onBlockDestroyed, it calls onBlockAuxDestroyed on the tool, preventing infinite loops.
*/
public static boolean auxHarvestBlock(World world, BlockPos pos, EntityPlayerMP player) {
if (world.isRemote) return false; //Shouldn't even be possible if we have an EntityPlayerMP!
GameType gameType = player.interactionManager.getGameType();
int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(world, gameType, player, pos);
if (exp == -1) {
return false;
} else {
IBlockState iblockstate = world.getBlockState(pos);
if (iblockstate.getBlockHardness(world, pos)<0) return false;
TileEntity tileentity = world.getTileEntity(pos);
Block block = iblockstate.getBlock();
if ((block instanceof BlockCommandBlock || block instanceof BlockStructure) && !player.canUseCommandBlock()) {
world.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
return false;
} else {
ItemStack stack = player.getHeldItemMainhand();
if (!stack.isEmpty() && stack.getItem().onBlockStartBreak(stack, pos, player)) return false;
world.playEvent(player, 2001, pos, Block.getStateId(iblockstate));
boolean removed = false;
if (gameType==GameType.CREATIVE) {
removed = removeBlock(world, pos, player, false);
player.connection.sendPacket(new SPacketBlockChange(world, pos));
} else {
ItemStack itemstack1 = player.getHeldItemMainhand();
ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.EMPTY : itemstack1.copy();
boolean canHarvest = iblockstate.getBlock().canHarvestBlock(world, pos, player);
if (!itemstack1.isEmpty()) {
// itemstack1.onBlockDestroyed(world, iblockstate, pos, player);
if (itemstack1.getItem() instanceof IAuxDestroyBlock) {
((IAuxDestroyBlock)itemstack1.getItem()).onBlockAuxDestroyed(world, iblockstate, pos, player);
}
}
removed = removeBlock(world, pos, player, canHarvest);
if (removed && canHarvest) {
iblockstate.getBlock().harvestBlock(world, player, pos, iblockstate, tileentity, itemstack2);
}
}
// Drop experience
if (gameType!=GameType.CREATIVE && removed && exp > 0) {
iblockstate.getBlock().dropXpOnBlockBreak(world, pos, exp);
}
return removed;
}
}
}
示例6: isCreative
public boolean isCreative()
{
NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getConnection().getPlayerInfo(this.getGameProfile().getId());
return networkplayerinfo != null && networkplayerinfo.getGameType() == GameType.CREATIVE;
}