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


Java BaseBlock类代码示例

本文整理汇总了Java中com.sk89q.worldedit.blocks.BaseBlock的典型用法代码示例。如果您正苦于以下问题:Java BaseBlock类的具体用法?Java BaseBlock怎么用?Java BaseBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BaseBlock类属于com.sk89q.worldedit.blocks包,在下文中一共展示了BaseBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Override
  public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
  {
  	Player player = WorldGuardExtraFlagsPlugin.getPlugin().getServer().getPlayer(this.actor.getUniqueId());
if (WorldGuardUtils.hasBypass(player))
  	{
  		return super.setBlock(location, block);
  	}
  	else
  	{
  		if (WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(BukkitUtil.toLocation(player.getWorld(), location)).queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.WORLDEDIT) != State.DENY)
  		{
  			return super.setBlock(location, block);
  		}
  		else
  		{
  			return false;
  		}
  	}
  }
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:21,代码来源:WorldEditFlag.java

示例2: execute

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	ItemStack block = (ItemStack) this.block.getSingle(event);

	RegionManager regionManager = WGBukkit.getRegionManager((org.bukkit.World) world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	Vector v1 = regionManager.getRegion(name).getMaximumPoint();
	Vector v2 = regionManager.getRegion(name).getMinimumPoint();
	Region region = new CuboidRegion(v1, v2);
	BaseBlock b = new BaseBlock(block.getTypeId(), block.getData().getData());

	EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
	try {
		es.setBlocks(region, b);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:24,代码来源:EffSetBlocks.java

示例3: setFloor

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
public void setFloor(BufferedImage img, Pattern pattern, boolean white) {
    if (pattern instanceof BaseBlock) {
        setFloor(img, (char) ((BaseBlock) pattern).getCombined(), white);
    } else {
        if (img.getWidth() != getWidth() || img.getHeight() != getLength())
            throw new IllegalArgumentException("Input image dimensions do not match the current height map!");

        floor.record(() -> {
            char[] floorArr = floor.get();
            int index = 0;
            for (int z = 0; z < getLength(); z++) {
                mutable.mutZ(z);
                for (int x = 0; x < getWidth(); x++, index++) {
                    int height = img.getRGB(x, z) & 0xFF;
                    if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
                        mutable.mutX(x);
                        mutable.mutY(height);
                        floorArr[index] = (char) pattern.apply(mutable).getCombined();
                    }
                }
            }
        });
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:HeightMapMCAGenerator.java

示例4: getInverseBlocks

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
public Collection<BaseBlock> getInverseBlocks() {
    if (computedLegacyList != null) {
        return computedLegacyList;
    }
    computedLegacyList = new LinkedHashSet<>();
    for (int id = 0; id < FaweCache.getId(blocks.length); id++) {
        boolean all = true;
        ArrayList<BaseBlock> tmp = new ArrayList<BaseBlock>(16);
        for (int data = 0; data < 16; data++) {
            if (!blocks[FaweCache.getCombined(id, data)]) {
                tmp.add(FaweCache.getBlock(id, data));
            }
        }
        if (tmp.size() == 16) {
            computedLegacyList.add(new BaseBlock(id, -1));
        } else {
            computedLegacyList.addAll(tmp);
        }
    }
    return computedLegacyList;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:BlockMask.java

示例5: setBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Override
public boolean setBlock(int x, int y, int z, BaseBlock block) {
    try {
        int index = (HEADER_SIZE) + (getIndex(x, y, z) << 1);
        final int id = block.getId();
        final int data = block.getData();
        int combined = (id << 4) + data;
        mbb.putChar(index, (char) combined);
        CompoundTag tile = block.getNbtData();
        if (tile != null) {
            setTile(x, y, z, tile);
        }
        return true;
    } catch (Exception e) {
        MainUtil.handleError(e);
    }
    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:DiskOptimizedClipboard.java

示例6: primary

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Command(
        aliases = {"primary"},
        usage = "[brush-arguments]",
        desc = "Set the right click brush",
        help = "Set the right click brush",
        min = 1
)
public void primary(Player player, LocalSession session, CommandContext args) throws WorldEditException {
    BaseBlock item = player.getBlockInHand();
    BrushTool tool = session.getBrushTool(player, false);
    session.setTool(item, null, player);
    String cmd = "brush " + args.getJoinedStrings(0);
    CommandEvent event = new CommandEvent(player, cmd);
    CommandManager.getInstance().handleCommandOnCurrentThread(event);
    BrushTool newTool = session.getBrushTool(item, player, false);
    if (newTool != null && tool != null) {
        newTool.setSecondary(tool.getSecondary());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:BrushOptionsCommands.java

示例7: setBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Override
public boolean setBlock(int x1, int y1, int z1, BaseBlock block) throws WorldEditException {
    boolean result = false;
    Vector pos = getPos(x1, y1, z1);
    double sx = pos.getX();
    double sy = pos.getY();
    double sz = pos.getZ();
    double ex = pos.getX() + dx;
    double ey = Math.min(maxy, sy + dy);
    double ez = pos.getZ() + dz;
    for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
        for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
            for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
                result |= super.setBlock(pos, block);
            }
        }
    }
    return result;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:ScaleTransform.java

示例8: extinguishBrush

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Command(
        aliases = {"ex", "extinguish"},
        usage = "[radius=5]",
        desc = "Shortcut fire extinguisher brush",
        min = 0,
        max = 1
)
@CommandPermissions("worldedit.brush.ex")
public BrushSettings extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, CommandContext context) throws WorldEditException {
    worldEdit.checkMaxBrushRadius(radius);

    Pattern fill = (new BaseBlock(0));
    return get(context)
            .setBrush(new SphereBrush())
            .setSize(radius)
            .setFill(fill)
            .setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE)));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:BrushCommands.java

示例9: getSlope

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Override
public int getSlope(BaseBlock block, Vector vector) {
    int slope = super.getSlope(block, vector);
    if (slope != -1) {
        int x = vector.getBlockX();
        int y = vector.getBlockY();
        int z = vector.getBlockZ();
        int height = extent.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
        if (height > 0) {
            BaseBlock below = extent.getLazyBlock(x, height - 1, z);
            if (FaweCache.canPassThrough(block.getId(), block.getData())) {
                return Integer.MAX_VALUE;
            }
        }
    }
    return slope;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:AngleColorPattern.java

示例10: getBaseBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
/**
 * Gets an {@link BaseBlock} from a {@link ArgumentStack}.
 *
 * @param context the context
 * @return a pattern
 * @throws ParameterException on error
 * @throws WorldEditException on error
 */
@BindingMatch(type = BaseBlock.class,
        behavior = BindingBehavior.CONSUMES,
        consumedCount = 1)
public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException {
    Actor actor = context.getContext().getLocals().get(Actor.class);
    ParserContext parserContext = new ParserContext();
    parserContext.setActor(context.getContext().getLocals().get(Actor.class));
    if (actor instanceof Entity) {
        Extent extent = ((Entity) actor).getExtent();
        if (extent instanceof World) {
            parserContext.setWorld((World) extent);
        }
    }
    parserContext.setSession(worldEdit.getSessionManager().get(actor));
    try {
        return worldEdit.getBlockFactory().parseFromInput(context.next(), parserContext);
    } catch (NoMatchException e) {
        throw new ParameterException(e.getMessage(), e);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:WorldEditBinding.java

示例11: wrapForLogging

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
public void wrapForLogging(EditSessionEvent event)
    {
        event.setExtent(new AbstractLoggingExtent(event) {

            final WESlimefunManager this$0;
            private final EditSessionEvent val$event;

            protected void onBlockChange(Vector pos, BaseBlock b)
            {
                super.onBlockChange(pos, b);
                if(b.getType() == 0)
                {
                    org.bukkit.World world = Bukkit.getWorld(event.getWorld().getName());
                    if(world != null)
                    {
                        Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
                        if(BlockStorage.hasBlockInfo(l))
                            BlockStorage.clearBlockInfo(l);
                    }
                }
            }

            
            {
                this$0 = WESlimefunManager.this;
                event = editsessionevent;
                super($anonymous0);
            }
        }
);
    }
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:32,代码来源:WESlimefunManager.java

示例12: applyTileEntityData

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void applyTileEntityData(TileEntity tileEntity, BaseBlock baseBlock) {
    final ObjectStore store = ObjectStoreRegistry.get().get(tileEntity.getClass())
            .orElseThrow(() -> new IllegalStateException("Missing object store for tile " + tileEntity.getType()));
    final CompoundTag tag = baseBlock.getNbtData();
    final DataView dataView = tag == null ? DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED) : DataViewNbt.from(tag);
    store.deserialize(tileEntity, dataView);
}
 
开发者ID:LanternPowered,项目名称:LanternWorldEdit,代码行数:10,代码来源:LanternWEWorld.java

示例13: getBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public BaseBlock getBlock(Vector position) {
    final int state = BlockRegistryModule.get().getStateInternalIdAndData(
            getWorld().getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
    final Optional<TileEntity> optTile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
    final BaseBlock baseBlock = new BaseBlock(state >> 4, state & 0xf);
    if (optTile.isPresent()) {
        final TileEntity tile = optTile.get();
        final ObjectSerializer serializer = ObjectSerializerRegistry.get().get(tile.getClass()).get();
        final DataView dataView = serializer.serialize(tile);
        baseBlock.setNbtData(DataViewNbt.to(dataView));
    }
    return baseBlock;
}
 
开发者ID:LanternPowered,项目名称:LanternWorldEdit,代码行数:16,代码来源:LanternWEWorld.java

示例14: load

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
public static void load() {
	try {
		Chunk chunk = new Chunk(null, 0, 0);
		CuboidClipboard clipboard = CuboidClipboard.loadSchematic(new File(ProtocolSupportAntiBot.getInstance().getDataFolder(), name));
		for (int x = 0; x < clipboard.getLength(); x++) {
			for (int z = 0; z < clipboard.getWidth(); z++) {
				for (int y = 0; y < clipboard.getHeight(); y++) {
					BaseBlock block = clipboard.getBlock(new Vector(x, y, z));
					ChunkSection[] sections = chunk.getSections();
					int ysect = y >> 4;
					ChunkSection section = sections[ysect];
					if (section == null) {
						section = new ChunkSection(ysect, true);
						sections[ysect] = section; 
					}
					IBlockData iblockdata = Block.getById(block.getId()).fromLegacyData(block.getData());
					section.setType(x, y & 0xF, z, iblockdata);
					section.a(x, y & 0xF, z, 15);
					section.b(x, y & 0xF, z, 15);
				}
			}
		}
		PacketPlayOutMapChunk mapchunk = new PacketPlayOutMapChunk();
		chunkdata = PacketContainer.fromPacket(mapchunk);
		chunkdata.getBooleans().write(0, true);
		ByteBuf buffer = Unpooled.buffer();
		chunkdata.getIntegers().write(2, mapchunk.a(new PacketDataSerializer(buffer), chunk, true, 65535));
		byte[] bufferdata = new byte[buffer.readableBytes()];
		buffer.readBytes(bufferdata);
		chunkdata.getByteArrays().write(0, bufferdata);
		chunkdata.getSpecificModifier(List.class).write(0, Collections.emptyList());
	} catch (DataException | IOException e) {
	}
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportAntiBot,代码行数:35,代码来源:LobbySchematic.java

示例15: setBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入依赖的package包/类
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
    if (WEManager.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
        return super.setBlock(location, block);
    }
    return false;
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:8,代码来源:WEExtent.java


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