changed pixelblock item and added item to recipe book
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package eu.mhsl.minecraft.pixelblocks;
|
||||
|
||||
import eu.mhsl.minecraft.pixelblocks.pixelblock.PixelBlock;
|
||||
import eu.mhsl.minecraft.pixelblocks.utils.HeadUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -18,14 +19,13 @@ import java.util.UUID;
|
||||
|
||||
public class PixelBlockItem {
|
||||
public static UUID unusedBlockID = UUID.fromString("98fdf0ae-c3ab-4ef7-ae25-efd518d600de");
|
||||
public static final String itemTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzE5NGU5ZTc3NTdkMDZkNmY1ZTViZTg0NTQ4YTdjYjUyMTczZDY4Y2NmODAyZDIxMTI3NWQzMWNkYmEwYTA2ZSJ9fX0=";
|
||||
public static final NamespacedKey recipeKey = new NamespacedKey(PixelBlocksPlugin.plugin, "pixelblock");
|
||||
|
||||
public static @NotNull ItemStack getBlockAsItem(@NotNull PixelBlock block) {
|
||||
return PixelBlockItem.updateBlockAsItem(block, ItemStack.of(Material.GRAY_STAINED_GLASS));
|
||||
}
|
||||
|
||||
public static @NotNull ItemStack updateBlockAsItem(@NotNull PixelBlock block, @NotNull ItemStack itemStack) {
|
||||
String ownerName = Optional.ofNullable(Bukkit.getOfflinePlayer(block.ownerUUID).getName()).orElseGet(() -> block.ownerUUID.toString());
|
||||
|
||||
ItemStack itemStack = HeadUtil.getCustomTextureHead(itemTexture);
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
meta.itemName(Component.text(block.blockUUID.toString()));
|
||||
meta.displayName(Component.text("Pixelblock von " + ownerName));
|
||||
@@ -41,11 +41,11 @@ public class PixelBlockItem {
|
||||
}
|
||||
|
||||
public static @NotNull ItemStack getEmptyPixelBlock() {
|
||||
ItemStack item = ItemStack.of(Material.GRAY_STAINED_GLASS);
|
||||
ItemStack item = HeadUtil.getCustomTextureHead(itemTexture);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.displayName(Component.text("Leerer Pixelblock"));
|
||||
meta.lore(List.of(
|
||||
Component.text("Der erste Spieler, welcher den Block platziert wird der Besitzer des Blocks."),
|
||||
Component.text("Der erste Spieler, der den Block platziert wird zum Besitzer des Blocks."),
|
||||
Component.text("Klicke auf den gesetzten Block, um diesen zu bearbeiten!")
|
||||
));
|
||||
meta.setEnchantmentGlintOverride(true);
|
||||
@@ -55,12 +55,13 @@ public class PixelBlockItem {
|
||||
}
|
||||
|
||||
public static @NotNull Recipe getRecipe() {
|
||||
NamespacedKey key = new NamespacedKey(PixelBlocksPlugin.plugin, "pixelblock");
|
||||
ShapedRecipe recipe = new ShapedRecipe(key, getEmptyPixelBlock());
|
||||
recipe.shape("ABA", "BCB", "ABA");
|
||||
recipe.setIngredient('A', Material.DIAMOND_BLOCK);
|
||||
recipe.setIngredient('B', Material.EMERALD_BLOCK);
|
||||
recipe.setIngredient('C', Material.GRAY_STAINED_GLASS);
|
||||
ShapedRecipe recipe = new ShapedRecipe(recipeKey, getEmptyPixelBlock());
|
||||
recipe.shape("AEA", "BCB", "DDD");
|
||||
recipe.setIngredient('A', Material.GLASS);
|
||||
recipe.setIngredient('B', Material.DIAMOND_BLOCK);
|
||||
recipe.setIngredient('C', Material.HEART_OF_THE_SEA);
|
||||
recipe.setIngredient('D', Material.GRASS_BLOCK);
|
||||
recipe.setIngredient('E', Material.GLOW_BERRIES);
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user