Java Code Examples for cn.nukkit.utils.Utils#dataToUUID()
The following examples show how to use
cn.nukkit.utils.Utils#dataToUUID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityHuman.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override protected void initEntity() { this.setDataFlag(DATA_PLAYER_FLAGS, DATA_PLAYER_FLAG_SLEEP, false); this.setDataFlag(DATA_FLAGS, DATA_FLAG_GRAVITY); this.setDataProperty(new IntPositionEntityData(DATA_PLAYER_BED_POSITION, 0, 0, 0), false); if (!(this instanceof Player)) { if (this.namedTag.contains("NameTag")) { this.setNameTag(this.namedTag.getString("NameTag")); } if (this.namedTag.contains("Skin") && this.namedTag.get("Skin") instanceof CompoundTag) { if (!this.namedTag.getCompound("Skin").contains("Transparent")) { this.namedTag.getCompound("Skin").putBoolean("Transparent", false); } this.setSkin(new Skin(this.namedTag.getCompound("Skin").getByteArray("Data"), this.namedTag.getCompound("Skin").getString("ModelId"))); } this.uuid = Utils.dataToUUID(String.valueOf(this.getId()).getBytes(StandardCharsets.UTF_8), this.getSkin() .getData(), this.getNameTag().getBytes(StandardCharsets.UTF_8)); } super.initEntity(); }
Example 2
Source File: EntityHuman.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override protected void initEntity() { this.setDataFlag(DATA_PLAYER_FLAGS, DATA_PLAYER_FLAG_SLEEP, false); this.setDataFlag(DATA_FLAGS, DATA_FLAG_GRAVITY); this.setDataProperty(new IntPositionEntityData(DATA_PLAYER_BED_POSITION, 0, 0, 0), false); if (!(this instanceof Player)) { if (this.namedTag.contains("NameTag")) { this.setNameTag(this.namedTag.getString("NameTag")); } if (this.namedTag.contains("Skin") && this.namedTag.get("Skin") instanceof CompoundTag) { if (!this.namedTag.getCompound("Skin").contains("Transparent")) { this.namedTag.getCompound("Skin").putBoolean("Transparent", false); } this.setSkin(new Skin( this.namedTag.getCompound("Skin").getString("skinId"), this.namedTag.getCompound("Skin").getByteArray("skinData"), this.namedTag.getCompound("Skin").getCompound("capeData").getByteArray("capeData"), this.namedTag.getCompound("Skin").getString("geometryName"), this.namedTag.getCompound("Skin").getCompound("geometryData").getString("geometryData") )); } this.uuid = Utils.dataToUUID(String.valueOf(this.getId()).getBytes(StandardCharsets.UTF_8), this.getSkin() .getSkinData(), this.getNameTag().getBytes(StandardCharsets.UTF_8)); } super.initEntity(); if (this instanceof Player) { ((Player) this).addWindow(this.inventory, 0); } }
Example 3
Source File: CraftingManager.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public void registerRecipe(Recipe recipe) { if (recipe instanceof CraftingRecipe) { UUID id = Utils.dataToUUID(String.valueOf(++RECIPE_COUNT), String.valueOf(recipe.getResult().getId()), String.valueOf(recipe.getResult().getDamage()), String.valueOf(recipe.getResult().getCount()), Arrays.toString(recipe.getResult().getCompoundTag())); ((CraftingRecipe) recipe).setId(id); this.recipes.add(recipe); } recipe.registerToCraftingManager(this); }
Example 4
Source File: CraftingManager.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public void registerRecipe(Recipe recipe) { if (recipe instanceof CraftingRecipe) { UUID id = Utils.dataToUUID(String.valueOf(++RECIPE_COUNT), String.valueOf(recipe.getResult().getId()), String.valueOf(recipe.getResult().getDamage()), String.valueOf(recipe.getResult().getCount()), Arrays.toString(recipe.getResult().getCompoundTag())); ((CraftingRecipe) recipe).setId(id); this.recipes.add(recipe); } recipe.registerToCraftingManager(this); }