Skip to content

Commit

Permalink
Merged 1.3.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz authored Dec 2, 2023
2 parents 5aa3ad3 + c827c2a commit d58f894
Show file tree
Hide file tree
Showing 96 changed files with 559 additions and 550 deletions.
4 changes: 1 addition & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +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 @Note, @PlayfulPiano)
- fixed exploit with duplicating items and chests (reported by @Ladocterus, @HeavyDeception)
- changed required Majrusz Library version from 6.1.7+ to 7.0.0+
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

dependencies {
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
implementation "com.mlib:majrusz-library-common:${mlib_version}"
implementation "com.majruszlibrary:majrusz-library-common:${majruszlibrary_version}"
}

java {
Expand Down
Binary file removed common/libs/majrusz-library-common-1.20.1-6.1.7.jar
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package com.majruszsaccessories;

import com.majruszlibrary.annotation.Dist;
import com.majruszlibrary.annotation.OnlyIn;
import com.majruszlibrary.emitter.ParticleEmitter;
import com.majruszlibrary.events.OnGameInitialized;
import com.majruszlibrary.math.Random;
import com.majruszlibrary.modhelper.ModHelper;
import com.majruszlibrary.network.NetworkObject;
import com.majruszlibrary.platform.Services;
import com.majruszlibrary.registry.Custom;
import com.majruszlibrary.registry.RegistryGroup;
import com.majruszlibrary.registry.RegistryObject;
import com.majruszsaccessories.accessories.components.MoreChestLoot;
import com.majruszsaccessories.config.Config;
import com.majruszsaccessories.integration.ISlotPlatform;
Expand All @@ -12,17 +23,6 @@
import com.majruszsaccessories.recipes.AccessoryRecipe;
import com.majruszsaccessories.recipes.BoostAccessoriesRecipe;
import com.majruszsaccessories.recipes.CombineAccessoriesRecipe;
import com.mlib.annotation.Dist;
import com.mlib.annotation.OnlyIn;
import com.mlib.contexts.OnGameInitialized;
import com.mlib.emitter.ParticleEmitter;
import com.mlib.math.Random;
import com.mlib.modhelper.ModHelper;
import com.mlib.network.NetworkObject;
import com.mlib.platform.Services;
import com.mlib.registry.Custom;
import com.mlib.registry.RegistryGroup;
import com.mlib.registry.RegistryObject;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -35,7 +35,9 @@ public class MajruszsAccessories {
public static final ModHelper HELPER = ModHelper.create( MOD_ID );

// Configs
public static final Config CONFIG = HELPER.config( Config::new ).autoSync().create();
static {
HELPER.config( Config.class ).autoSync().create();
}

// Registry Groups
public static final RegistryGroup< Item > ITEMS = HELPER.create( BuiltInRegistries.ITEM );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.math.Range;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.MoreChestLoot;
import com.majruszsaccessories.accessories.components.TradeOffer;
Expand All @@ -8,14 +11,11 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.data.Serializable;
import com.mlib.math.Range;

@AutoInstance
public class AdventurerKit extends AccessoryHandler {
public AdventurerKit() {
super( MajruszsAccessories.ADVENTURER_KIT );
super( MajruszsAccessories.ADVENTURER_KIT, AdventurerKit.class );

this.add( MoreChestLoot.create( 1.2f ) )
.add( AnyChestDropChance.create() )
Expand All @@ -35,8 +35,8 @@ protected AnyChestDropChance( BonusHandler< AccessoryItem > handler ) {
MoreChestLoot.OnChestOpened.listen( this::addToGeneratedLoot )
.addCondition( CustomConditions.dropChance( ()->this.chance, data->MoreChestLoot.OnChestOpened.findPlayer( data ).orElse( null ) ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "any_chest_spawn_chance", s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
handler.getConfig()
.define( "any_chest_spawn_chance", Reader.number(), s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.BrushingExtraItem;
import com.majruszsaccessories.accessories.components.MoreChestLoot;
import com.majruszsaccessories.accessories.components.SwimmingSpeedBonus;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.common.AccessoryHandler;
import com.mlib.annotation.AutoInstance;

@AutoInstance
public class AdventurerRune extends AccessoryHandler {
public AdventurerRune() {
super( MajruszsAccessories.ADVENTURER_RUNE );
super( MajruszsAccessories.ADVENTURER_RUNE, AdventurerRune.class );

this.add( MoreChestLoot.create( 1.5f ) )
.add( BrushingExtraItem.create( 0.2f ) )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.events.OnLootGenerated;
import com.majruszlibrary.events.base.Condition;
import com.majruszlibrary.math.Range;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.BrushingExtraItem;
import com.majruszsaccessories.accessories.components.TradeOffer;
Expand All @@ -8,11 +13,6 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.contexts.OnLootGenerated;
import com.mlib.contexts.base.Condition;
import com.mlib.data.Serializable;
import com.mlib.math.Range;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
Expand All @@ -22,7 +22,7 @@
@AutoInstance
public class AncientScarab extends AccessoryHandler {
public AncientScarab() {
super( MajruszsAccessories.ANCIENT_SCARAB );
super( MajruszsAccessories.ANCIENT_SCARAB, AncientScarab.class );

this.add( BrushingExtraItem.create( 0.16f ) )
.add( SuspiciousBlocksDropChance.create() )
Expand Down Expand Up @@ -54,9 +54,9 @@ protected SuspiciousBlocksDropChance( BonusHandler< AccessoryItem > handler ) {
.addCondition( data->this.locations.contains( data.lootId ) )
.addCondition( data->data.origin != null );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "suspicious_block_spawn_chance", s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
config.defineLocationList( "suspicious_block_ids", s->this.locations, ( s, v )->this.locations = v );
handler.getConfig()
.define( "suspicious_block_spawn_chance", Reader.number(), s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) )
.define( "suspicious_block_ids", Reader.list( Reader.location() ), s->this.locations, ( s, v )->this.locations = v );
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.FishingExtraItems;
import com.majruszsaccessories.accessories.components.FishingLuckBonus;
import com.majruszsaccessories.accessories.components.FishingLureBonus;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.common.AccessoryHandler;
import com.mlib.annotation.AutoInstance;

@AutoInstance
public class AnglerRune extends AccessoryHandler {
public AnglerRune() {
super( MajruszsAccessories.ANGLER_RUNE );
super( MajruszsAccessories.ANGLER_RUNE, AnglerRune.class );

this.add( FishingLuckBonus.create( 3 ) )
.add( FishingLureBonus.create( 0.25f ) )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.events.OnItemFished;
import com.majruszlibrary.events.OnLootGenerated;
import com.majruszlibrary.math.Range;
import com.majruszlibrary.registry.Registries;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.FishingLuckBonus;
import com.majruszsaccessories.accessories.components.TradeOffer;
Expand All @@ -8,12 +14,6 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.contexts.OnItemFished;
import com.mlib.contexts.OnLootGenerated;
import com.mlib.data.Serializable;
import com.mlib.math.Range;
import com.mlib.registry.Registries;
import net.minecraft.resources.ResourceLocation;

import java.util.List;
Expand All @@ -22,7 +22,7 @@
@AutoInstance
public class AnglerTrophy extends AccessoryHandler {
public AnglerTrophy() {
super( MajruszsAccessories.ANGLER_TROPHY );
super( MajruszsAccessories.ANGLER_TROPHY, AnglerTrophy.class );

this.add( FishingLuckBonus.create( 3 ) )
.add( FishingDropChance.create( 0.01f ) )
Expand All @@ -44,8 +44,8 @@ protected FishingDropChance( BonusHandler< AccessoryItem > handler, float chance
OnItemFished.listen( this::onFished )
.addCondition( CustomConditions.dropChance( s->this.fishingChance, data->data.player ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "fishing_drop_chance", s->this.fishingChance, ( s, v )->this.fishingChance = Range.CHANCE.clamp( v ) );
handler.getConfig()
.define( "fishing_drop_chance", Reader.number(), s->this.fishingChance, ( s, v )->this.fishingChance = Range.CHANCE.clamp( v ) );
}

private void onFished( OnItemFished data ) {
Expand Down Expand Up @@ -73,12 +73,12 @@ protected FishDropChance( BonusHandler< AccessoryItem > handler, float chance )

OnLootGenerated.listen( this::addToGeneratedLoot )
.addCondition( data->data.entity != null )
.addCondition( data->this.lootIds.contains( Registries.get( data.entity.getType() ) ) )
.addCondition( data->this.lootIds.contains( Registries.ENTITY_TYPES.getId( data.entity.getType() ) ) )
.addCondition( CustomConditions.dropChance( s->this.fishChance, data->data.killer ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "fish_drop_chance", s->this.fishChance, ( s, v )->this.fishChance = Range.CHANCE.clamp( v ) );
config.defineLocationList( "fish_ids", s->this.lootIds, ( s, v )->this.lootIds = v );
handler.getConfig()
.define( "fish_drop_chance", Reader.number(), s->this.fishChance, ( s, v )->this.fishChance = Range.CHANCE.clamp( v ) )
.define( "fish_ids", Reader.list( Reader.location() ), s->this.lootIds, ( s, v )->this.lootIds = v );
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.events.OnAnimalTamed;
import com.majruszlibrary.math.Range;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.TamingStrongerAnimals;
import com.majruszsaccessories.accessories.components.TradeOffer;
Expand All @@ -8,15 +12,11 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.contexts.OnAnimalTamed;
import com.mlib.data.Serializable;
import com.mlib.math.Range;

@AutoInstance
public class CertificateOfTaming extends AccessoryHandler {
public CertificateOfTaming() {
super( MajruszsAccessories.CERTIFICATE_OF_TAMING );
super( MajruszsAccessories.CERTIFICATE_OF_TAMING, CertificateOfTaming.class );

this.add( TamingStrongerAnimals.create( 0.2f ) )
.add( TamingDropChance.create() )
Expand All @@ -36,8 +36,8 @@ protected TamingDropChance( BonusHandler< AccessoryItem > handler ) {
OnAnimalTamed.listen( this::spawnCertificate )
.addCondition( CustomConditions.dropChance( s->this.chance, data->data.tamer ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "taming_drop_chance", s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
handler.getConfig()
.define( "taming_drop_chance", Reader.number(), s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
}

private void spawnCertificate( OnAnimalTamed data ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.events.OnItemTraded;
import com.majruszlibrary.math.AnyPos;
import com.majruszlibrary.math.Range;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.accessories.components.TradingDiscount;
Expand All @@ -8,16 +13,11 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.contexts.OnItemTraded;
import com.mlib.data.Serializable;
import com.mlib.math.AnyPos;
import com.mlib.math.Range;

@AutoInstance
public class DiscountVoucher extends AccessoryHandler {
public DiscountVoucher() {
super( MajruszsAccessories.DISCOUNT_VOUCHER );
super( MajruszsAccessories.DISCOUNT_VOUCHER, DiscountVoucher.class );

this.add( TradingDiscount.create( 0.12f ) )
.add( TradingDropChance.create() )
Expand All @@ -37,8 +37,8 @@ protected TradingDropChance( BonusHandler< AccessoryItem > handler ) {
OnItemTraded.listen( this::spawnAccessory )
.addCondition( CustomConditions.dropChance( s->this.chance, data->data.player ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "trading_drop_chance", s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
handler.getConfig()
.define( "trading_drop_chance", Reader.number(), s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
}

private void spawnAccessory( OnItemTraded data ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszlibrary.data.Reader;
import com.majruszlibrary.events.OnPlayerWakedUp;
import com.majruszlibrary.events.base.Condition;
import com.majruszlibrary.math.Range;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.SleepingBonuses;
import com.majruszsaccessories.accessories.components.TradeOffer;
Expand All @@ -8,16 +13,11 @@
import com.majruszsaccessories.common.BonusHandler;
import com.majruszsaccessories.contexts.base.CustomConditions;
import com.majruszsaccessories.items.AccessoryItem;
import com.mlib.annotation.AutoInstance;
import com.mlib.contexts.OnPlayerWakedUp;
import com.mlib.contexts.base.Condition;
import com.mlib.data.Serializable;
import com.mlib.math.Range;

@AutoInstance
public class DreamCatcher extends AccessoryHandler {
public DreamCatcher() {
super( MajruszsAccessories.DREAM_CATCHER );
super( MajruszsAccessories.DREAM_CATCHER, DreamCatcher.class );

this.add( SleepingBonuses.create( 1, 300 ) )
.add( SleepingDropChance.create() )
Expand All @@ -39,8 +39,8 @@ protected SleepingDropChance( BonusHandler< AccessoryItem > handler ) {
.addCondition( data->!data.wasSleepStoppedManually )
.addCondition( CustomConditions.dropChance( s->this.chance, data->data.player ) );

Serializable< ? > config = handler.getConfig();
config.defineFloat( "sleeping_drop_chance", s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
handler.getConfig()
.define( "sleeping_drop_chance", Reader.number(), s->this.chance, ( s, v )->this.chance = Range.CHANCE.clamp( v ) );
}

private void spawnAccessory( OnPlayerWakedUp data ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.majruszsaccessories.accessories;

import com.majruszlibrary.annotation.AutoInstance;
import com.majruszsaccessories.MajruszsAccessories;
import com.majruszsaccessories.accessories.components.SleepingBonuses;
import com.majruszsaccessories.accessories.components.StrongerPotions;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.accessories.components.TradingDiscount;
import com.majruszsaccessories.common.AccessoryHandler;
import com.mlib.annotation.AutoInstance;

@AutoInstance
public class HouseholdRune extends AccessoryHandler {
public HouseholdRune() {
super( MajruszsAccessories.HOUSEHOLD_RUNE );
super( MajruszsAccessories.HOUSEHOLD_RUNE, HouseholdRune.class );

this.add( TradingDiscount.create( 0.15f ) )
.add( SleepingBonuses.create( 1, 360 ) )
Expand Down
Loading

0 comments on commit d58f894

Please sign in to comment.