|
1 |
| -//package com.mrbysco.telepastries.compat.top; |
2 |
| -// |
3 |
| -//import com.mrbysco.telepastries.Reference; |
4 |
| -//import com.mrbysco.telepastries.blocks.cake.BlockCakeBase; |
5 |
| -//import mcjty.theoneprobe.api.ElementAlignment; |
6 |
| -//import mcjty.theoneprobe.api.IProbeHitData; |
7 |
| -//import mcjty.theoneprobe.api.IProbeInfo; |
8 |
| -//import mcjty.theoneprobe.api.IProbeInfoProvider; |
9 |
| -//import mcjty.theoneprobe.api.ITheOneProbe; |
10 |
| -//import mcjty.theoneprobe.api.ProbeMode; |
11 |
| -//import net.minecraft.ChatFormatting; |
12 |
| -//import net.minecraft.network.chat.Component; |
13 |
| -//import net.minecraft.resources.ResourceLocation; |
14 |
| -//import net.minecraft.world.entity.player.Player; |
15 |
| -//import net.minecraft.world.item.ItemStack; |
16 |
| -//import net.minecraft.world.level.Level; |
17 |
| -//import net.minecraft.world.level.block.Block; |
18 |
| -//import net.minecraft.world.level.block.state.BlockState; |
19 |
| -//import net.neoforged.fml.InterModComms; |
20 |
| -// |
21 |
| -//import java.util.function.Function; |
22 |
| -// |
23 |
| -//public class TeleTOPCompat { |
24 |
| -// public static void register() { |
25 |
| -// InterModComms.sendTo("theoneprobe", "getTheOneProbe", GetTheOneProbe::new); |
26 |
| -// } |
27 |
| -// |
28 |
| -// public static final class GetTheOneProbe implements Function<ITheOneProbe, Void> { |
29 |
| -// @Override |
30 |
| -// public Void apply(ITheOneProbe input) { |
31 |
| -// input.registerProvider(new PastryInfo()); |
32 |
| -// return null; |
33 |
| -// } |
34 |
| -// } |
35 |
| -// |
36 |
| -// public static final class PastryInfo implements IProbeInfoProvider { |
37 |
| -// |
38 |
| -// @Override |
39 |
| -// public ResourceLocation getID() { |
40 |
| -// return new ResourceLocation(Reference.MOD_ID, "main"); |
41 |
| -// } |
42 |
| -// |
43 |
| -// @Override |
44 |
| -// public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, IProbeHitData data) { |
45 |
| -// final Block block = world.getBlockState(data.getPos()).getBlock(); |
46 |
| -// if (block instanceof BlockCakeBase) { |
47 |
| -// probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) |
48 |
| -// .item(new ItemStack(block)) |
49 |
| -// .text(Component.literal("Bites: ").withStyle(ChatFormatting.GREEN)) |
50 |
| -// .progress(6 - blockState.getValue(BlockCakeBase.BITES), 6); |
51 |
| -// } |
52 |
| -// } |
53 |
| -// } |
54 |
| -//} |
| 1 | +package com.mrbysco.telepastries.compat.top; |
| 2 | + |
| 3 | +import com.mrbysco.telepastries.Reference; |
| 4 | +import com.mrbysco.telepastries.blocks.cake.BlockCakeBase; |
| 5 | +import mcjty.theoneprobe.api.ElementAlignment; |
| 6 | +import mcjty.theoneprobe.api.IProbeHitData; |
| 7 | +import mcjty.theoneprobe.api.IProbeInfo; |
| 8 | +import mcjty.theoneprobe.api.IProbeInfoProvider; |
| 9 | +import mcjty.theoneprobe.api.ITheOneProbe; |
| 10 | +import mcjty.theoneprobe.api.ProbeMode; |
| 11 | +import net.minecraft.ChatFormatting; |
| 12 | +import net.minecraft.network.chat.Component; |
| 13 | +import net.minecraft.resources.ResourceLocation; |
| 14 | +import net.minecraft.world.entity.player.Player; |
| 15 | +import net.minecraft.world.item.ItemStack; |
| 16 | +import net.minecraft.world.level.Level; |
| 17 | +import net.minecraft.world.level.block.Block; |
| 18 | +import net.minecraft.world.level.block.state.BlockState; |
| 19 | +import net.neoforged.fml.InterModComms; |
| 20 | + |
| 21 | +import java.util.function.Function; |
| 22 | + |
| 23 | +public class TeleTOPCompat { |
| 24 | + public static void register() { |
| 25 | + InterModComms.sendTo("theoneprobe", "getTheOneProbe", GetTheOneProbe::new); |
| 26 | + } |
| 27 | + |
| 28 | + public static final class GetTheOneProbe implements Function<ITheOneProbe, Void> { |
| 29 | + @Override |
| 30 | + public Void apply(ITheOneProbe input) { |
| 31 | + input.registerProvider(new PastryInfo()); |
| 32 | + return null; |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + public static final class PastryInfo implements IProbeInfoProvider { |
| 37 | + |
| 38 | + @Override |
| 39 | + public ResourceLocation getID() { |
| 40 | + return new ResourceLocation(Reference.MOD_ID, "main"); |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, IProbeHitData data) { |
| 45 | + final Block block = world.getBlockState(data.getPos()).getBlock(); |
| 46 | + if (block instanceof BlockCakeBase) { |
| 47 | + probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) |
| 48 | + .item(new ItemStack(block)) |
| 49 | + .text(Component.literal("Bites: ").withStyle(ChatFormatting.GREEN)) |
| 50 | + .progress(6 - blockState.getValue(BlockCakeBase.BITES), 6); |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | +} |
0 commit comments