Skip to content

Commit

Permalink
Merged 1.2.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Aug 17, 2023
1 parent 34b3c50 commit 5e27917
Show file tree
Hide file tree
Showing 49 changed files with 172 additions and 142 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ versions_minecraft=1.18.2
versions_minecraft_range=[1.18.2,1.19)
versions_forge=40.2.0
versions_forge_range=[40.2.0,)
versions_mod=1.2.2
versions_mlib=4.3.0
versions_mlib_range=[4.3.0,5.0.0)
versions_difficulty=1.7.6
versions_difficulty_range=[1.7.6,)
versions_mod=1.2.3
versions_mlib=5.0.0
versions_mlib_range=[5.0.0,6.0.0)
versions_difficulty=1.8.0
versions_difficulty_range=[1.8.0,)
versions_curios=1.18.2-5.0.7.1
versions_curios_range=[1.18.2-5.0.7.1,)
versions_curios_range=[1.18.2-5.0.7.1,)
Binary file removed libs/majrusz-library-1.18.2-4.3.0.jar
Binary file not shown.
Binary file added libs/majrusz-library-1.18.2-5.0.0.jar
Binary file not shown.
Binary file removed libs/majruszs-difficulty-1.18.2-1.7.6.jar
Binary file not shown.
Binary file added libs/majruszs-difficulty-1.18.2-1.8.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package com.majruszsaccessories;

import com.mlib.config.ConfigHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;

