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


Java Extent类代码示例

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


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

示例1: onInteract

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
/** protect playershop crates */
	
	@Listener
	public void onInteract(InteractBlockEvent event) {
		Optional<Player> source = event.getCause().first(Player.class);
		if (!source.isPresent()) return;
		if (!event.getTargetBlock().getLocation().isPresent()) return;
		Extent tex = event.getTargetBlock().getLocation().get().getExtent();
		Vector3i tv3 = event.getTargetBlock().getPosition(); 
		for (NPCguard g : VillagerShops.npcs)
			if (g.playershopcontainer != null && 
					g.playershopcontainer.getExtent().equals(tex) &&
					g.playershopcontainer.getBlockPosition().equals(tv3)) {
//				VillagerShops.l("Is Stock Container");
				if (	( g.playershopholder!=null && !g.playershopholder.equals(source.get().getUniqueId()) ) &&
						( !source.get().hasPermission("vshop.edit.admin")) ) {
//					VillagerShops.l("But not yours!");
					event.setCancelled(true);
					return;
				}
			}
	}
 
开发者ID:DosMike,项目名称:VillagerShops,代码行数:23,代码来源:EventListeners.java

示例2: onBlockBreak

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Listener
public void onBlockBreak(ChangeBlockEvent.Break event) {
	event.getTransactions().forEach(trans -> {
		if (trans.getOriginal().getState().getType().equals(BlockTypes.CHEST)) {
			Optional<Location<World>> w = trans.getOriginal().getLocation(); 
			if (!w.isPresent()) return;
			Extent tex = w.get().getExtent();
			Vector3i tv3 = w.get().getBlockPosition(); 
			for (NPCguard g : VillagerShops.npcs) {
				if (g.playershopcontainer != null &&
						g.playershopcontainer.getExtent().equals(tex) &&
						g.playershopcontainer.getBlockPosition().equals(tv3)) {
					trans.setValid(false);
				}
			}
		}
	});
}
 
开发者ID:DosMike,项目名称:VillagerShops,代码行数:19,代码来源:EventListeners.java

