Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config support for generating tower #38

Open
wants to merge 2 commits into
base: 1.20
Choose a base branch
from

Conversation

joelra
Copy link

@joelra joelra commented May 31, 2024

Overview

The purpose of this PR is to address issue #18. A config option is added that will allow a user to determine if the tower over the end podium is generated on subsequent dragon kills.

Changes

A config option labeled regenerateTowerOnDragonDeath was added to determine if the tower structure placement should take place after a dragon kill. This config option was added for both Forge and Fabric, as well as within the common ConfigModule.java

Within EndDragonFightMixin.java, the method signature for betterendisland$spawnPortal was updated to include a third boolean parameter. This value determines if the tower placement takes place.

There are three instances where this value is passed in as true, regardless of the configuration value:

  • On the scan for the initial state and the exit portal has not been generated.
  • On a respawn, but the exit portal has not been generated.
  • On the initial spawn of the dragon.

The main changes take place within the betterendisland$spawnPortal method. Namely the logic follows the flow of:

  • If the dragon has not been killed previously, regardless of config option, place the tower as expected.
    • Placement of the tower in this scenario is done because the initial tower placement does not contain the open bottom. Keeping this flow allows the destroyed tower with the open bottom to be present.
  • If the dragon has been killed previously, and the config value is false, ensure that the variable for tracking if the portal isActive is true. Additionally, utilization of hasActiveExitPortal combined with isActive will ensure that we're not re-creating the exit portal if it already exists.
  • If isActive is true and hasActiveExitPortal is false we "activate" the exit portal by placing end portal blocks following the structure construction of the exit portal, though focused on placing only the end portals. A coordinate array is used to determine where end portals should be placed relative to the portal position block (though three below to ensure they are placed in the exit portal ring).

Testing

Testing was done using the debug functionality within IntelliJ for both Forge and Fabric. The scenarios tested included ensuring initial tower was placed on first spawn, broken blocks were not replaced on subsequent dragon kills with config value set to false, and experience was consistent as before with config value set to true.

@joelra
Copy link
Author

joelra commented May 31, 2024

Hi @yungnickyoung, thoroughly enjoy your mods. I created this PR as a way to support a config option to determine if the tower structure is regenerated on each dragon death. Prohibiting the regeneration of the structure allows for semi and fully automated processes to kill the dragon.

Please let me know what feedback you have!

@joelra
Copy link
Author

joelra commented Jun 6, 2024

Hi @yungnickyoung, any thoughts on this PR?

Copy link
Member

@yungnickyoung yungnickyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for this, this looks really promising.

Out of curiosity, have you tested this when applied to a world previously using an older version of Better End Island? If we merge this change, a lot of users will be updating their existing worlds to use the new version, so I'd want to make sure it doesn't cause any problems.

On a similar note, I was also wondering if you've done any compat testing with other End- or dragon-related mods, or if you just have any thoughts on the matter in general. I'd love to hear your insight.

level.explode(null, this.portalLocation.getX(), this.portalLocation.getY(), this.portalLocation.getZ(), 6.0F, Level.ExplosionInteraction.NONE);
this.spawnNewGateway();
if (!this.previouslyKilled || BetterEndIslandCommon.moreDragonEggs || BetterEndIslandCommon.CONFIG.resummonedDragonDropsEgg) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come the check for BetterEndIslandCommon.CONFIG.resummonedDragonDropsEgg was removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was an inadverent change. Will add back.

@joelra
Copy link
Author

joelra commented Jun 8, 2024

Hey! Thanks for this, this looks really promising.

Out of curiosity, have you tested this when applied to a world previously using an older version of Better End Island? If we merge this change, a lot of users will be updating their existing worlds to use the new version, so I'd want to make sure it doesn't cause any problems.

On a similar note, I was also wondering if you've done any compat testing with other End- or dragon-related mods, or if you just have any thoughts on the matter in general. I'd love to hear your insight.

Thanks for the response! I had not tested an old version and how that would react to this update. Will go through several scenarios for that.

I'm not as familiar with existing end mods. Are there several that you would recommend me to ensure compatibility with? Otherwise, I can try to do a Curseforge search later this evening.

I imagine if they are modifying the dragon fight event this mod would already have some compatibility issues depending on the changes. Structural changes, as long as they're not modifying the end podium placement after the first initial placement should be fine. If they modify the structure of the podium (i.e. instead of being a circle, it becomes a triangle) there would also be incompatibility due to the static placement of the end portals. If a mod is doing that however, I'd expect them to have logic to remove placed podiums since they'd be overriding Minecrafts native placement.

I believe Slient Gear does flower placement after the dragon is killed, which I'll test with. I wouldn't anticipate that to impact this, unless they are attempting to place flowers where the tower structure is being placed and the regenerate config is true. Those would be replaced, but that would happen today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants