generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
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.
- Loading branch information
1 parent
43671a5
commit 8c87672
Showing
6 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/com/portingdeadmods/modjam/compat/jade/CrateComponentProvider.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,35 @@ | ||
package com.portingdeadmods.modjam.compat.jade; | ||
|
||
import com.portingdeadmods.modjam.content.blockentities.CrateBlockEntity; | ||
import com.portingdeadmods.modjam.data.MJDataComponents; | ||
import com.portingdeadmods.modjam.registries.MJItems; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.state.properties.BlockStateProperties; | ||
import snownee.jade.api.BlockAccessor; | ||
import snownee.jade.api.IBlockComponentProvider; | ||
import snownee.jade.api.ITooltip; | ||
import snownee.jade.api.config.IPluginConfig; | ||
import snownee.jade.api.ui.IElementHelper; | ||
|
||
public enum CrateComponentProvider implements IBlockComponentProvider { | ||
INSTANCE; | ||
|
||
|
||
@Override | ||
public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) { | ||
if(blockAccessor.getBlockEntity() instanceof CrateBlockEntity blockEntity) { | ||
if(!blockEntity.components().has(MJDataComponents.OPEN.get())) { | ||
IElementHelper helper = IElementHelper.get(); | ||
iTooltip.append(helper.item(new ItemStack(MJItems.CROWBAR.get()))); | ||
iTooltip.add(Component.literal("Locked")); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public ResourceLocation getUid() { | ||
return ResourceLocation.fromNamespaceAndPath("modjam", "crate"); | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/portingdeadmods/modjam/compat/jade/LaserJunctionComponentProvider.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 com.portingdeadmods.modjam.compat.jade; | ||
|
||
import com.portingdeadmods.modjam.content.blockentities.LaserJunctionBlockEntity; | ||
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.ITooltip; | ||
import snownee.jade.api.config.IPluginConfig; | ||
|
||
public enum LaserJunctionComponentProvider implements IBlockComponentProvider { | ||
INSTANCE; | ||
@Override | ||
public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) { | ||
if (blockAccessor.getBlockEntity() instanceof LaserJunctionBlockEntity blockEntity) { | ||
String inputDirections = blockEntity.getLaserInputsAsString(); | ||
iTooltip.add(Component.literal("Inputs: " + inputDirections)); | ||
String outputDirections = blockEntity.getLaserOutputsAsString(); | ||
iTooltip.add(Component.literal("Outputs: " + outputDirections)); | ||
} | ||
} | ||
|
||
@Override | ||
public ResourceLocation getUid() { | ||
return ResourceLocation.fromNamespaceAndPath("modjam", "laser_junction"); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/portingdeadmods/modjam/mixin/ItemStorageProviderMixin.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,21 @@ | ||
package com.portingdeadmods.modjam.mixin; | ||
|
||
import com.portingdeadmods.modjam.content.blockentities.AquaticCatalystBlockEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import snownee.jade.addon.universal.ItemStorageProvider; | ||
import snownee.jade.api.Accessor; | ||
import snownee.jade.api.ITooltip; | ||
import snownee.jade.api.config.IPluginConfig; | ||
|
||
@Mixin(ItemStorageProvider.class) | ||
public class ItemStorageProviderMixin { | ||
@Inject(method = "append", at = @At("HEAD"), cancellable = true) | ||
private static void onAppend(ITooltip tooltip, Accessor<?> accessor, IPluginConfig config, CallbackInfo ci) { | ||
if (accessor.getTarget() instanceof AquaticCatalystBlockEntity) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
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