示例3: populate

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Override
public void populate(World world, Extent volume, Random random) {
  Vector3i min = volume.getBlockMin();
  Vector3i max = volume.getBlockMax();

  for (int x = min.getX(); x <= max.getX(); ++x) {
    for (int z = min.getZ(); z <= max.getZ(); ++z) {
      if (random.nextInt(20) != 0) {
        continue;
      }

      for (int y = min.getY(); y < 20; ++y) {
        Vector3i searchPoint = new Vector3i(x, y, z);
        if (world.getBlockType(searchPoint) == BlockTypes.LAVA) {
          Vector3i above = searchPoint.add(0, 1, 0);
          if (world.getBlockType(above) == BlockTypes.LAVA) {
            Vector3i lowPoint = searchPoint.add(0, -1, 0);
            if (world.getBlockType(lowPoint) == BlockTypes.STONE) {
              world.setBlockType(lowPoint, (BlockType) CustomBlockTypes.JURACK_ORE, Cause.source(SkreePlugin.container()).build());
            }
          }
        }
      }
    }
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:27,代码来源:JurackOrePopulator.java

示例4: populate

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Override
public void populate(World world, Extent volume, Random random) {
  Vector3i min = volume.getBlockMin();
  Vector3i size = volume.getBlockSize();
  BlockPos chunkPos = new BlockPos(min.getX(), min.getY(), min.getZ());

  for (int i = 0; i < 64; ++i) {
    int x = random.nextInt(size.getX());
    int z = random.nextInt(size.getZ());
    int y = random.nextInt(40);

    BlockPos targetBlock = chunkPos.add(x, y, z);
    BlockPos targetBaseBlock = targetBlock.add(0, -1, 0);

    generate((net.minecraft.world.World) world, random, targetBlock, targetBaseBlock);
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:18,代码来源:MagicMushroomPopulator.java

示例5: contains

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Override
public boolean contains(Location<? extends Extent> location) {
    if (location.getExtent().equals(extent)) {
        return this.contains(location.getPosition().toInt());
    }

    return false;
}
 
开发者ID:prism,项目名称:SafeGuard,代码行数:9,代码来源:CuboidVolume.java

示例6: putItemInWorld

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
static public void putItemInWorld(ItemStackSnapshot itemStackSnapshop, Location<World> spawnLocation) {
	Extent extent = spawnLocation.getExtent();
	Entity item = extent.createEntity(EntityTypes.ITEM, spawnLocation.getPosition());
	item.offer(Keys.REPRESENTED_ITEM, itemStackSnapshop);
	extent.spawnEntity(item, Cause.source(EntitySpawnCause.builder()
			.entity(item).type(SpawnTypes.PLUGIN).build()).build());

}
 
开发者ID:TheoKah,项目名称:CarrotShop,代码行数:9,代码来源:Shop.java

示例7: extentToJSONObject

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public static JSONObject extentToJSONObject(Extent extent) {
    JSONObject data = new JSONObject()
            .put("id", extent.getUniqueId().toString());

    if (extent instanceof World) {
        World w = (World) extent;

        data.put("Difficulty", w.getDifficulty().getId());
        data.put("Dimension", dimensionToJSONObject(w.getDimension()));
    }

    return data;
}
 
开发者ID:BadgeUp,项目名称:badgeup-sponge-client,代码行数:14,代码来源:ObjectSerializers.java

示例8: SoftBufferExtentViewDownsize

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public SoftBufferExtentViewDownsize(Extent extent, Vector3i blockMin, Vector3i blockMax, Vector3i hardMin, Vector3i hardMax) {
    this.extent = extent;
    this.blockMin = blockMin;
    this.blockMax = blockMax;
    this.blockSize = this.blockMax.sub(this.blockMin).add(Vector3i.ONE);
    this.biomeMin = new Vector3i(blockMin.getX(), 0, blockMin.getZ());
    this.biomeMax = new Vector3i(blockMax.getX(), 1, blockMax.getZ());
    this.biomeSize = this.biomeMax.sub(this.biomeMin).add(Vector3i.ONE.mul(0, 1, 0));
    this.hardBlockMin = hardMin;
    this.hardBlockMax = hardMax;
    this.hardBiomeMin = new Vector3i(hardMin.getX(), 0, hardMin.getZ());
    this.hardBiomeMax = new Vector3i(hardMax.getX(), 1, hardMax.getZ());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:14,代码来源:SoftBufferExtentViewDownsize.java

示例9: getExtentView

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Override
public Extent getExtentView(Vector3i newMin, Vector3i newMax) {
    checkSoftRange(newMin);
    checkSoftRange(newMax);
    return new SoftBufferExtentViewDownsize(this.extent, newMin, newMax, newMin.add(this.hardBlockMin.sub(this.blockMin)),
            newMax.add(this.hardBlockMax.sub(this.blockMax)));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:SoftBufferExtentViewDownsize.java

示例10: ExtentViewDownsize

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public ExtentViewDownsize(Extent extent, Vector3i blockMin, Vector3i blockMax) {
    this.extent = extent;
    this.blockMin = blockMin;
    this.blockMax = blockMax;
    this.blockSize = this.blockMax.sub(this.blockMin).add(Vector3i.ONE);
    this.biomeMin = new Vector3i(blockMin.getX(), 0, blockMin.getZ());
    this.biomeMax = new Vector3i(blockMax.getX(), 1, blockMax.getZ());
    this.biomeSize = this.biomeMax.sub(this.biomeMin).add(Vector3i.ONE.mul(1, 0, 1));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:ExtentViewDownsize.java

示例11: SelectorResolver

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
private SelectorResolver(Collection<? extends Extent> extents, @Nullable Vector3d position, @Nullable CommandSource original, Selector selector,
        boolean force) {
    this.extents = ImmutableSet.copyOf(extents);
    this.position = position == null ? ORIGIN : position;
    this.original = Optional.ofNullable(original);
    this.selector = checkNotNull(selector);
    this.selectorFilter = makeFilter();
    this.alwaysUsePosition = force;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:SelectorResolver.java

示例12: resolve

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public Set<Entity> resolve() {
    SelectorType selectorType = this.selector.getType();
    int defaultCount = 1;
    if (INFINITE_TYPES.contains(selectorType)) {
        defaultCount = 0;
    }
    int maxToSelect = this.selector.get(ArgumentTypes.COUNT).orElse(defaultCount);
    Set<? extends Extent> extents = getExtentSet();
    int count = 0;
    ImmutableSet.Builder<Entity> entities = ImmutableSet.builder();
    for (Extent extent : extents) {
        Collection<Entity> allEntities = extent.getEntities();
        if (selectorType == SelectorTypes.RANDOM) {
            List<Entity> entityList = new ArrayList<Entity>(allEntities);
            Collections.shuffle(entityList);
            allEntities = entityList;
        }

        for (Entity e : allEntities) {
            if (!this.selectorFilter.test(e)) {
                continue;
            }
            entities.add(e);
            count++;
            if (maxToSelect != 0 && count > maxToSelect) {
                break;
            }
        }
    }
    return entities.build();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:32,代码来源:SelectorResolver.java

示例13: spawnEntity

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src)
{
	velocity = velocity.mul(5);
	Extent extent = location.getExtent();
	Entity kitten = extent.createEntity(EntityTypes.OCELOT, location.getPosition());
	kitten.offer(Keys.VELOCITY, velocity);
	extent.spawnEntity(kitten, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:9,代码来源:KittyCannonExecutor.java

示例14: spawnEntity

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src)
{
	Extent extent = location.getExtent();
	Entity fireball = extent.createEntity(EntityTypes.FIREBALL, location.getPosition());
	fireball.offer(Keys.VELOCITY, velocity);
	extent.spawnEntity(fireball, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:8,代码来源:FireballExecutor.java

示例15: getWorldAs

import org.spongepowered.api.world.extent.Extent; //导入依赖的package包/类
@Override
public < T > Optional< T > getWorldAs( Class< T > tClass )
{
    if ( OglofusUtils.equalClass( tClass, World.class ) )
    {
        return Optional.of( ( T ) sponge.getServer().getWorld( this.world ) );
    } else
        if ( OglofusUtils.equalClass( tClass, Extent.class ) )
        {
            getLocationAs( Location.class ).get().getExtent();
        }
    return Optional.absent();
}
 
开发者ID:nikosgram13,项目名称:OglofusProtection,代码行数:14,代码来源:OglofusProtectionLocation.java


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