@Mod( MajruszsAccessories.MOD_ID )
public class MajruszsAccessories {
public static final String MOD_ID = "majruszsaccessories";
public static final String NAME = "Majrusz's Accessories";
public static final ConfigHandler SERVER_CONFIG = new ConfigHandler( ModConfig.Type.SERVER );

public MajruszsAccessories() {
Integration.initialize();
Expand Down
25 changes: 9 additions & 16 deletions src/main/java/com/majruszsaccessories/Registries.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import com.majruszsaccessories.recipes.AccessoryRecipe;
import com.majruszsaccessories.recipes.BoostAccessoriesRecipe;
import com.majruszsaccessories.recipes.CombineAccessoriesRecipe;
import com.mlib.annotations.AnnotationHandler;
import com.mlib.items.CreativeModeTabHelper;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.registries.RegistryHelper;
import net.minecraft.client.renderer.texture.TextureAtlas;
import com.mlib.triggers.BasicTrigger;
import com.mlib.config.ConfigHandler;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.modhelper.ModHelper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.item.CreativeModeTab;
Expand All @@ -23,7 +22,7 @@
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
Expand All @@ -32,10 +31,11 @@
import top.theillusivec4.curios.api.CuriosApi;
import top.theillusivec4.curios.api.SlotTypeMessage;

import static com.majruszsaccessories.MajruszsAccessories.SERVER_CONFIG;

public class Registries {
private static final RegistryHelper HELPER = new RegistryHelper( MajruszsAccessories.MOD_ID );
public static final ModHelper HELPER = ModHelper.create( MajruszsAccessories.MOD_ID );

// Configs
public static final ConfigHandler SERVER_CONFIG = HELPER.createConfig( ModConfig.Type.SERVER );

static {
ModConfigs.init( SERVER_CONFIG, Groups.DEFAULT );
Expand Down Expand Up @@ -72,21 +72,14 @@ public class Registries {
public static final ResourceLocation ACCESSORY_SLOT_TEXTURE = Registries.getLocation( "item/empty_accessory_slot" );
public static final CreativeModeTab ITEM_GROUP = CreativeModeTabHelper.newTab( "majruszsaccessories.primary", LUCKY_ROCK );
public static final RegistryObject< Item > BOOSTER_OVERLAY = ITEMS.register( "booster_icon", BoosterOverlay::new );
public static final BasicTrigger BASIC_TRIGGER = HELPER.registerBasicTrigger();

static {
new AnnotationHandler( MajruszsAccessories.MOD_ID );
}

public static void initialize() {
FMLJavaModLoadingContext loadingContext = FMLJavaModLoadingContext.get();
final IEventBus modEventBus = loadingContext.getModEventBus();

HELPER.registerAll();
modEventBus.addListener( Registries::onEnqueueIMC );
DistExecutor.unsafeRunWhenOn( Dist.CLIENT, ()->()->modEventBus.addListener( Registries::onTextureStitch ) );

SERVER_CONFIG.register( ModLoadingContext.get() );
HELPER.register();
}

public static ResourceLocation getLocation( String register ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.majruszsaccessories.common.ItemBase;
import com.majruszsaccessories.gamemodifiers.contexts.OnAccessoryTooltip;
import com.majruszsaccessories.gamemodifiers.contexts.OnItemRender;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnTradeSetup;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.OnTradeSetup;
import net.minecraftforge.registries.RegistryObject;

public class AccessoryBase extends ItemBase< AccessoryItem, AccessoryComponent, AccessoryComponent.ISupplier > {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void onCraftedBy( ItemStack itemStack, Level level, Player player ) {
holder.setRandomBonus();
}
if( holder.hasBoosterTag() && player instanceof ServerPlayer serverPlayer ) {
Registries.BASIC_TRIGGER.trigger( serverPlayer, "booster_used" );
Registries.HELPER.triggerAchievement( serverPlayer, "booster_used" );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.majruszsaccessories.accessories.components.MoreChestLoot;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.math.Range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import com.majruszsaccessories.accessories.components.FishingLureBonus;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.contexts.OnItemFished;
import com.mlib.contexts.OnItemFished;
import com.mlib.math.Range;
import net.minecraft.world.entity.npc.VillagerProfession;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.majruszsaccessories.accessories.components.EnhanceTamedAnimal;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.contexts.OnAnimalTame;
import com.mlib.contexts.OnAnimalTame;
import com.mlib.math.Range;
import net.minecraft.world.entity.npc.VillagerProfession;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.majruszsaccessories.accessories.components.SpawnTwins;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.contexts.OnBabySpawn;
import com.mlib.contexts.OnBabySpawn;
import com.mlib.math.Range;
import net.minecraft.world.entity.npc.VillagerProfession;

Expand Down
27 changes: 2 additions & 25 deletions src/main/java/com/majruszsaccessories/accessories/LuckyRock.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.majruszsaccessories.accessories;

import com.majruszsaccessories.Integration;
import com.majruszsaccessories.Registries;
import com.majruszsaccessories.accessories.components.AccessoryComponent;
import com.majruszsaccessories.accessories.components.ExtraStoneLoot;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnLootTableCustomLoad;
import com.mlib.math.Range;
import net.minecraft.world.entity.npc.VillagerProfession;

Expand All @@ -23,7 +20,6 @@ public LuckyRock() {

this.name( "LuckyRock" )
.add( ExtraStoneLoot.create() )
.add( EnderiumShardsCompatibility.create() ) // adds Enderium Shards (from Majrusz's Progressive Difficulty) to loot table
.add( TradeOffer.create( VillagerProfession.MASON, 5 ) )
.add( DropChance.create() );
}
Expand All @@ -36,31 +32,12 @@ public static ISupplier create() {
protected DropChance( Supplier< AccessoryItem > item, ConfigGroup group ) {
super( item );

DoubleConfig chance = new DoubleConfig( 0.0002, Range.CHANCE );
DoubleConfig chance = new DoubleConfig( 0.0005, Range.CHANCE );
chance.name( "drop_chance" ).comment( "Chance for Lucky Rock to drop when mining stone." );

ExtraStoneLoot.OnStoneMined.listen( this::addToGeneratedLoot )
.addCondition( CustomConditions.dropChance( chance, data->data.entity ) )
.insertTo( group );
}
}

static class EnderiumShardsCompatibility extends AccessoryComponent {
public static ISupplier create() {
return EnderiumShardsCompatibility::new;
}

protected EnderiumShardsCompatibility( Supplier< AccessoryItem > item, ConfigGroup group ) {
super( item );

OnLootTableCustomLoad.listen( this::addLoot )
.addCondition( Condition.predicate( data->ExtraStoneLoot.LOOT_THE_END.equals( data.name ) ) )
.addCondition( Condition.predicate( Integration::isProgressiveDifficultyInstalled ) )
.insertTo( group );
}

private void addLoot( OnLootTableCustomLoad.Data data ) {
data.addEntry( 0, com.majruszsdifficulty.Registries.ENDERIUM_SHARD.get(), 1, 0 );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.majruszsaccessories.Registries;
import com.majruszsaccessories.accessories.components.*;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import net.minecraft.world.entity.npc.VillagerProfession;

@AutoInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import com.majruszsaccessories.accessories.components.EnhancedPotions;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.OnLoot;
import com.mlib.math.Range;
import net.minecraft.world.entity.monster.Witch;
import net.minecraft.world.entity.npc.VillagerProfession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import com.majruszsaccessories.accessories.components.DoubleCrops;
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.contexts.OnAccessoryDropChance;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.Priority;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.Priority;
import com.mlib.contexts.OnLoot;
import com.mlib.math.Range;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.level.block.Blocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import com.majruszsaccessories.accessories.components.TradeOffer;
import com.majruszsaccessories.gamemodifiers.CustomConditions;
import com.mlib.Utility;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.blocks.BlockHelper;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.config.StringListConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.gamemodifiers.contexts.OnPlayerInteract;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.OnLoot;
import com.mlib.contexts.OnPlayerInteract;
import com.mlib.math.Range;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.Context;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.Context;
import com.mlib.contexts.OnLoot;
import com.mlib.math.Range;
import net.minecraft.world.entity.LivingEntity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.gamemodifiers.contexts.OnAnimalTame;
import com.mlib.contexts.OnAnimalTame;
import com.mlib.math.Range;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.config.IntegerConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnPotionBrewed;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.OnPotionBrewed;
import com.mlib.math.Range;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.Context;
import com.mlib.gamemodifiers.Priority;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.Context;
import com.mlib.contexts.base.Priority;
import com.mlib.contexts.OnLoot;
import com.mlib.levels.LevelHelper;
import com.mlib.loot.LootHelper;
import com.mlib.math.Range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.mlib.attributes.AttributeHandler;
import com.mlib.config.ConfigGroup;
import com.mlib.config.IntegerConfig;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.contexts.OnPlayerTick;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.OnPlayerTick;
import com.mlib.math.Range;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.majruszsaccessories.tooltip.TooltipHelper;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.contexts.OnFishingTimeSet;
import com.mlib.contexts.OnFishingTimeSet;
import com.mlib.math.Range;

import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.Context;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.Context;
import com.mlib.contexts.OnLoot;
import com.mlib.levels.LevelHelper;
import com.mlib.math.Range;
import com.mlib.text.TextHelper;
Expand Down Expand Up @@ -62,7 +62,7 @@ private void increaseLoot( OnLoot.Data data ) {
boolean hasIncreasedLoot = false;
float sizeMultiplier = this.getFinalSizeMultiplier( ( ServerPlayer )data.entity );
for( ItemStack itemStack : data.generatedLoot ) {
int count = Math.min( Random.roundRandomly( sizeMultiplier * itemStack.getCount() ), itemStack.getMaxStackSize() );
int count = Math.min( Random.round( sizeMultiplier * itemStack.getCount() ), itemStack.getMaxStackSize() );
hasIncreasedLoot = hasIncreasedLoot || count > itemStack.getCount();
itemStack.setCount( count );
}
Expand Down Expand Up @@ -109,7 +109,10 @@ public static Context< OnLoot.Data > listen( Consumer< OnLoot.Data > consumer )
return OnLoot.listen( consumer )
.addCondition( Condition.isServer() )
.addCondition( OnLoot.hasOrigin() )
.addCondition( Condition.predicate( data->BlockHelper.getBlockEntity( data.getLevel(), data.origin ) instanceof RandomizableContainerBlockEntity ) )
.addCondition( Condition.predicate( data->{
return BlockHelper.getBlockEntity( data.getLevel(), data.origin ) instanceof RandomizableContainerBlockEntity
|| data.context.getQueriedLootTableId().toString().contains( "chest" );
} ) )
.addCondition( Condition.predicate( data->data.entity instanceof ServerPlayer ) );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.majruszsaccessories.tooltip.TooltipHelper;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.gamemodifiers.contexts.OnDamaged;
import com.mlib.contexts.OnDamaged;
import com.mlib.math.Range;

import java.util.function.Supplier;
Expand Down
Loading

0 comments on commit 5e27917

Please sign in to comment.