-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework integration code for ME Requester in preparation for future ad…
…d-on integration
- Loading branch information
Showing
14 changed files
with
78 additions
and
123 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,46 @@ | ||
package gripe._90.fulleng.integration; | ||
|
||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.data.recipes.RecipeOutput; | ||
import net.minecraft.network.chat.Component; | ||
import net.neoforged.fml.ModList; | ||
import net.neoforged.fml.loading.LoadingModList; | ||
import net.neoforged.fml.loading.moddiscovery.ModInfo; | ||
import net.neoforged.neoforge.common.conditions.ModLoadedCondition; | ||
|
||
import gripe._90.fulleng.FullblockEnergistics; | ||
|
||
public enum Addons { | ||
REQUESTER("merequester"); | ||
REQUESTER("merequester", "ME Requester"); | ||
|
||
private final String modId; | ||
private final String modName; | ||
|
||
Addons(String modId) { | ||
Addons(String modId, String modName) { | ||
this.modId = modId; | ||
this.modName = modName; | ||
} | ||
|
||
public String getModId() { | ||
return modId; | ||
} | ||
|
||
public String getModName() { | ||
return modName; | ||
} | ||
|
||
public boolean isLoaded() { | ||
return ModList.get() != null | ||
? ModList.get().isLoaded(getModId()) | ||
: LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(getModId()::equals); | ||
} | ||
|
||
public Component getNotInstalledTooltip() { | ||
return Component.translatable("gui." + FullblockEnergistics.MODID + ".not_installed." + modId) | ||
.withStyle(ChatFormatting.GRAY); | ||
} | ||
|
||
public RecipeOutput conditionalOutput(RecipeOutput output) { | ||
return output.withConditions(new ModLoadedCondition(modId)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/gripe/_90/fulleng/integration/IntegrationBlockItem.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,27 @@ | ||
package gripe._90.fulleng.integration; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.TooltipFlag; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
|
||
import appeng.block.AEBaseBlockItem; | ||
|
||
public class IntegrationBlockItem extends AEBaseBlockItem { | ||
private final Addons addon; | ||
|
||
public IntegrationBlockItem(Block id, Addons addon) { | ||
super(id, new Properties()); | ||
this.addon = addon; | ||
} | ||
|
||
@Override | ||
public void addCheckedInformation(ItemStack stack, Level level, List<Component> lines, TooltipFlag advTooltips) { | ||
if (!addon.isLoaded()) { | ||
lines.add(addon.getNotInstalledTooltip()); | ||
} | ||
} | ||
} |
11 changes: 5 additions & 6 deletions
11
src/main/java/gripe/_90/fulleng/integration/requester/RequesterIntegration.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
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
28 changes: 0 additions & 28 deletions
28
src/main/java/gripe/_90/fulleng/integration/requester/RequesterTerminalBlockItem.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...a/fulleng/advancements/recipes/ae2.main/terminals/block_requester_terminal_from_part.json
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...a/fulleng/advancements/recipes/ae2.main/terminals/part_requester_terminal_from_block.json
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/resources/data/fulleng/recipes/block_requester_terminal_from_part.json
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/resources/data/fulleng/recipes/part_requester_terminal_from_block.json
This file was deleted.
Oops, something went wrong.