Skip to content

Commit

Permalink
Add new configuration requireEnchantment (false by default) allowin…
Browse files Browse the repository at this point in the history
…g to register enchants for specific modes but still allowing non enchanted tools (#582)

* Separate configs for registering & requiring enchantements

* Modify default

* Remove multi line

* chore: bump versions

* chore: tooltips for other languages

* fix: changelog stripper
  • Loading branch information
Rakambda authored Aug 5, 2023
1 parent 187bbf1 commit 1d61487
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 879 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ String getFTChangelog(){
return null;
}
if(changelog.startsWith("\"")){
changelog.substring(1)
changelog = changelog.substring(1)
}
if(changelog.endsWith("\"")){
changelog.substring(0, changelog.length() - 1)
changelog = changelog.substring(0, changelog.length() - 1)
}
return changelog
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public boolean canPlayerBreakTree(@NotNull IPlayer player) {
return false;
}

if (getConfiguration().getEnchantment().isAtLeastOneEnchantRegistered()
if (getConfiguration().getEnchantment().isRequireEnchantment()
&& !heldItemStack.hasOneOfEnchantAtLeast(getChopperEnchantments(), 1)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ public interface IEnchantmentConfiguration{

boolean isRegisterSpecificEnchant();

boolean isHideEnchant();
boolean isRequireEnchantment();

default boolean isAtLeastOneEnchantRegistered(){
return isRegisterEnchant() || isRegisterSpecificEnchant();
}
boolean isHideEnchant();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public class EnchantmentConfiguration implements IEnchantmentConfiguration{
private boolean registerSpecificEnchant = false;
@Expose
private boolean hideEnchant = false;
@Expose
private boolean requireEnchantment = false;
}
225 changes: 39 additions & 186 deletions common/src/main/resources/assets/fallingtree/lang/en_us.json

Large diffs are not rendered by default.

216 changes: 36 additions & 180 deletions common/src/main/resources/assets/fallingtree/lang/ko_kr.json

Large diffs are not rendered by default.

159 changes: 27 additions & 132 deletions common/src/main/resources/assets/fallingtree/lang/pl_pl.json

Large diffs are not rendered by default.

173 changes: 29 additions & 144 deletions common/src/main/resources/assets/fallingtree/lang/ru_ru.json

Large diffs are not rendered by default.

173 changes: 29 additions & 144 deletions common/src/main/resources/assets/fallingtree/lang/uk_ua.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ log4j2-version = "2.20.0"

# Minecraft / Loaders
minecraftVersion = "1.20.1"
fabric-loader-version = "0.14.21"
fabric-api-version = "0.85.0+1.20.1"
forge-version = "1.20.1-47.1.0"
fabric-loader-version = "0.14.22"
fabric-api-version = "0.86.1+1.20.1"
forge-version = "1.20.1-47.1.43"
forgeMappingsVersion = "1.20.1"

# Mod dependencies
Expand Down
9 changes: 7 additions & 2 deletions wiki/Settings---Enchantment.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
|Name |Description

|Register enchant
|If set to true, the chopper enchant will be registered and will be required on tools in order to activate the mod. If set to false it won't be registered, making the mod server-sided.
|If set to true, the chopper enchant will be registered.

NOTE: INFO: If activated mod will be required on clients.
NOTE: Server/Client restart needed.

|Register specific enchant
|If set to true, several chopper enchants will be registered and will be required on tools in order to activate the mod with a specific breaking mode. If set to false it won't be registered, making the mod server-sided.
|If set to true, several chopper enchants will be registered to activate the mod with a specific breaking mode.

NOTE: INFO: If activated mod will be required on clients.
NOTE: Server/Client restart needed.

|Hide enchant
|If set to true the enchant will not be discoverable nor tradeable.

|Require enchant
|If set to true an enchantment on the tool will be required for the mod to be activated.
|===
3 changes: 2 additions & 1 deletion wiki/Settings---Examples.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ NOTE: This is purely an example, values there won't always make sense.
"enchantment": {
"registerEnchant": false,
"registerSpecificEnchant": true,
"hideEnchant": false
"hideEnchant": false,
"requireEnchant": true
}
}
----

0 comments on commit 1d61487

Please sign in to comment.