Skip to content

Commit

Permalink
Merged 1.9.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Aug 17, 2023
1 parent cfcca95 commit de1dac7
Show file tree
Hide file tree
Showing 32 changed files with 362 additions and 294 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ 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.9.0
versions_mlib=4.3.0
versions_mlib_range=[4.3.0,5.0.0)
versions_mod=1.9.1
versions_mlib=5.0.0
versions_mlib_range=[5.0.0,6.0.0)
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.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.majruszsenchantments;

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

/**
Main class for the whole Wonderful Enchantments modification.
Expand All @@ -14,8 +12,6 @@
public class MajruszsEnchantments {
public static final String MOD_ID = "majruszsenchantments";
public static final String NAME = "Majrusz's Enchantments";
public static final ConfigHandler SERVER_CONFIG = new ConfigHandler( ModConfig.Type.SERVER );
public static final ConfigHandler CLIENT_CONFIG = new ConfigHandler( ModConfig.Type.CLIENT );

public MajruszsEnchantments() {
com.majruszsenchantments.Registries.initialize();
Expand Down
30 changes: 10 additions & 20 deletions src/main/java/com/majruszsenchantments/Registries.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import com.majruszsenchantments.curses.*;
import com.majruszsenchantments.enchantments.*;
import com.mlib.annotations.AnnotationHandler;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.config.ConfigHandler;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.items.ItemHelper;
import com.mlib.registries.RegistryHelper;
import com.mlib.triggers.BasicTrigger;
import com.mlib.modhelper.ModHelper;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -15,16 +14,17 @@
import net.minecraft.world.item.enchantment.EnchantmentCategory;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import static com.majruszsenchantments.MajruszsEnchantments.CLIENT_CONFIG;
import static com.majruszsenchantments.MajruszsEnchantments.SERVER_CONFIG;

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

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

static {
ModConfigs.init( SERVER_CONFIG, Groups.ENCHANTMENT ).name( "Enchantments" );
Expand Down Expand Up @@ -77,14 +77,6 @@ public class Registries {
public static final RegistryObject< SimpleParticleType > DODGE_PARTICLE = PARTICLE_TYPES.register( "dodge_particle", ()->new SimpleParticleType( true ) );
public static final RegistryObject< SimpleParticleType > TELEKINESIS_PARTICLE = PARTICLE_TYPES.register( "telekinesis_particle", ()->new SimpleParticleType( true ) );

// Triggers
public static final BasicTrigger BASIC_TRIGGER = HELPER.registerBasicTrigger();

static {
// must stay below all instances because otherwise modifiers can access registry objects too fast
new AnnotationHandler( MajruszsEnchantments.MOD_ID );
}

public static ResourceLocation getLocation( String register ) {
return HELPER.getLocation( register );
}
Expand All @@ -94,14 +86,12 @@ public static String getLocationString( String register ) {
}

public static void initialize() {
HELPER.registerAll();
DistExecutor.unsafeRunWhenOn( Dist.CLIENT, ()->RegistriesClient::initialize );
ItemHelper.addEnchantmentTypesToItemGroup( CreativeModeTab.TAB_COMBAT, SHIELD, BOW_AND_CROSSBOW, MELEE_MINECRAFT, MELEE );
ItemHelper.addEnchantmentTypesToItemGroup( CreativeModeTab.TAB_TOOLS, HOE, GOLDEN, TOOLS );
ItemHelper.addEnchantmentTypeToItemGroup( CreativeModeTab.TAB_MISC, HORSE_ARMOR );

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

public static class Groups {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/majruszsenchantments/RegistriesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ public static void initialize() {
.comment( "Should the Enchanted Book has a different texture when it has any of the new enchantments on it (disabling it may fix some bugs with other mods)?" )
.requiresWorldRestart( true );

MajruszsEnchantments.CLIENT_CONFIG.addConfig( UNIQUE_BOOK_TEXTURE );
Registries.CLIENT_CONFIG.addConfig( UNIQUE_BOOK_TEXTURE );
FMLJavaModLoadingContext.get().getModEventBus().addListener( RegistriesClient::register );
}

private static void register( final FMLClientSetupEvent event ) {
if( UNIQUE_BOOK_TEXTURE.isEnabled() ) {
ItemProperties.register( Items.ENCHANTED_BOOK, new ResourceLocation( "book_type" ), RegistriesClient::enchantmentBookPredicate );
event.enqueueWork( ()->{
ItemProperties.register( Items.ENCHANTED_BOOK, new ResourceLocation( "book_type" ), RegistriesClient::enchantmentBookPredicate );
} );
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/majruszsenchantments/curses/BreakingCurse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.Random;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnItemHurt;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnItemHurt;
import com.mlib.math.Range;
import net.minecraft.world.item.enchantment.DigDurabilityEnchantment;
import net.minecraft.world.item.enchantment.Enchantment;
Expand Down Expand Up @@ -58,7 +58,7 @@ public Handler() {
private void dealExtraDamage( OnItemHurt.Data data ) {
assert data.player != null;
double damageMultiplier = this.enchantment.get().getEnchantmentLevel( data.itemStack ) * this.damageMultiplier.get();
data.extraDamage += Random.roundRandomly( data.damage * damageMultiplier );
data.extraDamage += Random.round( data.damage * damageMultiplier );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnEntityTick;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnEntityTick;
import com.mlib.levels.LevelHelper;
import com.mlib.math.Range;
import net.minecraft.world.damagesource.DamageSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.Random;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.attributes.AttributeHandler;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.*;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.*;
import com.mlib.math.Range;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentCategory;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/majruszsenchantments/curses/SlipperyCurse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnPlayerTick;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnPlayerTick;
import com.mlib.math.Range;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.BooleanConfig;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.config.EffectConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnEntityTick;
import com.mlib.gamemodifiers.contexts.OnPlayerInteract;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnEntityTick;
import com.mlib.contexts.OnPlayerInteract;
import com.mlib.levels.LevelHelper;
import com.mlib.math.AnyPos;
import com.mlib.math.Range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleRangeConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.entities.EntityHelper;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnPreDamaged;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnPreDamaged;
import com.mlib.math.Range;

import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.Random;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.SoundHandler;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnPreDamaged;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnPreDamaged;
import com.mlib.math.Range;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.Random;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnEquipmentChanged;
import com.mlib.gamemodifiers.contexts.OnPickupXp;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnEquipmentChanged;
import com.mlib.contexts.OnPickupXp;
import com.mlib.math.Range;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.enchantment.EnchantmentCategory;
Expand Down Expand Up @@ -57,14 +57,14 @@ public Handler() {

private void increaseExperience( OnPickupXp.Data data ) {
int enlightenmentSum = this.enchantment.get().getEnchantmentSum( data.player, EquipmentSlots.ARMOR );
int experiencePoints = Random.roundRandomly( enlightenmentSum * this.experienceMultiplier.get() * data.event.getOrb().getValue() );
int experiencePoints = Random.round( enlightenmentSum * this.experienceMultiplier.get() * data.event.getOrb().getValue() );
if( experiencePoints > 0 ) {
data.player.giveExperiencePoints( experiencePoints );
}
}

private void giveAdvancement( OnEquipmentChanged.Data data ) {
Registries.BASIC_TRIGGER.trigger( ( ServerPlayer )data.entity, "enlightenment_8" );
Registries.HELPER.triggerAchievement( ( ServerPlayer )data.entity, "enlightenment_8" );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.Random;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleArrayConfig;
import com.mlib.config.DoubleConfig;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.Priority;
import com.mlib.gamemodifiers.contexts.*;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.base.Priority;
import com.mlib.contexts.*;
import com.mlib.items.ItemHelper;
import com.mlib.math.Range;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -173,7 +173,7 @@ private void increaseDamageDealt( OnPreDamaged.Data data ) {

private static void giveAdvancement( ServerPlayer player, String type, Supplier< Boolean > check ) {
if( check.get() ) {
Registries.BASIC_TRIGGER.trigger( player, type );
Registries.HELPER.triggerAchievement( player, type );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import com.majruszsenchantments.Registries;
import com.mlib.EquipmentSlots;
import com.mlib.annotations.AutoInstance;
import com.mlib.modhelper.AutoInstance;
import com.mlib.config.ConfigGroup;
import com.mlib.config.DoubleConfig;
import com.mlib.effects.ParticleHandler;
import com.mlib.effects.SoundHandler;
import com.mlib.enchantments.CustomEnchantment;
import com.mlib.entities.EntityHelper;
import com.mlib.gamemodifiers.Condition;
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.gamemodifiers.contexts.OnExplosionStart;
import com.mlib.contexts.base.Condition;
import com.mlib.contexts.base.ModConfigs;
import com.mlib.contexts.OnEnchantmentAvailabilityCheck;
import com.mlib.contexts.OnExplosionStart;
import com.mlib.items.ItemHelper;
import com.mlib.math.AABBHelper;
import com.mlib.math.Range;
Expand Down
Loading

0 comments on commit de1dac7

Please sign in to comment.