-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
396 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
- changed required Majrusz Library version from 6.1.0+ to 6.1.7+ | ||
- fixed game crash `java.lang.NullPointerException: Registry Object not present` (reported by @Maddogkyler, @Note, @'RQ) | ||
- fixed Korean translation not working properly | ||
- fixed bug when right-clicking a hoe with Harvester enchantment not working properly on a server | ||
- changed required Majrusz Library version from 6.1.7+ to 7.0.0+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 13 additions & 12 deletions
25
common/src/main/java/com/majruszsenchantments/common/Handler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
package com.majruszsenchantments.common; | ||
|
||
import com.majruszsenchantments.config.Config; | ||
import com.mlib.data.Serializable; | ||
import com.mlib.data.Serializables; | ||
import com.mlib.item.CustomEnchantment; | ||
import com.mlib.registry.RegistryObject; | ||
import com.majruszlibrary.data.Reader; | ||
import com.majruszlibrary.data.SerializableObject; | ||
import com.majruszlibrary.data.Serializables; | ||
import com.majruszlibrary.item.CustomEnchantment; | ||
import com.majruszlibrary.registry.RegistryObject; | ||
import com.majruszsenchantments.data.Config; | ||
|
||
public class Handler { | ||
protected final RegistryObject< ? extends CustomEnchantment > enchantment; | ||
protected final Serializable< ? > config; | ||
protected final SerializableObject< ? > config; | ||
protected boolean isEnabled = true; | ||
|
||
public < Type extends CustomEnchantment > Handler( RegistryObject< Type > enchantment, boolean isCurse ) { | ||
public < Type extends CustomEnchantment > Handler( RegistryObject< Type > enchantment, Class< ? extends Handler > clazz, boolean isCurse ) { | ||
this.enchantment = enchantment; | ||
this.config = new Serializable<>(); | ||
this.config.defineBoolean( "is_enabled", s->this.isEnabled, ( s, v )->{ | ||
this.config = Serializables.getStatic( clazz ); | ||
this.config.define( "is_enabled", Reader.bool(), s->this.isEnabled, ( s, v )->{ | ||
this.isEnabled = v; | ||
this.enchantment.ifPresent( y->y.setEnabled( this.isEnabled ) ); | ||
} ); | ||
|
||
Class< ? > clazz = isCurse ? Config.Curses.class : Config.Enchantments.class; | ||
Serializables.get( clazz ) | ||
.defineCustom( enchantment.getId(), ()->this.config ); | ||
Class< ? > parent = isCurse ? Config.Curses.class : Config.Enchantments.class; | ||
Serializables.getStatic( parent ) | ||
.define( enchantment.getId(), clazz ); | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
common/src/main/java/com/majruszsenchantments/config/Config.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
common/src/main/java/com/majruszsenchantments/data/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.majruszsenchantments.data; | ||
|
||
import com.majruszlibrary.data.Serializables; | ||
|
||
public class Config { | ||
static { | ||
Serializables.getStatic( Config.class ) | ||
.define( "enchantments", Enchantments.class ) | ||
.define( "curses", Curses.class ); | ||
|
||
Serializables.getStatic( Enchantments.class ); | ||
|
||
Serializables.getStatic( Curses.class ); | ||
} | ||
|
||
public static class Enchantments {} | ||
|
||
public static class Curses {} | ||
} |
Oops, something went wrong.