Skip to content

Commit

Permalink
Merged 1.10.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz authored Nov 6, 2023
2 parents 9270eb6 + 719fc70 commit e9d0fb6
Show file tree
Hide file tree
Showing 135 changed files with 3,085 additions and 2,848 deletions.
34 changes: 14 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.iml
*.ipr
*.iws
*.iml
.idea

# gradle
build
.gradle

# other
eclipse
run
.gradle/
.classpath/
.project/
.idea/
.metadata/
.vscode/
.settings/

# Files from Forge MDK
forge*changelog.txt
bin/
build/
classes/
out/
output/
runs/
29 changes: 10 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
![Mod logo](https://github.com/Majrusz/MinecraftCommon/blob/main/Enchantments/logo.png?raw=true)

## What is Majrusz's Enchantments? [![](http://cf.way2muchnoise.eu/full_wonderful-enchantments_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/wonderful-enchantments)
**Majrusz's Enchantments** is a Minecraft Forge modification which adds to the game plenty new and unique enchantments.
**Majrusz's Enchantments** is a Minecraft modification which adds to the game plenty new and unique enchantments.

## Where is Majrusz's Enchantments officially available?
- [Curse Forge](https://www.curseforge.com/minecraft/mc-mods/wonderful-enchantments)
- [Planet Minecraft](https://www.planetminecraft.com/mod/wonderful-enchantments/)
- [Modrinth](https://modrinth.com/mod/majruszs-enchantments)

## Current Mod Releases (Source Code)
- [v1.8.2 for Minecraft 1.20](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/1.20.X)
- [v1.8.2 for Minecraft 1.19.3](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/1.19.X) *(not supported anymore)*
- [v1.6.3 for Minecraft 1.18.2](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/1.18.X) *(not supported anymore)*
- [v1.5.2 for Minecraft 1.17.1](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/1.17.1) *(not supported anymore)*
- [v1.3.5 for Minecraft 1.16.5](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/1.16.4) *(not supported anymore)*
- [v0.8.1 for Minecraft 1.15.2](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/old-main/WonderfulEnchantments1-15-2) *(not supported anymore)*
- [v0.6.0 for Minecraft 1.12.2](https://github.com/Majrusz/MajruszsEnchantmentsMod/tree/old-main/WonderfulEnchantments1-12-2) *(not supported anymore)*
## Supported platforms
- [Forge](https://files.minecraftforge.net/net/minecraftforge/forge/)
- [NeoForge](https://neoforged.net) _(since 6.0.0)_
- [Fabric](https://fabricmc.net) _(since 6.0.0)_
- [Quilt](https://quiltmc.org) _(since 6.0.0)_

## Dependencies
- [Majrusz Library](https://github.com/Majrusz/MajruszLibrary/tree/1.20.X)

## Technologies
- Java 8
- [Minecraft Forge API](https://github.com/MinecraftForge/MinecraftForge)

![Languages](https://github.com/Majrusz/MinecraftCommon/blob/main/Enchantments/languages.png?raw=true)
## Where is Majrusz's Enchantments officially available?
- [Modrinth](https://modrinth.com/mod/majruszs-enchantments)
- [Curse Forge](https://www.curseforge.com/minecraft/mc-mods/wonderful-enchantments)
- [Planet Minecraft](https://www.planetminecraft.com/mod/wonderful-enchantments/)
149 changes: 5 additions & 144 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,145 +1,6 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/maven' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'

version = versions_mod
group = 'com.majruszsenchantments'
archivesBaseName = "majruszs-enchantments-${versions_minecraft}"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava {
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
}

minecraft {
mappings channel: 'official', version: versions_minecraft

accessTransformer = file( 'src/main/resources/META-INF/accesstransformer.cfg' ) // Currently, this location cannot be changed from the default.

runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=mixins.majruszsenchantments.json"

mods {
majruszsenchantments {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=mixins.majruszsenchantments.json"

mods {
majruszsenchantments {
source sourceSets.main
}
}
}

gameTestServer {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=mixins.majruszsenchantments.json"

mods {
majruszsenchantments {
source sourceSets.main
}
}
}

data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=mixins.majruszsenchantments.json"

args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
majruszsenchantments {
source sourceSets.main
}
}
}
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

mixin {
add sourceSets.main, 'mixins.majruszsenchantments.refmap.json'
}

repositories {
flatDir {
dir 'libs'
}
}

processResources {
filesMatching('META-INF/mods.toml') {
expand project.properties
}
outputs.upToDateWhen { false }
}

dependencies {
minecraft "net.minecraftforge:forge:${versions_minecraft}-${versions_forge}"
implementation fg.deobf( "com.mlib:majrusz-library-${versions_minecraft}:${versions_mlib}" )
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "examplemod",
"Specification-Vendor" : "examplemodsareus",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "mixins.majruszsenchantments.json",
])
}
}

jar.finalizedBy('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT' apply false
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply false
id 'net.darkhax.curseforgegradle' version '1.1.15' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
}
16 changes: 16 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- changed required Majrusz Library version from 5.0.0+ to 6.1.0+
- added new Dodge particles
- added new Telekinesis particles
- added new Smelter particles
- added 1 second invisibility after successful dodge
- added x0.5 attack speed penalty per level of Fishing Fanatic
- removed Extreme Fishing advancement
- removed Curse of Vampirism
- made Immortality give the same effects as Totem of Undying instead of 10 hearts
- fixed game crash with Hunter enchantment (reported by @ximemt01)
- fixed bug with Dodge enchantment not granting immunity frames after successful dodge
- fixed bug with Enlightenment giving 25% experience bonus per enchantment level instead of 12.5%
- fixed bug with Harvester replant ability working without the enchantment on a hoe
- fixed bug with Hunter and Telekinesis not working properly when used on bows held in the second hand
- fixed bug with Magic Protection not applying damage reduction properly
- fixed bug with Sixth Sense being obtainable even though it was disabled in the configuration file
32 changes: 32 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish'
}

base {
archivesName = "${mod_archives_name}-common-${minecraft_version}-${mod_version}"
}

minecraft {
version(minecraft_version)
}

repositories {
mavenCentral()
flatDir { dirs 'libs' }
}

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

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = 17
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.majruszsenchantments;

import com.majruszsenchantments.config.Config;
import com.majruszsenchantments.curses.*;
import com.majruszsenchantments.enchantments.*;
import com.majruszsenchantments.particles.DodgeParticle;
import com.majruszsenchantments.particles.SmelterParticle;
import com.majruszsenchantments.particles.TelekinesisParticle;
import com.majruszsenchantments.particles.TelekinesisParticleType;
import com.mlib.annotation.Dist;
import com.mlib.annotation.OnlyIn;
import com.mlib.contexts.OnParticlesRegistered;
import com.mlib.item.CustomEnchantment;
import com.mlib.item.ItemHelper;
import com.mlib.modhelper.ModHelper;
import com.mlib.registry.RegistryGroup;
import com.mlib.registry.RegistryObject;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.*;
import net.minecraft.world.item.enchantment.Enchantment;

import java.util.function.Predicate;

public class MajruszsEnchantments {
public static final String MOD_ID = "majruszsenchantments";
public static final ModHelper HELPER = ModHelper.create( MOD_ID );

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

// Registry Groups
public static final RegistryGroup< Enchantment > ENCHANTMENTS = HELPER.create( BuiltInRegistries.ENCHANTMENT );
public static final RegistryGroup< ParticleType< ? > > PARTICLES = HELPER.create( BuiltInRegistries.PARTICLE_TYPE );

// Enchantments
public static final RegistryObject< CustomEnchantment > DEATH_WISH = ENCHANTMENTS.create( "death_wish", DeathWishEnchantment::create );
public static final RegistryObject< CustomEnchantment > DODGE = ENCHANTMENTS.create( "dodge", DodgeEnchantment::create );
public static final RegistryObject< CustomEnchantment > ENLIGHTENMENT = ENCHANTMENTS.create( "enlightenment", EnlightenmentEnchantment::create );
public static final RegistryObject< CustomEnchantment > FISHING_FANATIC = ENCHANTMENTS.create( "fishing_fanatic", FishingFanaticEnchantment::create );
public static final RegistryObject< CustomEnchantment > FUSE_CUTTER = ENCHANTMENTS.create( "fuse_cutter", FuseCutterEnchantment::create );
public static final RegistryObject< CustomEnchantment > GOLD_FUELLED = ENCHANTMENTS.create( "gold_fuelled", GoldFuelledEnchantment::create );
public static final RegistryObject< CustomEnchantment > HARVESTER = ENCHANTMENTS.create( "harvester", HarvesterEnchantment::create );
public static final RegistryObject< CustomEnchantment > HORSE_FROST_WALKER = ENCHANTMENTS.create( "horse_frost_walker", HorseFrostWalkerEnchantment::create );
public static final RegistryObject< CustomEnchantment > HORSE_PROTECTION = ENCHANTMENTS.create( "horse_protection", HorseProtectionEnchantment::create );
public static final RegistryObject< CustomEnchantment > HORSE_SWIFTNESS = ENCHANTMENTS.create( "horse_swiftness", HorseSwiftnessEnchantment::create );
public static final RegistryObject< CustomEnchantment > HUNTER = ENCHANTMENTS.create( "hunter", HunterEnchantment::create );
public static final RegistryObject< CustomEnchantment > IMMORTALITY = ENCHANTMENTS.create( "immortality", ImmortalityEnchantment::create );
public static final RegistryObject< CustomEnchantment > LEECH = ENCHANTMENTS.create( "leech", LeechEnchantment::create );
public static final RegistryObject< CustomEnchantment > MAGIC_PROTECTION = ENCHANTMENTS.create( "magic_protection", MagicProtectionEnchantment::create );
public static final RegistryObject< CustomEnchantment > MISANTHROPY = ENCHANTMENTS.create( "misanthropy", MisanthropyEnchantment::create );
public static final RegistryObject< CustomEnchantment > REPULSION = ENCHANTMENTS.create( "repulsion", RepulsionEnchantment::create );
public static final RegistryObject< CustomEnchantment > SIXTH_SENSE = ENCHANTMENTS.create( "sixth_sense", SixthSenseEnchantment::create );
public static final RegistryObject< CustomEnchantment > SMELTER = ENCHANTMENTS.create( "smelter", SmelterEnchantment::create );
public static final RegistryObject< CustomEnchantment > TELEKINESIS = ENCHANTMENTS.create( "telekinesis", TelekinesisEnchantment::create );

// Curses
public static final RegistryObject< CustomEnchantment > BREAKING = ENCHANTMENTS.create( "breaking_curse", BreakingCurse::create );
public static final RegistryObject< CustomEnchantment > CORROSION = ENCHANTMENTS.create( "corrosion_curse", CorrosionCurse::create );
public static final RegistryObject< CustomEnchantment > FATIGUE = ENCHANTMENTS.create( "fatigue_curse", FatigueCurse::create );
public static final RegistryObject< CustomEnchantment > INCOMPATIBILITY = ENCHANTMENTS.create( "incompatibility_curse", IncompatibilityCurse::create );
public static final RegistryObject< CustomEnchantment > SLIPPERY = ENCHANTMENTS.create( "slippery_curse", SlipperyCurse::create );

// Enchantment Categories
public static final Predicate< ItemStack > IS_BOW_OR_CROSSBOW = itemStack->ItemHelper.isRangedWeapon( itemStack.getItem() );
public static final Predicate< ItemStack > IS_GOLDEN = itemStack->ItemHelper.isGoldenToolOrArmor( itemStack.getItem() );
public static final Predicate< ItemStack > IS_HORSE_ARMOR = itemStack->itemStack.getItem() instanceof HorseArmorItem;
public static final Predicate< ItemStack > IS_HOE = itemStack->itemStack.getItem() instanceof HoeItem;
public static final Predicate< ItemStack > IS_MELEE_MINECRAFT = itemStack->itemStack.getItem() instanceof SwordItem || itemStack.getItem() instanceof AxeItem; // for some reason all minecraft sword enchantments are applicable to axes
public static final Predicate< ItemStack > IS_MELEE = itemStack->ItemHelper.isMeleeWeapon( itemStack.getItem() );
public static final Predicate< ItemStack > IS_SHIELD = itemStack->ItemHelper.isShield( itemStack.getItem() );
public static final Predicate< ItemStack > IS_TOOL = itemStack->ItemHelper.isAnyTool( itemStack.getItem() );

// Particles
public static final RegistryObject< SimpleParticleType > DODGE_PARTICLE = PARTICLES.create( "dodge", ()->new SimpleParticleType( true ) {} );
public static final RegistryObject< SimpleParticleType > SMELTER_PARTICLE = PARTICLES.create( "smelter", ()->new SimpleParticleType( true ) {} );
public static final RegistryObject< TelekinesisParticleType > TELEKINESIS_PARTICLE = PARTICLES.create( "telekinesis", TelekinesisParticleType::new );

private MajruszsEnchantments() {}

@OnlyIn( Dist.CLIENT )
public static class Client {
static {
OnParticlesRegistered.listen( data->data.register( DODGE_PARTICLE.get(), DodgeParticle.Factory::new ) );
OnParticlesRegistered.listen( data->data.register( SMELTER_PARTICLE.get(), SmelterParticle.Factory::new ) );
OnParticlesRegistered.listen( data->data.register( TELEKINESIS_PARTICLE.get(), TelekinesisParticle.Factory::new ) );
}
}
}
26 changes: 26 additions & 0 deletions common/src/main/java/com/majruszsenchantments/common/Handler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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;

public class Handler {
protected final RegistryObject< ? extends CustomEnchantment > enchantment;
protected final Serializable< ? > config;
protected boolean isEnabled = true;

public < Type extends CustomEnchantment > Handler( RegistryObject< Type > enchantment, boolean isCurse ) {
this.enchantment = enchantment;
this.config = new Serializable<>();
this.config.defineBoolean( "is_enabled", 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 );
}
}
Loading

0 comments on commit e9d0fb6

Please sign in to comment.