Skip to content

Commit

Permalink
Always drop an ender dragon egg at the end of the fight.
Browse files Browse the repository at this point in the history
  • Loading branch information
gniftygnome committed May 5, 2024
1 parent b3ffbe3 commit 4549a4b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/skys-the-limit/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/skys-the-limit.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "net.gnomecraft.skysthelimit.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"MixinEnderDragonFight",
"MixinPointedDripstoneBlock"
],
"client": [
Expand Down

0 comments on commit 4549a4b

Please sign in to comment.