mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-10-26 20:35:30 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b93718cce2 | ||
|
|
b3998f8937 | ||
|
|
7f530a1e87 | ||
|
|
e62bff7c73 | ||
|
|
9050004dae | ||
|
|
3f76e0a431 | ||
|
|
0f20ce8520 |
@@ -10,13 +10,13 @@ jobs:
|
||||
build-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
uses: actions/setup-java@v6
|
||||
with:
|
||||
java-version: 21
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- name: Set short commit hash
|
||||
run: fullCommit=${{ github.sha }} && echo "SHORT_SHA=${fullCommit:0:8}" >> $GITHUB_ENV
|
||||
|
||||
@@ -16,9 +16,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
- name: Build Astro page
|
||||
uses: withastro/action@v4
|
||||
uses: withastro/action@v6
|
||||
with:
|
||||
path: ./docs
|
||||
node-version: '24'
|
||||
@@ -31,4 +31,4 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
uses: actions/deploy-pages@v5
|
||||
|
||||
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
sidebar: [
|
||||
{
|
||||
label: 'Documentation',
|
||||
autogenerate: { directory: 'documentation' },
|
||||
items: [{ autogenerate: { "directory": "documentation" } }]
|
||||
},
|
||||
{
|
||||
label: 'Configuration',
|
||||
|
||||
Generated
+2313
-3542
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -10,8 +10,7 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.34.3",
|
||||
"astro": "^5.6.1",
|
||||
"sharp": "^0.32.5"
|
||||
"@astrojs/starlight": "^0.42.4",
|
||||
"astro": "^7.2.10"
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,41 @@ description: How to specify common input types in configuration
|
||||
---
|
||||
|
||||
## Tags
|
||||
There are 2 types of tags that can be used in the configuration:
|
||||
- `minecraft:item_name` - For specific items, use namespaced vanilla item id. If namespace is not provided, `minecraft` is assumed.
|
||||
- `#minecraft:item_tag_name` - For <a href="https://minecraft.wiki/w/Item_tag_(Java_Edition)" target="_blank">item tags</a>,
|
||||
use namespaced tag id. If namespace is not provided, `minecraft` is assumed. Custom tags from other plugins and
|
||||
datapacks are also supported.
|
||||
|
||||
### Items
|
||||
|
||||
#### Item reference
|
||||
Example: `minecraft:stick`
|
||||
|
||||
For specific items, use namespaced vanilla item id. If namespace is not provided, `minecraft` is assumed.
|
||||
|
||||
#### Item tag
|
||||
Example: `#minecraft:axes`
|
||||
|
||||
For <a href="https://minecraft.wiki/w/Item_tag_(Java_Edition)" target="_blank">item tags</a>, use namespaced tag id. If
|
||||
namespace is not provided, `minecraft` is assumed. Custom tags from other plugins and datapacks are also supported.
|
||||
|
||||
### Blocks
|
||||
|
||||
#### Block reference
|
||||
Example: `minecraft:dirt`
|
||||
|
||||
For specific items, use namespaced vanilla item id. If namespace is not provided, `minecraft` is assumed.
|
||||
|
||||
#### Block tag
|
||||
Example: `#minecraft:planks`
|
||||
|
||||
For <a href="https://minecraft.wiki/w/Block_tag_(Java_Edition)" target="_blank">block tags</a>, use namespaced tag id. If
|
||||
namespace is not provided, `minecraft` is assumed. Custom tags from other plugins and datapacks are also supported.
|
||||
|
||||
|
||||
### Enchantments
|
||||
|
||||
#### Enchantment tag
|
||||
Example: `#minecraft:in_enchanting_table`
|
||||
|
||||
For <a href="https://minecraft.wiki/w/Enchantment_tag_(Java_Edition)" target="_blank">enchantment tags</a>, use namespaced tag id. If
|
||||
namespace is not provided, `minecraft` is assumed. Custom tags from other plugins and datapacks are also supported.
|
||||
|
||||
## Slot types
|
||||
- `ANY` - Any slot.
|
||||
|
||||
@@ -18,8 +18,8 @@ Cost that will be added to the item when adding the enchantment to it in anvil.
|
||||
|
||||
- **Type**: `int`
|
||||
|
||||
Weight of the enchantment. Used if `canGetFromEnchantingTable` is set to true. Higher numbers mean it will come up more
|
||||
frequently in the enchanting table.
|
||||
Weight of the enchantment. Higher numbers mean it will come up more frequently in the enchanting table. Used if
|
||||
`#minecraft:in_enchanting_table` is present in enchantment tags.
|
||||
|
||||
### minimumCost
|
||||
|
||||
@@ -29,7 +29,7 @@ Minimum cost that will be required for the enchantment to show up in the enchant
|
||||
|
||||
- **Type**: `int`
|
||||
|
||||
Base cost of the enchant.
|
||||
Base cost of the enchantment.
|
||||
|
||||
#### perLevel
|
||||
|
||||
@@ -45,7 +45,7 @@ Maximum cost that will be required for the enchantment to show up in the enchant
|
||||
|
||||
- **Type**: `int`
|
||||
|
||||
Base cost of the enchant.
|
||||
Base cost of the enchantment.
|
||||
|
||||
#### perLevel
|
||||
|
||||
@@ -55,23 +55,22 @@ Cost to add per level of the enchantment.
|
||||
|
||||
### enchantmentTags
|
||||
|
||||
- **Type**: `key[]`
|
||||
- **Type**: [`Enchantment Tags`](/configuration/input-types/#enchantment-tag)
|
||||
|
||||
This is list of [tags](/configuration/input-types#tags) that the enchantment will be tagged with. This can be used to put the enchantment in enchanting table,
|
||||
mark it as a curse, etc. <a href="https://minecraft.wiki/w/Enchantment_tag_(Java_Edition)" target="_blank">All vanilla</a>
|
||||
and custom tags are supported.
|
||||
This is list of tags that the enchantment will be tagged with. This can be used to put the enchantment in enchanting table,
|
||||
mark it as a curse, etc.
|
||||
|
||||
### supportedItemTags
|
||||
|
||||
- **Type**: `key[]`
|
||||
- **Type**: [`Item Tags`](/configuration/input-types/#items)
|
||||
|
||||
[Items and/or item tags](/configuration/input-types#tags) that the enchantment can be applied to.
|
||||
Items and/or item tags that the enchantment can be applied to.
|
||||
|
||||
### activeSlots
|
||||
|
||||
- **Type**: `string[]`
|
||||
- **Type**: [`Slot types`](/configuration/input-types/#slot-types)
|
||||
|
||||
[Slots](/configuration/input-types#slot-types) that the enchantment will be active in.
|
||||
Inventory slots that the enchantment will be active in.
|
||||
|
||||
|
||||
### enabled
|
||||
@@ -96,9 +95,11 @@ of the enchantment does not support multiple levels.
|
||||
|
||||
## Telepathy
|
||||
|
||||
### onlyUserCanPickupItems
|
||||
|
||||
- **Type**: `boolean`
|
||||
|
||||
If set to true, items teleported by the enchant will only be able to be picked up by the player that broke the block.
|
||||
If set to true, items teleported by the enchantment will only be able to be picked up by the player that broke the block.
|
||||
|
||||
## Executioner
|
||||
|
||||
|
||||
@@ -149,7 +149,9 @@ public class TunnellingEnchant implements EnchantioEnchant {
|
||||
"#minecraft:glazed_terracotta",
|
||||
"#minecraft:concrete",
|
||||
"#minecraft:stone_bricks",
|
||||
"minecraft:end_stone"
|
||||
"minecraft:end_stone",
|
||||
"minecraft:cobblestone",
|
||||
"minecraft:cobbled_deepslate"
|
||||
)
|
||||
))
|
||||
),
|
||||
|
||||
@@ -3,7 +3,6 @@ package me.youhavetrouble.enchantio.listeners;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.keys.tags.BlockTypeTagKeys;
|
||||
import me.youhavetrouble.enchantio.Enchantio;
|
||||
import me.youhavetrouble.enchantio.EnchantioConfig;
|
||||
import me.youhavetrouble.enchantio.enchants.EnchantioEnchant;
|
||||
import me.youhavetrouble.enchantio.enchants.TunnellingEnchant;
|
||||
@@ -22,9 +21,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
@@ -41,7 +38,7 @@ public class TunnellingListener implements Listener {
|
||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
|
||||
Player player = event.getPlayer();
|
||||
if (player.isSneaking() || GameMode.CREATIVE.equals(player.getGameMode())) return;
|
||||
if (GameMode.CREATIVE.equals(player.getGameMode())) return;
|
||||
ItemStack item = event.getItem();
|
||||
if (item == null) return;
|
||||
if (!item.containsEnchantment(tunnelling)) return;
|
||||
@@ -74,31 +71,29 @@ public class TunnellingListener implements Listener {
|
||||
Set<Block> blocksToBreak = getSquare(block, blockFace, tunnellingEnchant.getBlocksPerLevel() * enchantLevel);
|
||||
blockBreakSkips.addAll(blocksToBreak);
|
||||
for (Block b : blocksToBreak) {
|
||||
if (player.getInventory().getItemInMainHand().isEmpty()) {
|
||||
event.setCancelled(true);
|
||||
blockBreakSkips.removeAll(blocksToBreak);
|
||||
break;
|
||||
}
|
||||
event.getPlayer().breakBlock(b);
|
||||
blockBreakSkips.remove(b);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Set<Block> getSquare(Block block, BlockFace face, int range) {
|
||||
Set<Block> blocks = new HashSet<>();
|
||||
switch (face) {
|
||||
case DOWN:
|
||||
case UP:
|
||||
blocks.addAll(getBlocksToTunnel(block.getLocation(), range, 0, range));
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
blocks.addAll(getBlocksToTunnel(block.getLocation(), 0, range, range));
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
blocks.addAll(getBlocksToTunnel(block.getLocation(), range, range, 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DOWN, UP -> {
|
||||
return getBlocksToTunnel(block.getLocation(), range, 0, range);
|
||||
}
|
||||
return blocks;
|
||||
case EAST, WEST -> {
|
||||
return getBlocksToTunnel(block.getLocation(), 0, range, range);
|
||||
}
|
||||
case NORTH, SOUTH -> {
|
||||
return getBlocksToTunnel(block.getLocation(), range, range, 0);
|
||||
}
|
||||
}
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,8 +101,8 @@ public class TunnellingListener implements Listener {
|
||||
* @param base location at the centre of selection
|
||||
* @return All blocks that will get broken
|
||||
*/
|
||||
private List<Block> getBlocksToTunnel(Location base, int changeX, int changeY, int changeZ) {
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
private Set<Block> getBlocksToTunnel(Location base, int changeX, int changeY, int changeZ) {
|
||||
Set<Block> blocks = new HashSet<>();
|
||||
for (int x = (base.getBlockX() - changeX); x <= (base.getBlockX() + changeX); x++) {
|
||||
for (int y = (base.getBlockY() - changeY); y <= (base.getBlockY() + changeY); y++) {
|
||||
for (int z = (base.getBlockZ() - changeZ); z <= (base.getBlockZ() + changeZ); z++) {
|
||||
|
||||
Reference in New Issue
Block a user