-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always drop an ender dragon egg at the end of the fight.
- Loading branch information
1 parent
b3ffbe3
commit 4549a4b
Showing
6 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/net/gnomecraft/skysthelimit/mixin/MixinEnderDragonFight.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters