diff --git a/README.md b/README.md index 7ed72b4..0a24be4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Sky's the Limit requires [Cloth Config](https://github.com/shedaniel/cloth-confi This mod provides support for the Gnomecraft sky block ecosystem; namely: +* Change game behaviors for multiplayer skyblock. + * Always drop an ender dragon egg at the end of the fight. * Adding glue recipes and loot for mods in Gnomecraft sky block mod packs. * Adds This Rocks! stone splitters as junk loot to fishing. * Recipe for crafting This Rocks! stone splitters into stone buckets. diff --git a/gradle.properties b/gradle.properties index cb07f59..6a0d139 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20 yarn_mappings=1.20+build.1 loader_version=0.14.22 # Mod Properties -mod_version=0.2.5 +mod_version=0.2.6 maven_group=net.gnomecraft archives_base_name=skys-the-limit # Dependencies diff --git a/src/main/java/net/gnomecraft/skysthelimit/config/SkysTheLimitConfig.java b/src/main/java/net/gnomecraft/skysthelimit/config/SkysTheLimitConfig.java index aa38b18..0faf432 100644 --- a/src/main/java/net/gnomecraft/skysthelimit/config/SkysTheLimitConfig.java +++ b/src/main/java/net/gnomecraft/skysthelimit/config/SkysTheLimitConfig.java @@ -15,9 +15,13 @@ @SuppressWarnings("unused") @Config(name = SkysTheLimit.MOD_ID) public class SkysTheLimitConfig implements ConfigData { - @ConfigEntry.Category("blocks") + @ConfigEntry.Category("behavior") @ConfigEntry.Gui.PrefixText //@ConfigEntry.Gui.Tooltip + public Boolean alwaysDragonEgg = true; + + @ConfigEntry.Category("blocks") + @ConfigEntry.Gui.PrefixText public Boolean fogCatcher = true; diff --git a/src/main/java/net/gnomecraft/skysthelimit/mixin/MixinEnderDragonFight.java b/src/main/java/net/gnomecraft/skysthelimit/mixin/MixinEnderDragonFight.java new file mode 100644 index 0000000..a4bbf9b --- /dev/null +++ b/src/main/java/net/gnomecraft/skysthelimit/mixin/MixinEnderDragonFight.java @@ -0,0 +1,39 @@ +package net.gnomecraft.skysthelimit.mixin; + +import net.gnomecraft.skysthelimit.SkysTheLimit; +import net.minecraft.block.Blocks; +import net.minecraft.entity.boss.dragon.EnderDragonEntity; +import net.minecraft.entity.boss.dragon.EnderDragonFight; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.Heightmap; +import net.minecraft.world.gen.feature.EndPortalFeature; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(EnderDragonFight.class) +public class MixinEnderDragonFight { + @Shadow + @Final + private BlockPos origin; + + @Shadow + private boolean previouslyKilled; + + @Shadow + @Final + private ServerWorld world; + + @Inject(method = "dragonKilled", at = @At("HEAD")) + private void skysthelimit$alwaysDragonEgg(EnderDragonEntity dragon, CallbackInfo ci) { + if (SkysTheLimit.getConfig().alwaysDragonEgg && previouslyKilled) { + world.setBlockState( + world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, EndPortalFeature.offsetOrigin(origin)), + Blocks.DRAGON_EGG.getDefaultState()); + } + } +} diff --git a/src/main/resources/assets/skys-the-limit/lang/en_us.json b/src/main/resources/assets/skys-the-limit/lang/en_us.json index d5db18c..07b89b2 100644 --- a/src/main/resources/assets/skys-the-limit/lang/en_us.json +++ b/src/main/resources/assets/skys-the-limit/lang/en_us.json @@ -8,6 +8,10 @@ "modmenu.descriptionTranslation.skys-the-limit": "The Gnomecraft sky block support mod.", "text.autoconfig.skys-the-limit.title": "Skys the Limit: Configuration", + "text.autoconfig.skys-the-limit.category.behavior": "Behavior", + "text.autoconfig.skys-the-limit.option.alwaysDragonEgg.@PrefixText": "You must restart Minecraft after changing settings below.", + "text.autoconfig.skys-the-limit.option.alwaysDragonEgg": "Ender Dragon always drops an egg?", + "text.autoconfig.skys-the-limit.category.blocks": "Blocks", "text.autoconfig.skys-the-limit.option.fogCatcher.@PrefixText": "You must restart Minecraft after changing settings below.", "text.autoconfig.skys-the-limit.option.fogCatcher": "Enable the Fog Catcher block?", diff --git a/src/main/resources/skys-the-limit.mixins.json b/src/main/resources/skys-the-limit.mixins.json index b6eaf2f..22727a2 100644 --- a/src/main/resources/skys-the-limit.mixins.json +++ b/src/main/resources/skys-the-limit.mixins.json @@ -4,6 +4,7 @@ "package": "net.gnomecraft.skysthelimit.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ + "MixinEnderDragonFight", "MixinPointedDripstoneBlock" ], "client": [