Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void startBrunnen() {
- new BukkitRunnable() {
- @Override
- public void run() {
- if(brunnen){
- Location mitte = Utils.getBrunnenmitte();
- for(int i = 1; i <= 4; i++){
- Location ecke = Utils.getLocation("brunnen_ecke_"+i, FileManager.getLocationFile());
- Vector v = new Vector(ecke.getBlockX()-mitte.getBlockX(), ecke.getBlockY()-mitte.getBlockY(), ecke.getBlockZ()-mitte.getBlockZ()).normalize();
- v.multiply(0.4D);
- v.setY(0.6D);
- dropBlock(mitte, 79, (byte) 11, v);
- for(Entity en : ecke.getWorld().getEntities()){
- if(en instanceof Item){
- if(en.getLocation().distance(ecke) <=3){
- Item item = (Item) en;
- if(item.getItemStack().getType() == Material.ICE){
- item.remove();
- }
- }
- }
- if(en instanceof FallingBlock){
- if(en.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.AIR
- && en.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.COBBLE_WALL){
- en.remove();
- }
- }
- }
- }
- }
- }
- }.runTaskTimer(this, 0, 3);
- }
- public void dropBlock(Location loc, int id, byte data, Vector vec) {
- EntityFallingBlock entity = new EntityFallingBlock(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY(), loc.getZ(), Block.getById(id).fromLegacyData(data));
- entity.ticksLived = 1;
- ((CraftWorld) loc.getWorld()).getHandle().addEntity(entity, SpawnReason.CUSTOM);
- entity.getBukkitEntity().setVelocity(vec);
- }
Add Comment
Please, Sign In to add comment