diff --git a/omc_items/builder_wand.yml b/omc_items/builder_wand.yml new file mode 100644 index 0000000..e870efa --- /dev/null +++ b/omc_items/builder_wand.yml @@ -0,0 +1,32 @@ +info: + namespace: omc_items +scripts: + builderwand: + enabled: true + path: iascript/builderwand +items: + builder_wand: + permission: omc_items.builder_wand + display_name: Builder Wand + lore: + - "§7Permet de poser une large zone de blocs" + resource: + material: WOODEN_SHOVEL + generate: false + model_path: items/builder_wand + blocked_enchants: + - ALL + durability: + usages: 1024 + events: + interact_mainhand: + right: + cancel: true + decrement_usages: + amount: 1 + script: + name: builderwand + attribute_modifiers: + mainhand: + attackDamage: 1 + attackSpeed: 1 diff --git a/omc_items/hammers.yml b/omc_items/hammers.yml new file mode 100644 index 0000000..edb341e --- /dev/null +++ b/omc_items/hammers.yml @@ -0,0 +1,91 @@ +info: + namespace: omc_items +items: + iron_hammer: + permission: customitems.iron_hammer + display_name: Marteau en fer + lore: + - "§7Permet de creuser une zone de 3x3 blocs" + resource: + material: IRON_PICKAXE + generate: false + model_path: items/hammers/iron_hammer + blocked_enchants: + - FORTUNE + - SILK_TOUCH + durability: + max_durability: 512 + + diamond_hammer: + permission: customitems.diamond_hammer + display_name: Marteau en diamant + lore: + - "§7Permet de creuser une zone de 3x3x2 blocs" + resource: + material: DIAMOND_PICKAXE + generate: false + model_path: items/hammers/diamond_hammer + blocked_enchants: + - FORTUNE + - SILK_TOUCH + durability: + max_durability: 2048 + + netherite_hammer: + permission: customitems.netherite_hammer + display_name: Marteau en netherite + lore: + - "§7Permet de creuser une zone de 3x3x3 blocs" + resource: + material: NETHERITE_PICKAXE + generate: false + model_path: items/hammers/netherite_hammer + blocked_enchants: + - FORTUNE + - SILK_TOUCH + durability: + max_durability: 4096 + +recipes: + crafting_table: + iron_hammer: + permission: omc_items.iron_hammer + enabled: true + pattern: + - BBB + - BSB + - XSX + ingredients: + B: IRON_BLOCK + S: STICK + result: + item: omc_items:iron_hammer + amount: 1 + + diamond_hammer: + permission: omc_items.diamond_hammer + enabled: true + pattern: + - BBB + - BSB + - XSX + ingredients: + B: DIAMOND_BLOCK + S: STICK + result: + item: omc_items:diamond_hammer + amount: 1 + + netherite_hammer: + permission: omc_items.netherite_hammer + enabled: true + pattern: + - BBB + - BSB + - XSX + ingredients: + B: NETHERITE_BLOCK + S: STICK + result: + item: omc_items:netherite_hammer + amount: 1 diff --git a/omc_items/iascript/builderwand.java b/omc_items/iascript/builderwand.java new file mode 100644 index 0000000..cc24f29 --- /dev/null +++ b/omc_items/iascript/builderwand.java @@ -0,0 +1,79 @@ +package iascript; + +import org.bukkit.plugin.Plugin; +import org.bukkit.event.Event; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.event.player.PlayerInteractEvent; + +import dev.lone.itemsadder.api.*; +import dev.lone.itemsadder.api.scriptinginternal.*; +import fr.openmc.core.features.city.ProtectionsManager; + +public class builderwand extends ItemScript { + + private static final int RADIUS = 2; + + public void handleEvent(Plugin plugin, Event event, Player player, CustomStack $customStack, ItemStack $itemStack) { + if (!(event instanceof PlayerInteractEvent playerInteractEvent)) + return; + playerInteractEvent.setCancelled(true); + Block origin = playerInteractEvent.getClickedBlock(); + if (origin == null) + return; + + BlockFace face = playerInteractEvent.getBlockFace(); + Material type = origin.getType(); + if (type.isAir()) + return; + + ItemStack wand = player.getInventory().getItemInMainHand(); + CustomStack cs = CustomStack.byItemStack(wand); + if (cs == null) + return; + + for (int a = -RADIUS; a <= RADIUS; a++) { + for (int b = -RADIUS; b <= RADIUS; b++) { + + Block base; + switch (face) { + case UP, DOWN -> base = origin.getRelative(a, 0, b); + case NORTH, SOUTH -> base = origin.getRelative(a, b, 0); + case EAST, WEST -> base = origin.getRelative(0, b, a); + default -> base = null; + } + + if (base == null) + continue; + + Block toPlace = base.getRelative(face); + + if (base.getType() != type) + continue; + if (!toPlace.getType().isAir()) + continue; + if (!ProtectionsManager.canInteract(player, toPlace.getLocation())) + continue; + if (player.getGameMode() != org.bukkit.GameMode.CREATIVE && !player.getInventory().contains(type)) + continue; + + toPlace.setType(type, false); + + if (player.getGameMode() != org.bukkit.GameMode.CREATIVE) { + for (ItemStack item : player.getInventory().getContents()) { + if (item == null) + continue; + if (item.getType() != type) + continue; + + item.setAmount(item.getAmount() - 1); + break; + } + } + } + } + } +} diff --git a/omc_items/models/items/builder_wand.json b/omc_items/models/items/builder_wand.json new file mode 100644 index 0000000..60d2645 --- /dev/null +++ b/omc_items/models/items/builder_wand.json @@ -0,0 +1,144 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "1": "omc_items:wands/builder_wand", + "particle": "omc_items:wands/builder_wand" + }, + "elements": [ + { + "from": [7, 0, 7], + "to": [9, 12, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 6, 8]}, + "faces": { + "north": {"uv": [0, 0, 1, 6], "texture": "#1"}, + "east": {"uv": [1, 0, 2, 6], "texture": "#1"}, + "south": {"uv": [2, 0, 3, 6], "texture": "#1"}, + "west": {"uv": [3, 0, 4, 6], "texture": "#1"}, + "up": {"uv": [9, 3, 8, 2], "texture": "#1"}, + "down": {"uv": [9, 3, 8, 4], "texture": "#1"} + } + }, + { + "name": "Bas", + "from": [6, 11, 6], + "to": [10, 13, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 12.5, 8]}, + "faces": { + "north": {"uv": [6, 7, 8, 8], "texture": "#1"}, + "east": {"uv": [8, 0, 10, 1], "texture": "#1"}, + "south": {"uv": [8, 1, 10, 2], "texture": "#1"}, + "west": {"uv": [2, 8, 4, 9], "texture": "#1"}, + "up": {"uv": [4, 8, 2, 6], "texture": "#1"}, + "down": {"uv": [8, 3, 6, 5], "texture": "#1"} + } + }, + { + "name": "Nord", + "from": [6, 13, 6], + "to": [10, 15, 6], + "faces": { + "north": {"uv": [4, 2, 6, 3], "texture": "#1"}, + "east": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "south": {"uv": [6, 2, 8, 3], "texture": "#1"}, + "west": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "up": {"uv": [0, 0, 1, 0], "texture": "#1"}, + "down": {"uv": [0, 0, 1, 0], "texture": "#1"} + } + }, + { + "name": "Sud", + "from": [6, 13, 10], + "to": [10, 15, 10], + "faces": { + "north": {"uv": [0, 8, 2, 9], "texture": "#1"}, + "east": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "south": {"uv": [4, 5, 6, 6], "texture": "#1"}, + "west": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "up": {"uv": [0, 0, 1, 0], "texture": "#1"}, + "down": {"uv": [0, 0, 1, 0], "texture": "#1"} + } + }, + { + "name": "Est", + "from": [10, 13, 6], + "to": [10, 15, 10], + "faces": { + "north": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "east": {"uv": [0, 8, 2, 9], "texture": "#1"}, + "south": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "west": {"uv": [4, 5, 6, 6], "texture": "#1"}, + "up": {"uv": [0, 0, 0, 2], "texture": "#1"}, + "down": {"uv": [0, 0, 0, 2], "texture": "#1"} + } + }, + { + "name": "Ouest", + "from": [6, 13, 6], + "to": [6, 15, 10], + "faces": { + "north": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "east": {"uv": [4, 2, 6, 3], "texture": "#1"}, + "south": {"uv": [0, 0, 0, 3], "texture": "#1"}, + "west": {"uv": [6, 2, 8, 3], "texture": "#1"}, + "up": {"uv": [0, 0, 0, 2], "texture": "#1"}, + "down": {"uv": [0, 0, 0, 2], "texture": "#1"} + } + }, + { + "name": "Diamond", + "from": [7, 15, 7], + "to": [9, 17, 9], + "rotation": {"angle": -45, "axis": "x", "origin": [8, 16, 8]}, + "faces": { + "north": {"uv": [8, 4, 9, 5], "texture": "#1"}, + "east": {"uv": [5, 8, 6, 9], "texture": "#1"}, + "south": {"uv": [8, 5, 9, 6], "texture": "#1"}, + "west": {"uv": [4, 8, 5, 9], "texture": "#1"}, + "up": {"uv": [7, 9, 6, 8], "rotation": 270, "texture": "#1"}, + "down": {"uv": [9, 6, 8, 7], "rotation": 90, "texture": "#1"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [0, 24, 0], + "translation": [0, 3.5, 0] + }, + "thirdperson_lefthand": { + "rotation": [0, 24, 0], + "translation": [0, 3.5, 0] + }, + "firstperson_righthand": { + "rotation": [0, 15, 0], + "translation": [0, 0.25, 0] + }, + "firstperson_lefthand": { + "rotation": [0, 15, 0], + "translation": [0, 0.25, 0] + }, + "gui": { + "rotation": [0, 40, -30], + "translation": [0.5, 0, 0] + }, + "head": { + "rotation": [-57, 0, 0], + "translation": [0, 8.25, -11] + } + }, + "groups": [ + { + "name": "Stick", + "origin": [8, 6, 8], + "color": 0, + "children": [0] + }, + { + "name": "EmeraldPart", + "origin": [8, 6, 8], + "color": 0, + "children": [1, 2, 3, 4, 5] + }, + 6 + ] +} \ No newline at end of file diff --git a/omc_items/models/items/hammers/diamond_hammer.json b/omc_items/models/items/hammers/diamond_hammer.json new file mode 100644 index 0000000..c564fe0 --- /dev/null +++ b/omc_items/models/items/hammers/diamond_hammer.json @@ -0,0 +1,91 @@ +{ + "credit": "Made with Blockbench", + "ambientocclusion": false, + "texture_size": [64, 64], + "textures": { + "1": "omc_items:items/hammers/diamond_hammer" + }, + "elements": [ + { + "from": [7, 0, 7], + "to": [9, 22, 9], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [2, 4, 2.5, 9.5], "texture": "#1" }, + "east": { "uv": [2.5, 4, 3, 9.5], "texture": "#1" }, + "south": { "uv": [3, 4, 3.5, 9.5], "texture": "#1" }, + "west": { "uv": [3.5, 5.25, 4, 10.75], "texture": "#1" }, + "up": { "uv": [6, 6, 5.5, 5.5], "texture": "#1" }, + "down": { "uv": [0.5, 5.75, 0, 6.25], "texture": "#1" } + } + }, + { + "from": [1, 14, 4], + "to": [15, 21, 12], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [3.5, 0, 7, 1.75], "texture": "#1" }, + "east": { "uv": [3.5, 3.5, 5.5, 5.25], "texture": "#1" }, + "south": { "uv": [3.5, 1.75, 7, 3.5], "texture": "#1" }, + "west": { "uv": [0, 4, 2, 5.75], "texture": "#1" }, + "up": { "uv": [3.5, 2, 0, 0], "texture": "#1" }, + "down": { "uv": [3.5, 2, 0, 4], "texture": "#1" } + } + }, + { + "from": [6.5, -0.75, 6.5], + "to": [9.5, 1.25, 9.5], + "rotation": { "angle": 0, "axis": "y", "origin": [7, -0.75, 7] }, + "faces": { + "north": { "uv": [5.5, 3.5, 6.25, 4], "texture": "#1" }, + "east": { "uv": [5.5, 4, 6.25, 4.5], "texture": "#1" }, + "south": { "uv": [5.5, 4.5, 6.25, 5], "texture": "#1" }, + "west": { "uv": [5.5, 5, 6.25, 5.5], "texture": "#1" }, + "up": { "uv": [4.75, 6, 4, 5.25], "texture": "#1" }, + "down": { "uv": [5.5, 5.25, 4.75, 6], "texture": "#1" } + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "thirdperson_lefthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "firstperson_righthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "firstperson_lefthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "ground": { + "rotation": [0, 45, -180], + "translation": [0, 8.5, 0], + "scale": [0.69, 0.69, 0.69] + }, + "gui": { + "rotation": [1.5, 0, 41.25], + "translation": [2.75, -3, 0], + "scale": [0.69, 0.69, 0.69] + }, + "head": { + "rotation": [-78.21, -88.14, 15.57], + "translation": [0.75, 13.75, 8.5] + }, + "fixed": { + "rotation": [180, 0, -142.5], + "translation": [-2.5, -3, 0], + "scale": [0.8, 0.8, 0.8] + } + } +} diff --git a/omc_items/models/items/hammers/iron_hammer.json b/omc_items/models/items/hammers/iron_hammer.json new file mode 100644 index 0000000..bfe1650 --- /dev/null +++ b/omc_items/models/items/hammers/iron_hammer.json @@ -0,0 +1,91 @@ +{ + "credit": "Made with Blockbench", + "ambientocclusion": false, + "texture_size": [64, 64], + "textures": { + "1": "omc_items:items/hammers/iron_hammer" + }, + "elements": [ + { + "from": [7, 0, 7], + "to": [9, 22, 9], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [2, 4, 2.5, 9.5], "texture": "#1" }, + "east": { "uv": [2.5, 4, 3, 9.5], "texture": "#1" }, + "south": { "uv": [3, 4, 3.5, 9.5], "texture": "#1" }, + "west": { "uv": [3.5, 5.25, 4, 10.75], "texture": "#1" }, + "up": { "uv": [6, 6, 5.5, 5.5], "texture": "#1" }, + "down": { "uv": [0.5, 5.75, 0, 6.25], "texture": "#1" } + } + }, + { + "from": [1, 14, 4], + "to": [15, 21, 12], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [3.5, 0, 7, 1.75], "texture": "#1" }, + "east": { "uv": [3.5, 3.5, 5.5, 5.25], "texture": "#1" }, + "south": { "uv": [3.5, 1.75, 7, 3.5], "texture": "#1" }, + "west": { "uv": [0, 4, 2, 5.75], "texture": "#1" }, + "up": { "uv": [3.5, 2, 0, 0], "texture": "#1" }, + "down": { "uv": [3.5, 2, 0, 4], "texture": "#1" } + } + }, + { + "from": [6.5, -0.75, 6.5], + "to": [9.5, 1.25, 9.5], + "rotation": { "angle": 0, "axis": "y", "origin": [7, -0.75, 7] }, + "faces": { + "north": { "uv": [5.5, 3.5, 6.25, 4], "texture": "#1" }, + "east": { "uv": [5.5, 4, 6.25, 4.5], "texture": "#1" }, + "south": { "uv": [5.5, 4.5, 6.25, 5], "texture": "#1" }, + "west": { "uv": [5.5, 5, 6.25, 5.5], "texture": "#1" }, + "up": { "uv": [4.75, 6, 4, 5.25], "texture": "#1" }, + "down": { "uv": [5.5, 5.25, 4.75, 6], "texture": "#1" } + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "thirdperson_lefthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "firstperson_righthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "firstperson_lefthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "ground": { + "rotation": [0, 45, -180], + "translation": [0, 5.25, 0], + "scale": [0.69, 0.69, 0.69] + }, + "gui": { + "rotation": [1.5, 0, 41.25], + "translation": [2.75, -3, 0], + "scale": [0.69, 0.69, 0.69] + }, + "head": { + "rotation": [-78.21, -88.14, 15.57], + "translation": [0.75, 13.75, 8.5] + }, + "fixed": { + "rotation": [180, 0, -142.5], + "translation": [-2.5, -3, 0], + "scale": [0.8, 0.8, 0.8] + } + } +} diff --git a/omc_items/models/items/hammers/netherite_hammer.json b/omc_items/models/items/hammers/netherite_hammer.json new file mode 100644 index 0000000..4ae1d91 --- /dev/null +++ b/omc_items/models/items/hammers/netherite_hammer.json @@ -0,0 +1,91 @@ +{ + "credit": "Made with Blockbench", + "ambientocclusion": false, + "texture_size": [64, 64], + "textures": { + "1": "omc_items:items/hammers/netherite_hammer" + }, + "elements": [ + { + "from": [7, 0, 7], + "to": [9, 22, 9], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [2, 4, 2.5, 9.5], "texture": "#1" }, + "east": { "uv": [2.5, 4, 3, 9.5], "texture": "#1" }, + "south": { "uv": [3, 4, 3.5, 9.5], "texture": "#1" }, + "west": { "uv": [3.5, 5.25, 4, 10.75], "texture": "#1" }, + "up": { "uv": [6, 6, 5.5, 5.5], "texture": "#1" }, + "down": { "uv": [0.5, 5.75, 0, 6.25], "texture": "#1" } + } + }, + { + "from": [1, 14, 4], + "to": [15, 21, 12], + "rotation": { "angle": 0, "axis": "y", "origin": [0, 0, 1] }, + "faces": { + "north": { "uv": [3.5, 0, 7, 1.75], "texture": "#1" }, + "east": { "uv": [3.5, 3.5, 5.5, 5.25], "texture": "#1" }, + "south": { "uv": [3.5, 1.75, 7, 3.5], "texture": "#1" }, + "west": { "uv": [0, 4, 2, 5.75], "texture": "#1" }, + "up": { "uv": [3.5, 2, 0, 0], "texture": "#1" }, + "down": { "uv": [3.5, 2, 0, 4], "texture": "#1" } + } + }, + { + "from": [6.5, -0.75, 6.5], + "to": [9.5, 1.25, 9.5], + "rotation": { "angle": 0, "axis": "y", "origin": [7, -0.75, 7] }, + "faces": { + "north": { "uv": [5.5, 3.5, 6.25, 4], "texture": "#1" }, + "east": { "uv": [5.5, 4, 6.25, 4.5], "texture": "#1" }, + "south": { "uv": [5.5, 4.5, 6.25, 5], "texture": "#1" }, + "west": { "uv": [5.5, 5, 6.25, 5.5], "texture": "#1" }, + "up": { "uv": [4.75, 6, 4, 5.25], "texture": "#1" }, + "down": { "uv": [5.5, 5.25, 4.75, 6], "texture": "#1" } + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "thirdperson_lefthand": { + "rotation": [0, -90, 0], + "translation": [0, 1.25, 1.5], + "scale": [0.85, 0.85, 0.85] + }, + "firstperson_righthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "firstperson_lefthand": { + "rotation": [180, -85.5, 180], + "translation": [0, 1, 0], + "scale": [0.49, 0.49, 0.49] + }, + "ground": { + "rotation": [0, 45, -180], + "translation": [0, 8.5, 0], + "scale": [0.69, 0.69, 0.69] + }, + "gui": { + "rotation": [1.5, 0, 41.25], + "translation": [2.75, -3, 0], + "scale": [0.69, 0.69, 0.69] + }, + "head": { + "rotation": [-78.21, -88.14, 15.57], + "translation": [0.75, 13.75, 8.5] + }, + "fixed": { + "rotation": [180, 0, -142.5], + "translation": [-2.5, -3, 0], + "scale": [0.8, 0.8, 0.8] + } + } +} diff --git a/omc_items/textures/items/hammers/diamond_hammer.png b/omc_items/textures/items/hammers/diamond_hammer.png new file mode 100644 index 0000000..086d3b8 Binary files /dev/null and b/omc_items/textures/items/hammers/diamond_hammer.png differ diff --git a/omc_items/textures/items/hammers/iron_hammer.png b/omc_items/textures/items/hammers/iron_hammer.png new file mode 100644 index 0000000..eaaf659 Binary files /dev/null and b/omc_items/textures/items/hammers/iron_hammer.png differ diff --git a/omc_items/textures/items/hammers/netherite_hammer.png b/omc_items/textures/items/hammers/netherite_hammer.png new file mode 100644 index 0000000..a8f0a49 Binary files /dev/null and b/omc_items/textures/items/hammers/netherite_hammer.png differ diff --git a/omc_items/textures/wands/builder_wand.png b/omc_items/textures/wands/builder_wand.png new file mode 100644 index 0000000..0216675 Binary files /dev/null and b/omc_items/textures/wands/builder_wand.png differ diff --git a/omc_items/textures/wands/builder_wand_item.png b/omc_items/textures/wands/builder_wand_item.png new file mode 100644 index 0000000..c72e0e8 Binary files /dev/null and b/omc_items/textures/wands/builder_wand_item.png differ