Spawn Creepers with Nametags!

LucGamesHD

Developer
Hey i have a methode to spawn creepers with nametags and more!
Have Fun! ;D

Cc23DAAW0AAGR7p.jpg

Java:
	@Override
	public boolean execute(CommandSender sender, String arg1, String[] args) {
		Player p = (Player)sender;
		
		if(args.length == 0){
			Block block = p.getLocation().getLevelBlock();
			Level level = p.getLevel();
			level.loadChunk(block.getFloorX(), block.getFloorZ());
			FullChunk chunk = level.getChunk((int)block.getX(),(int) block.getZ());
			CompoundTag nbt = new CompoundTag()
			.putList(new ListTag<DoubleTag>("Pos")
					.add(new DoubleTag("", block.getX() + 0.5))
					.add(new DoubleTag("", block.getY()))
					.add(new DoubleTag("", block.getZ() + 0.5)))
			.putList(new ListTag<DoubleTag>("Motion")
					.add(new DoubleTag("", 0))
					.add(new DoubleTag("", 0))
					.add(new DoubleTag("", 0)))
			.putList(new ListTag<FloatTag>("Rotation")
					.add(new FloatTag("", new Random().nextFloat() * 360))
					.add(new FloatTag("", 0)));
	
			EntityCreeper ent = new EntityCreeper(chunk, nbt);
			ent.setNameTag("§3§lIch bin Klausi");
			ent.spawnToAll();
		}
		
		return true;
	}
 
Top