-
Notifications
You must be signed in to change notification settings - Fork 13
feat: jade compat #123
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
Merged
Merged
feat: jade compat #123
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
12 changes: 6 additions & 6 deletions
12
src/generated/resources/data/mia/tags/item/artifact_modifiers_material.json
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| { | ||
| "values": [ | ||
| "minecraft:lapis_lazuli", | ||
| "mia:prasiolite_shard", | ||
| "minecraft:copper_ingot", | ||
| "minecraft:emerald", | ||
| "minecraft:iron_ingot", | ||
| "minecraft:diamond", | ||
| "minecraft:copper_ingot", | ||
| "minecraft:gold_ingot", | ||
| "minecraft:netherite_ingot" | ||
| "mia:prasiolite_shard", | ||
| "minecraft:lapis_lazuli", | ||
| "minecraft:netherite_ingot", | ||
| "minecraft:diamond", | ||
| "minecraft:iron_ingot" | ||
| ] | ||
| } |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/altnoir/mia/compat/jade/AbyssSpawnerComponentProvider.java
This file contains hidden or 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,48 @@ | ||
| package com.altnoir.mia.compat.jade; | ||
|
|
||
| import com.altnoir.mia.common.block.entity.AbyssSpawnerBlockEntity; | ||
| import com.altnoir.mia.util.MiaUtil; | ||
| import net.minecraft.nbt.CompoundTag; | ||
| import net.minecraft.network.chat.Component; | ||
| import net.minecraft.resources.ResourceLocation; | ||
| import snownee.jade.api.BlockAccessor; | ||
| import snownee.jade.api.IBlockComponentProvider; | ||
| import snownee.jade.api.IServerDataProvider; | ||
| import snownee.jade.api.ITooltip; | ||
| import snownee.jade.api.config.IPluginConfig; | ||
|
|
||
| public enum AbyssSpawnerComponentProvider implements | ||
| IBlockComponentProvider, IServerDataProvider<BlockAccessor> { | ||
| INSTANCE; | ||
|
|
||
| private static final String tag = "spawner_cooldown"; | ||
|
|
||
| @Override | ||
| public ResourceLocation getUid() { | ||
| return MiaJadePlugin.SPAWNER_COOLDOWN; | ||
| } | ||
|
|
||
| @Override | ||
| public void appendTooltip(ITooltip tooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) { | ||
| if (!blockAccessor.getServerData().contains(tag)) | ||
| return; | ||
|
|
||
| var cooldown = blockAccessor.getServerData().getInt(tag); | ||
|
|
||
| if (cooldown <= 0) | ||
| return; | ||
|
|
||
| tooltip.add( | ||
| Component.translatable( | ||
| "tooltip.mia.abyss_spawner.cooldown", | ||
| MiaUtil.formatTickToTime(cooldown) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public void appendServerData(CompoundTag compoundTag, BlockAccessor blockAccessor) { | ||
| var spawner = (AbyssSpawnerBlockEntity)blockAccessor.getBlockEntity(); | ||
| compoundTag.putInt(tag, spawner.getAbyssSpawner().getRemainingCooldown()); | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
src/main/java/com/altnoir/mia/compat/jade/MiaJadePlugin.java
This file contains hidden or 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,24 @@ | ||
| package com.altnoir.mia.compat.jade; | ||
|
|
||
| import com.altnoir.mia.common.block.AbyssSpawnerBlock; | ||
| import com.altnoir.mia.common.block.entity.AbyssSpawnerBlockEntity; | ||
| import net.minecraft.resources.ResourceLocation; | ||
| import snownee.jade.api.IWailaClientRegistration; | ||
| import snownee.jade.api.IWailaCommonRegistration; | ||
| import snownee.jade.api.IWailaPlugin; | ||
| import snownee.jade.api.WailaPlugin; | ||
|
|
||
| @WailaPlugin | ||
| public class MiaJadePlugin implements IWailaPlugin { | ||
| public static final ResourceLocation SPAWNER_COOLDOWN = ResourceLocation.parse("mia:spawner_cooldown"); | ||
|
|
||
| @Override | ||
| public void register(IWailaCommonRegistration registration) { | ||
| registration.registerBlockDataProvider(AbyssSpawnerComponentProvider.INSTANCE, AbyssSpawnerBlockEntity.class); | ||
| } | ||
|
|
||
| @Override | ||
| public void registerClient(IWailaClientRegistration registration) { | ||
| registration.registerBlockComponent(AbyssSpawnerComponentProvider.INSTANCE, AbyssSpawnerBlock.class); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.