Java 类org.bukkit.entity.FallingBlock 实例源码
项目:Warzone
文件:SimpleAnvilTracker.java
public void clear(@Nonnull World world) {
// clear information about blocks in that world
Iterator<Map.Entry<Block, OfflinePlayer>> blockIt = this.placedAnvils.entrySet().iterator();
while(blockIt.hasNext()) {
Block block = blockIt.next().getKey();
if(block.getWorld().equals(world)) {
blockIt.remove();
}
}
// clear information about entitys in that world
Iterator<Map.Entry<FallingBlock, OfflinePlayer>> entityIt = this.ownedAnvils.entrySet().iterator();
while(entityIt.hasNext()) {
Entity tnt = entityIt.next().getKey();
if(tnt.getWorld().equals(world)) {
entityIt.remove();
}
}
}
项目:Warzone
文件:AnvilDamageResolver.java
public DamageInfo resolve(LivingEntity entity, Lifetime lifetime, EntityDamageEvent damageEvent) {
if(damageEvent instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) damageEvent;
if(event.getDamager() instanceof FallingBlock) {
FallingBlock anvil = (FallingBlock) event.getDamager();
OfflinePlayer offlineOwner = this.anvilTracker.getOwner(anvil);
Player onlineOwner = null;
if(offlineOwner != null) onlineOwner = offlineOwner.getPlayer();
return new AnvilDamageInfo(anvil, onlineOwner, offlineOwner);
}
}
return null;
}
项目:Arcadia-Spigot
文件:BombardmentGame.java
private void fireCannon(Location cannon, Location target) {
FallingBlock entity = cannon.getWorld().spawnFallingBlock(cannon, new MaterialData(Material.COAL_BLOCK));
this.playParticles(entity.getLocation());
entity.setGravity(true);
entity.setDropItem(false);
entity.setHurtEntities(false);
entity.setInvulnerable(true);
this.moveToward(entity, target, 2D);
new BukkitRunnable() {
public void run() {
if(entity.isDead()) {
this.cancel();
} else {
entity.setTicksLived(1);
}
}
}.runTaskTimer(this.getAPI().getPlugin(), 0, 20L);
totalCannonShots++;
}
项目:Arcadia-Spigot
文件:TrampolinioGame.java
private void spawnPoint() {
final Location spawnLocation = spawnLocations.get(new Random().nextInt(spawnLocations.size()));
for(Map.Entry<Location, Object[]> entry : this.currentLocations.entrySet()) {
if(spawnLocation.distance(entry.getKey()) >= 1D) continue;
return;
}
PointType pointType = PointType.fetch();
FallingBlock entity = spawnLocation.getWorld().spawnFallingBlock(spawnLocation, pointType.getMaterialData());
entity.setGravity(false);
entity.setDropItem(false);
entity.setHurtEntities(false);
entity.setInvulnerable(true);
entity.setCustomName(pointType.getTranslation());
entity.setCustomNameVisible(true);
new BukkitRunnable() {
public void run() {
if(entity.isDead()) {
this.cancel();
} else {
entity.setTicksLived(1);
entity.teleport(spawnLocation);
}
}
}.runTaskTimer(this.getAPI().getPlugin(), 0, 20L);
this.currentLocations.put(spawnLocation, new Object[]{pointType, entity});
}
项目:Slimefun4-Chinese-Version
文件:ItemListener.java
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
if (e.getEntity() instanceof FallingBlock) {
if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
e.setCancelled(true);
e.getEntity().remove();
}
}
else if (e.getEntity() instanceof Wither) {
SlimefunItem item = BlockStorage.check(e.getBlock());
if (item != null) {
if (item.getName().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
if (item.getName().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
}
}
}
项目:ProjectAres
文件:FallingBlocksMatchModule.java
@SuppressWarnings("deprecation")
private void fall(long pos, @Nullable ParticipantState breaker) {
// Block must be removed BEFORE spawning the FallingBlock, or it will not appear on the client
// https://bugs.mojang.com/browse/MC-72248
Block block = blockAt(this.getMatch().getWorld(), pos);
BlockState oldState = block.getState();
block.setType(Material.AIR, false);
FallingBlock fallingBlock = oldState.spawnFallingBlock();
BlockFallEvent event = new BlockFallEvent(block, fallingBlock);
getMatch().callEvent(breaker == null ? new BlockTransformEvent(event, block, Material.AIR)
: new ParticipantBlockTransformEvent(event, block, Material.AIR, breaker));
if(event.isCancelled()) {
fallingBlock.remove();
oldState.update(true, false); // Restore the old block if the fall is cancelled
} else {
// This is already air, but physics have not been applied yet, so do that now
block.simulateChangeForNeighbors(oldState.getMaterialData(), new MaterialData(Material.AIR));
}
}
项目:MinePlace
文件:PaintBlocksTask.java
@SuppressWarnings( value = "deprecation" )
private void placeBlock( int seq, int data )
{
int x = seq % 1000;
int z = seq / 1000;
Block block = this.getWorld().getBlockAt( x, this.getHeight(), z );
if( block.getType() != Material.WOOL )
{
block.setType( Material.WOOL );
}
byte woolColor = PlaceColor.getColorById( data ).getWoolColor();
if( block.getData() != woolColor )
{
block.setData( woolColor );
FallingBlock fb = this.getWorld().spawnFallingBlock( new Location( this.getWorld(), x, this.getFallingBlockHeight(), z ), Material.WOOL, woolColor );
fb.setDropItem( false );
fb.setHurtEntities( false );
}
}
项目:Skript
文件:DefaultComparators.java
@Override
public Relation compare(final DamageCause dc, final EntityData e) {
switch (dc) {
case ENTITY_ATTACK:
return Relation.get(e.isSupertypeOf(EntityData.fromClass(Entity.class)));
case PROJECTILE:
return Relation.get(e.isSupertypeOf(EntityData.fromClass(Projectile.class)));
case WITHER:
return Relation.get(e.isSupertypeOf(EntityData.fromClass(Wither.class)));
case FALLING_BLOCK:
return Relation.get(e.isSupertypeOf(EntityData.fromClass(FallingBlock.class)));
//$CASES-OMITTED$
default:
return Relation.NOT_EQUAL;
}
}
项目:SurvivalGamesX
文件:BlockListener.java
@EventHandler
public void fragBallExplode(EntityExplodeEvent e) {
e.setCancelled(true);
for(Block block : e.blockList()) {
if(block.getRelative(BlockFace.UP).getType() == Material.AIR && block.getType().isSolid()) {
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0, 1, 0), block.getType(), block.getData());
double x = (block.getLocation().getX() - e.getLocation().getX()) / 3,
y = 1,
z = (block.getLocation().getZ() - e.getLocation().getZ()) / 3;
fallingBlock.setVelocity(new Vector(x, y, z).normalize());
fallingBlock.setMetadata("explode", new FixedMetadataValue(plugin, false));
fallingBlock.setDropItem(false);
e.setYield(0F);
}
}
}
项目:Slimefun4
文件:ItemListener.java
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
if (e.getEntity() instanceof FallingBlock) {
if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
e.setCancelled(true);
e.getEntity().remove();
}
}
else if (e.getEntity() instanceof Wither) {
SlimefunItem item = BlockStorage.check(e.getBlock());
if (item != null) {
if (item.getID().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
if (item.getID().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
}
}
}
项目:manco2
文件:ManCo.java
@Override
@SuppressWarnings("deprecation")
public Crate spawnCrate(CratePlayer p, Crate crate, Location loc) {
if(p.hasCrate()) {
return crate;
}
if(canFall(loc)) {
if(getConfiguration().isCrateMessagesEnabled()) {
if(crate.getType() == CrateType.RARE) {
Bukkit.broadcastMessage(getConfiguration().getRareCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
} else if(crate.getType() == CrateType.NORMAL) {
Bukkit.broadcastMessage(getConfiguration().getNormalCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
}
}
FallingBlock fall = p.getPlayer().getWorld().spawnFallingBlock(loc.add(0, 1, 0), Material.CHEST, (byte)0);
fall.setMetadata("crate_serie", new FixedMetadataValue(this, crate.getCrateName()));
fall.setMetadata("crate_owner", new FixedMetadataValue(this, p.getPlayer().getName()));
getCrateOwners().add(p.getPlayer().getName());
}
return crate;
}
项目:ce
文件:Molotov.java
@SuppressWarnings("deprecation")
@Override
public void effect(Event e, ItemStack item, final int level) {
if(e instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
Entity target = event.getEntity();
World world = target.getWorld();
world.playEffect(target.getLocation(), Effect.POTION_BREAK, 10);
double boundaries = 0.1*level;
for(double x = boundaries; x >= -boundaries; x-=0.1)
for(double z = boundaries; z >= -boundaries; z-=0.1) {
FallingBlock b = world.spawnFallingBlock(target.getLocation(), Material.FIRE.getId(), (byte) 0x0);
b.setVelocity(new Vector(x, 0.1, z));
b.setDropItem(false);
}
}
}
项目:ManCo
文件:ManCo.java
@Override
@SuppressWarnings("deprecation")
public Crate spawnCrate(CratePlayer p, Crate crate, Location loc) {
if(p.hasCrate()) {
return crate;
}
if(canFall(loc)) {
if(getConfiguration().isCrateMessagesEnabled()) {
if(crate.getType() == CrateType.RARE) {
Bukkit.broadcastMessage(getConfiguration().getRareCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
} else if(crate.getType() == CrateType.NORMAL) {
Bukkit.broadcastMessage(getConfiguration().getNormalCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
}
}
FallingBlock fall = p.getPlayer().getWorld().spawnFallingBlock(loc.add(0, 1, 0), Material.CHEST, (byte)0);
fall.setMetadata("crate_serie", new FixedMetadataValue(this, crate.getCrateName()));
fall.setMetadata("crate_owner", new FixedMetadataValue(this, p.getPlayer().getName()));
getCrateOwners().add(p.getPlayer().getName());
}
return crate;
}
项目:tregmine
文件:GrinchListener.java
private static FallingBlock randBlock(Location l){
Location ground = new Location(l.getWorld(), l.getX(), l.getY() - 1, l.getZ());
Material block = ground.getBlock().getType();
Random rand = new Random();
int item = rand.nextInt(4);
Material stack = null;
Byte b = null;
if (item == 0){
stack = Material.WOOL;
b = 5;
}else if (item == 1){
stack = Material.WOOL;
b = 14;
}else if (item == 2){
stack = block;
b = 0;
}else if (item == 3){
stack = block;
b = 0;
}
return(l.getWorld().spawnFallingBlock(l, stack, b));
}
项目:DirtyArrows
文件:Iron.java
@Override
public void run() {
for (FallingBlock fb : plugin.anvils.keySet()) {
for (Entity en : fb.getWorld().getEntities()) {
if (!(en instanceof LivingEntity)) {
continue;
}
if (Util.inRegionOf(fb.getLocation(), en.getLocation(), 1)) {
((LivingEntity) en).damage(3.0f);
}
}
plugin.anvils.put(fb, plugin.anvils.get(fb) - 1);
if (plugin.anvils.get(fb) < 0) {
plugin.anvils.remove(fb);
}
}
}
项目:DirtyArrows
文件:Iron.java
@EventHandler
public void onBlockChange(EntityChangeBlockEvent e) {
if (e.getEntity() instanceof FallingBlock) {
if (plugin.anvils.containsKey(e.getEntity())) {
for (Entity ent : e.getEntity().getWorld().getEntities()) {
if (ent instanceof LivingEntity) {
LivingEntity len = (LivingEntity) ent;
if (Util.inRegionOf(len.getLocation(), e.getEntity().getLocation(), 3)) {
if (len instanceof Player) {
((Player) len).playSound(e.getEntity().getLocation(), Sound.ANVIL_LAND, 1, 1);
}
len.damage(10.0f);
}
}
}
}
plugin.anvils.remove(e.getEntity());
}
}
项目:RodsTwo
文件:Explosion.java
@EventHandler(ignoreCancelled=true)
public void onEntityExplode(EntityExplodeEvent event) {
if (event.getEntity() instanceof TNTPrimed &&
bombSites.containsKey((TNTPrimed) event.getEntity())) {
for (Block b : event.blockList()) {
if (Math.random() < 0.4) {
FallingBlock block = event.getEntity().getWorld().spawnFallingBlock(b.getLocation().add(0, 1, 0), b.getType(), b.getData());
Location bLoc = b.getLocation();
Location tLoc = event.getEntity().getLocation();
double power = 0.15;
double x = (bLoc.getX() - tLoc.getX()) * power + Math.random() - 0.5;
double z = (bLoc.getZ() - tLoc.getZ()) * power + Math.random() - 0.5;
double y = 0.8;
block.setVelocity(new Vector(x, y, z));
block.setDropItem(false);
}
b.setType(Material.AIR);
}
}
}
项目:block-saver
文件:ReinforcementManager.java
public ReinforcementManager(BlockSaverConfigurationContext configurationContext) {
this.feedbackManager = configurationContext.feedbackManager;
this.infoManager = configurationContext.infoManager;
infoManager.setReinforcementManager(this);
// Retrieves all of the configuration values relevant to Reinforcement managing from configurationContext.
this.tntDamagesReinforcedBlocks = configurationContext.tntDamagesReinforcedBlocks;
this.tntStripReinforcementEntirely = configurationContext.tntStripReinforcementEntirely;
this.fireDamagesReinforcedBlocks = configurationContext.fireDamagesReinforcedBlocks;
this.extinguishReinforcementFire = configurationContext.extinguishReinforcementFire;
this.allowReinforcementGracePeriod = configurationContext.allowReinforcementGracePeriod;
this.allowReinforcementHealing = configurationContext.allowReinforcementHealing;
this.leaveBlockAfterDeinforce = configurationContext.leaveBlockAfterDeinforce;
this.mobsInteractWithReinforcedBlocks = configurationContext.mobsInteractWithReinforcedBlocks;
this.enderdragonInteractWithReinforcedBlocks = configurationContext.enderdragonInteractWithReinforcedBlocks;
this.extinguishChance = configurationContext.extinguishChance;
this.reinforcementHealingTime = configurationContext.reinforcementHealingTime;
this.reinforceableBlocks = configurationContext.reinforceableBlocks;
this.reinforcementBlocks = configurationContext.reinforcementBlocks;
this.toolRequirements = configurationContext.toolRequirements;
fallingEntities = new TypeSafeSetImpl<>(new HashSet<FallingBlock>(), SupplementaryTypes.FALLING_BLOCK);
}
项目:xEssentials-deprecated-bukkit
文件:ExplosionRegenEvent.java
@SuppressWarnings("deprecation")
public void bounceBlock(BlockState b) {
if(b == null) return;
if(fallingBlocks.size() > 1500) {
return;
}
for(Material mat : allowedMaterials()) {
if(b.getType() == mat) {
FallingBlock fb = b.getWorld().spawnFallingBlock(b.getLocation(), b.getData().getItemType(), b.getData().getData());
float x = (float) -1 + (float) (Math.random() * ((1 - -1) + 1));
float y = 2;//(float) -5 + (float)(Math.random() * ((5 - -5) + 1));
float z = (float) -0.3 + (float)(Math.random() * ((0.3 - -0.3) + 1));
fb.setDropItem(false);
fb.setVelocity(new Vector(x, y, z));
fallingBlocks.add(fb);
fb.setMetadata("xe:explosion", new FixedMetadataValue(pl, ""));
}
}
}
项目:xEssentials-deprecated-bukkit
文件:RealisticTreeEvent.java
@SuppressWarnings("deprecation")
@EventHandler
public void onLand(EntityChangeBlockEvent e) {
if(e.getEntity() instanceof FallingBlock) {
FallingBlock fall = (FallingBlock) e.getEntity();
if(fall.hasMetadata("tree")) {
final Location loc = fall.getLocation().add(0,-1,0);
for(Entity entity : fall.getNearbyEntities(10, 180, 10)) {
if(entity instanceof Player) {
Player p = (Player) entity;
p.sendBlockChange(loc, fall.getBlockId(), fall.getBlockData());
p.playEffect(loc.add(0, 1, 0), Effect.STEP_SOUND, Material.LEAVES.getId());
}
}
SlowUpdateBlock slow = new SlowUpdateBlock(loc, 400L, pl);
slow.startUpdate();
e.setCancelled(true);
}
}
}
项目:Warzone
文件:AnvilListener.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilLand(EntityChangeBlockEvent event) {
if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;
if (event.getEntityType() == EntityType.FALLING_BLOCK && event.getTo() == Material.ANVIL) {
OfflinePlayer owner = tracker.getOwner((FallingBlock) event.getEntity());
if(owner != null) {
tracker.setPlacer(event.getBlock(), tracker.getOwner((FallingBlock) event.getEntity()));
tracker.setOwner((FallingBlock) event.getEntity(), null);
}
}
}
项目:Warzone
文件:SimpleAnvilTracker.java
@Nullable
public OfflinePlayer setOwner(@Nonnull FallingBlock anvil, @Nullable OfflinePlayer offlinePlayer) {
Preconditions.checkNotNull(anvil, "anvil");
if (offlinePlayer != null) {
return this.ownedAnvils.put(anvil, offlinePlayer);
} else {
return this.ownedAnvils.remove(anvil);
}
}
项目:Uranium
文件:CraftWorld.java
public FallingBlock spawnFallingBlock(Location location, org.bukkit.Material material, byte data) throws IllegalArgumentException {
Validate.notNull(location, "Location cannot be null");
Validate.notNull(material, "Material cannot be null");
Validate.isTrue(material.isBlock(), "Material must be a block");
double x = location.getBlockX() + 0.5;
double y = location.getBlockY() + 0.5;
double z = location.getBlockZ() + 0.5;
net.minecraft.entity.item.EntityFallingBlock entity = new net.minecraft.entity.item.EntityFallingBlock(world, x, y, z, net.minecraft.block.Block.getBlockById(material.getId()), data);
entity.field_145812_b = 1; // ticksLived
world.addEntity(entity, SpawnReason.CUSTOM);
return (FallingBlock) entity.getBukkitEntity();
}
项目:ZentrelaRPG
文件:MelodaBomb.java
@Override
public void castSpell(LivingEntity caster, MobData md, Player target) {
for (int k = 0; k < RMath.randInt(20, 35); k++) {
RScheduler.schedule(Spell.plugin, new Runnable() {
public void run() {
if (caster == null || !caster.isValid() || caster.isDead() || md.dead || md.despawned)
return;
Location loc = caster.getLocation();
double range = 10;
Location l = loc.clone().add(RMath.randDouble(-range, range), RMath.randDouble(10, 15), RMath.randDouble(-range, range));
FallingBlock fall = l.getWorld().spawnFallingBlock(l, Material.PACKED_ICE, (byte) 0);
fall.setDropItem(false);
fall.setHurtEntities(false);
RScheduler.schedule(Spell.plugin, new Runnable() {
public void run() {
if (fall.isDead()) {
MelodaBombEffect effect = new MelodaBombEffect(EffectFactory.em(), fall.getLocation());
effect.run();
Spell.damageNearby(md.getDamage() * 3, caster, fall.getLocation(), 2, null);
} else {
RScheduler.schedule(Spell.plugin, this, 3);
}
}
});
}
}, RMath.randInt(RTicks.seconds(1), RTicks.seconds(7)));
}
}
项目:ZentrelaRPG
文件:HweenPumpkinBomb.java
@Override
public void castSpell(LivingEntity caster, MobData md, Player target) {
for (int k = 0; k < 10; k++) {
RScheduler.schedule(Spell.plugin, new Runnable() {
public void run() {
if (caster == null || !caster.isValid() || caster.isDead() || md.dead || md.despawned)
return;
Location loc = caster.getLocation();
double range = 10;
Location l = loc.clone().add(RMath.randDouble(-range, range), RMath.randDouble(5, 10), RMath.randDouble(-range, range));
FallingBlock fall = l.getWorld().spawnFallingBlock(l, Material.JACK_O_LANTERN, (byte) 0);
fall.setDropItem(false);
fall.setHurtEntities(false);
RScheduler.schedule(Spell.plugin, new Runnable() {
public void run() {
if (fall.isDead()) {
HweenPumpkinBombEffect effect = new HweenPumpkinBombEffect(EffectFactory.em(), fall.getLocation());
effect.run();
Spell.damageNearby(md.getDamage() * 3, caster, fall.getLocation(), 2, null);
} else {
RScheduler.schedule(Spell.plugin, this, 3);
}
}
});
}
}, RMath.randInt(RTicks.seconds(1), RTicks.seconds(7)));
}
}
项目:Arcadia-Spigot
文件:TrampolinioGame.java
private void claimPoint(Player player, Location location) {
if(!this.currentLocations.containsKey(location)) return;
final PointType pointType = (PointType) this.currentLocations.get(location)[0];
final FallingBlock entity = (FallingBlock) this.currentLocations.get(location)[1];
this.currentLocations.remove(location);
entity.getWorld().playSound(entity.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1f, 1f);
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1.1f);
entity.remove();
ScoreSidebar scoreSidebar = ((ScoreSidebar) this.getSidebar());
scoreSidebar.setScore(player, (scoreSidebar.getScore(player) + pointType.getPoints()));
if(pointType == PointType.SUPER_BOOST) {
player.setVelocity(new org.bukkit.util.Vector(0, 1.7D, 0));
}
this.spawnPoint();
}
项目:ProjectAres
文件:BlockDropsMatchModule.java
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onFallingBlockLand(BlockTransformEvent event) {
if(event.getCause() instanceof EntityChangeBlockEvent) {
Entity entity = ((EntityChangeBlockEvent) event.getCause()).getEntity();
if(entity instanceof FallingBlock && this.fallingBlocksThatWillNotLand.remove(entity)) {
event.setCancelled(true);
}
}
}
项目:ProjectAres
文件:EntityTracker.java
public PhysicalInfo createEntity(Entity entity, @Nullable ParticipantState owner) {
if(entity instanceof ThrownPotion) {
return new ThrownPotionInfo((ThrownPotion) entity, owner);
} else if(entity instanceof FallingBlock) {
return new FallingBlockInfo((FallingBlock) entity, owner);
} else if(entity instanceof LivingEntity) {
return new MobInfo((LivingEntity) entity, owner);
} else {
return new EntityInfo(entity, owner);
}
}
项目:MockBukkit
文件:WorldMock.java
@Override
@Deprecated
public FallingBlock spawnFallingBlock(Location location, Material material, byte data)
throws IllegalArgumentException
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
项目:MockBukkit
文件:WorldMock.java
@Override
@Deprecated
public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData)
throws IllegalArgumentException
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
项目:Skript
文件:FallingBlockData.java
@SuppressWarnings("deprecation")
@Override
protected boolean init(final @Nullable Class<? extends FallingBlock> c, final @Nullable FallingBlock e) {
if (e != null)
types = new ItemType[] {new ItemType(e.getBlockId(), e.getBlockData())};
return true;
}
项目:Skript
文件:FallingBlockData.java
@SuppressWarnings("deprecation")
@Override
protected boolean match(final FallingBlock entity) {
if (types != null) {
for (final ItemType t : types) {
if (t.isOfType(entity.getBlockId(), entity.getBlockData()))
return true;
}
return false;
}
return true;
}
项目:Skript
文件:FallingBlockData.java
@SuppressWarnings("deprecation")
@Override
@Nullable
public FallingBlock spawn(final Location loc) {
final ItemType t = CollectionUtils.getRandom(types);
assert t != null;
final ItemStack i = t.getRandom();
if (i == null || i.getType() == Material.AIR || !i.getType().isBlock()) {
assert false : i;
return null;
}
return loc.getWorld().spawnFallingBlock(loc, i.getType(), (byte) i.getDurability());
}
项目:Breakpoint
文件:Breakpoint.java
private void test()
{
FallingBlock block = null;
Player player = null;
player.setPassenger(block);
}
项目:LeagueOfLegends
文件:EntityExplodeList.java
@EventHandler
public void onExplode(EntityExplodeEvent e) {
for (Block b : e.blockList()) {
FallingBlock fb = b.getWorld().spawnFallingBlock(b.getLocation(), b.getType(), b.getData());
b.setType(Material.AIR);
float x = (float) 0.1 + (float) (Math.random() * 0.4);
double y = 0.5;// (float) -5 + (float)(Math.random() * ((5 - -5) + 1));
float z = (float) 0.1 + (float) (Math.random() * 0.4);
fb.setVelocity(new Vector(x, y, z));
}
}
项目:FastAsyncWorldedit
文件:AsyncWorld.java
@Override
public FallingBlock spawnFallingBlock(Location location, MaterialData data) throws IllegalArgumentException {
return TaskManager.IMP.sync(new RunnableVal<FallingBlock>() {
@Override
public void run(FallingBlock value) {
this.value = parent.spawnFallingBlock(location, data);
}
});
}
项目:FastAsyncWorldedit
文件:AsyncWorld.java
@Override
@Deprecated
public FallingBlock spawnFallingBlock(final Location location, final int blockId, final byte blockData) throws IllegalArgumentException {
return TaskManager.IMP.sync(new RunnableVal<FallingBlock>() {
@Override
public void run(FallingBlock value) {
this.value = parent.spawnFallingBlock(location, blockId, blockData);
}
});
}
项目:Breakpoint
文件:Breakpoint.java
private void test()
{
FallingBlock block = null;
Player player = null;
player.setPassenger(block);
}
项目:BlockParty-1.8
文件:ChangeBlockListener.java
@EventHandler
public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
if (event.getEntityType() == EntityType.FALLING_BLOCK) {
FallingBlock fallingBlock = (FallingBlock) event.getEntity();
if (fallingBlock.getMaterial() == Material.STAINED_CLAY) {
event.setCancelled(true);
}
if (fallingBlock.getMaterial() == Material.WOOL) {
event.setCancelled(true);
}
}
}
项目:MagicLib
文件:CompatibilityUtils.java
public static void setFallingBlockDamage(FallingBlock entity, float fallHurtAmount, int fallHurtMax)
{
Object entityHandle = getHandle(entity);
if (entityHandle == null) return;
try {
class_EntityFallingBlock_hurtEntitiesField.set(entityHandle, true);
class_EntityFallingBlock_fallHurtAmountField.set(entityHandle, fallHurtAmount);
class_EntityFallingBlock_fallHurtMaxField.set(entityHandle, fallHurtMax);
} catch (Exception ex) {
ex.printStackTrace();
}
}