Get the byte id of Wool

Hello,

I search how to get the Wool id. How can i do ? That’s my code:

	@Override
public void run() {
	
	for(Player players : main.getPlayers()) {
		
		Location<World> blockLoc = new Location(players.getWorld(), players.getLocation().getBlockX()-1, players.getLocation().getBlockY()-1, players.getLocation().getBlockZ());
		Location<World> playerLoc = new Location(players.getWorld(), players.getLocation().getBlockX(), players.getLocation().getBlockY()-1, players.getLocation().getBlockZ());
		
		if(playerLoc.getBlockType() == BlockTypes.WOOL) { // I want to find the red wool
			main.eliminate(players); 

			
		}
		redBlock.add(playerLoc);
	}
	
	for(Location<World> locs : redBlock) {
		if(!locs.getBlock().getType().equals(BlockTypes.AIR))
			locs.setBlockType(BlockTypes.WOOL);
		  
	}
	
	
}

Thank’s

You’d need to check it’s metadata (Will be different for 1.13)
https://github.com/DivineGenesis/BetterSoulBinding/blob/master/src/main/java/com/DivineGenesis/SoulBound/utils/SBUtil.java <-- this is how I get the metadata/ID of an itemstack

The question I want to know is why do you want the ID? I can not think of a valid reason to read/use IDs

After further thinking, I believe you can use Keys to get the color of wool which would be easiest

Keep it simple:

The docs explain how to use Keys to grab data from different places, ItemStacks included and to transform it. To answer your X Y question here’s the actual answer you should be looking for:

boolean isRed = player.getLocation().sub(0, 1, 0).getBlock().get(Keys.DYE_COLOR).map(color -> DyeColors.RED.equals(color)).orElse(false);

That is how you can get whether the player is standing on a red colored block (you can insert a wool block type check, but 1.13 is going to split up the block states into their own blocks, so this won’t work quite as well as it does now).

Yes it is. Using IDs is not supported at all by Sponge and the IDs have been removed in 1.13. you should always use the Sponge API over outdated Minecraft tech

I want to know the id of the wool because I want to create several teams, the goal of the game is not to walk on some wools, I must be able to differentiate them

Then get the DyeColor of the block and compare.

Location<World> loc;
Location<World> loc2;
if(loc.getTyp().equals(BlockTypes.WOOL){
    //Block is not wool
    return;
}
if(loc2.getType().equals(BlockTypes.WOOL){
    //Block is not wool
    return;
}
DyeColor color1 = loc.get(Keys.DYE_COLOR).get();
DyeColor color2 = loc2.get(Keys.DYE_COLOR).get();
if(color1.equals(color2)) {
  //Wool colors are the same
} else {
  //wool colors are not the same