[全流程完成]

This commit is contained in:
1820982382
2026-08-19 00:17:24 +08:00
parent 2e9f1fd4e3
commit fc72ebca78
16 changed files with 593 additions and 12 deletions
@@ -214,5 +214,10 @@ public final class ThaumicEnergistics {
AECapabilities.IN_WORLD_GRID_NODE_HOST,
ModBlockEntities.ARCANE_ASSEMBLER.get(),
(be, context) -> (appeng.api.networking.IInWorldGridNodeHost) be);
// 注魔监视器:连接 AE 网络(network 状态)需要网格节点 capability
event.registerBlockEntity(
AECapabilities.IN_WORLD_GRID_NODE_HOST,
ModBlockEntities.INFUSION_MONITOR.get(),
(be, context) -> (appeng.api.networking.IInWorldGridNodeHost) be);
}
}
@@ -29,6 +29,8 @@ public final class RecipeRegistration {
public static InfusionRecipe ESSENTIA_PROVIDER;
public static InfusionRecipe INFUSION_PROVIDER;
public static InfusionRecipe ARCANE_ASSEMBLER;
/** 韵魔观测器注魔配方。 */
public static InfusionRecipe INFUSION_MONITOR;
// 奥术有序配方
public static ShapedArcaneRecipe STORAGE_COMPONENT_1K;
public static ShapedArcaneRecipe STORAGE_COMPONENT_4K;
@@ -310,6 +312,19 @@ public final class RecipeRegistration {
tc("earth_shard"),
tc("air_shard"),
createFullVisScepter());
// 4. 韵魔观测器
// 中央:原版侦测器;外围:元始护符 + 揭示护目镜 + 世界盐×2。
// 需要灵气:魔力×16、灵气(AURA)×32、感官(SENSES, tag=sensus)×16。
// 不稳定度 3(配方基础,参与"总不稳定 = 基础 + 祭坛对称度",可自由调整:
// 1~2 低风险 / 3~5 中等 / 6~8 高)。
INFUSION_MONITOR = ThaumcraftApi.addInfusionCraftingRecipe("INFUSIONMONITOR", stack(ModBlocks.INFUSION_MONITOR),
3, new AspectList().add(Aspect.MAGIC, 16).add(Aspect.AURA, 32).add(Aspect.SENSES, 16),
new ItemStack(Items.OBSERVER),
tc("primal_charm"),
tc("goggles_revealing"),
tc("salis_mundus"),
tc("salis_mundus"));
}
/**
@@ -75,6 +75,7 @@ public final class ThEThaumcraft {
registerVisInterface();
registerEssentiaBuses();
registerInfusionProvider();
registerInfusionMonitor();
registerEssentiaProvider();
registerEssentiaTerminal();
registerDigisentia();
@@ -259,6 +260,20 @@ public final class ThEThaumcraft {
.registerResearchItem();
}
// ==================== 8. (-7,-2) INFUSIONMONITOR 韵魔观测器====================
// 前置: INFUSIONPROVIDER(注魔供应器);位于其左侧。无需研究比较,直接花费要素解锁。
private static void registerInfusionMonitor() {
new ResearchItem("INFUSIONMONITOR", TAB,
new AspectList().add(Aspect.MAGIC, 4).add(Aspect.AURA, 4).add(Aspect.SENSES, 6),
-7, -2, 1, new ItemStack(ModItems.INFUSION_MONITOR_ITEM.get()))
.setRound().setParents("INFUSIONPROVIDER")
.setPages(
new ResearchPage("tc.research_text.INFUSIONMONITOR.stage.1"),
new ResearchPage(RecipeRegistration.INFUSION_MONITOR),
new ResearchPage("tc.research_text.INFUSIONMONITOR.stage.2"))
.registerResearchItem();
}
// ==================== 8. (-2,-4) ESSENTIAPROVIDER 源质供应器====================
// 前置: ESSENTIABUSES(源质总线)
private static void registerEssentiaProvider() {
@@ -46,10 +46,13 @@ public record EssentiaTerminalFillC2SPacket(int containerId, ResourceLocation as
&& ctx.player().containerMenu instanceof appeng.menu.me.common.MEStorageMenu menu
&& menu instanceof thaumicenergistics.common.container.ThEEssentiaMenuAccess acc) {
var player = menu.getPlayerInventory().player;
// 源质物品:优先包携带的 sourceStack(客户端真实来源);否则回退菜单 carried/主手
var source = !this.sourceStack.isEmpty() ? this.sourceStack
: (!menu.getCarried().isEmpty() ? menu.getCarried()
: player.getMainHandItem());
// ⚠ 必须用玩家真实栈(carried/主手)而非包里的拷贝:装罐会原地消耗空安瓿(shrink)
// 或修改罐子内容(setAspects)。若用 sourceStack(拷贝),消耗/修改不落真实物品——
// 空安瓿不消耗却能凭空得到满安瓿。
// 顺序与客户端一致:优先 carried(拾取),其次主手;sourceStack 仅兜底。
var source = !menu.getCarried().isEmpty() ? menu.getCarried()
: (!player.getMainHandItem().isEmpty() ? player.getMainHandItem()
: this.sourceStack);
thaumicenergistics.common.container.EssentiaFillHelper.fillContainerFromGrid(
acc.thE_getStorage(), acc.thE_getEnergySource(),
menu.getActionSource(), player, source, this.aspectId);
@@ -41,6 +41,10 @@ public final class ModBlockEntities {
REGISTRY.register("essentia_cell_workbench",
() -> BlockEntityType.Builder.of(TileEssentiaCellWorkbench::new, ModBlocks.ESSENTIA_CELL_WORKBENCH.get()).build(null));
public static final Supplier<BlockEntityType<TileInfusionMonitor>> INFUSION_MONITOR =
REGISTRY.register("infusion_monitor",
() -> BlockEntityType.Builder.of(TileInfusionMonitor::new, ModBlocks.INFUSION_MONITOR.get()).build(null));
/**
* 虚拟的 Thaumcraft vis 源,供 vis 接口的提供端使用。
* 不作为真实方块放置;由 {@link thaumicenergistics.common.parts.VisInterfacePart}
@@ -8,12 +8,14 @@ import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredRegister;
import thaumicenergistics.ThaumicEnergistics;
import thaumicenergistics.common.blocks.OrientableEntityBlock;
import thaumicenergistics.common.blocks.ThEBaseEntityBlock;
import thaumicenergistics.common.tiles.*;
import thaumicenergistics.init.ModItems;
import net.minecraft.network.chat.Component;
public final class ModBlocks {
@@ -119,4 +121,180 @@ public final class ModBlocks {
return null;
}
});
// ==================== 注魔监视器(灵气观测器) ====================
/** 是否放入魔导手册。 */
public static final net.minecraft.world.level.block.state.properties.BooleanProperty BOOK =
net.minecraft.world.level.block.state.properties.BooleanProperty.create("book");
/** 是否连接 AE 网络。 */
public static final net.minecraft.world.level.block.state.properties.BooleanProperty NETWORK =
net.minecraft.world.level.block.state.properties.BooleanProperty.create("network");
/**
* 注魔监视器:4 态(off / off+book / off+book+on / off+Jade),blockstate 用 multipart 合并模型。
*/
public static final DeferredBlock<Block> INFUSION_MONITOR = REGISTRY.register("infusion_monitor", () -> new ThEBaseEntityBlock(P) {
@Override
public net.minecraft.world.level.block.entity.BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new TileInfusionMonitor(pos, state);
}
@Override
public <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.world.level.block.entity.BlockEntityTicker<T> getTicker(net.minecraft.world.level.Level level, BlockState state, net.minecraft.world.level.block.entity.BlockEntityType<T> type) {
if (level.isClientSide()) return null;
if (type == ModBlockEntities.INFUSION_MONITOR.get()) {
return (lvl, pos, st, be) -> TileInfusionMonitor.tick(lvl, pos, st, (TileInfusionMonitor) be);
}
return null;
}
@Override
protected void createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<Block, BlockState> builder) {
builder.add(BOOK, NETWORK, FACING);
}
@Override
public BlockState getStateForPlacement(net.minecraft.world.item.context.BlockPlaceContext context) {
// 放置时始终朝向放置者
return this.defaultBlockState()
.setValue(FACING, context.getHorizontalDirection().getOpposite())
.setValue(BOOK, false)
.setValue(NETWORK, false);
}
@Override
protected net.minecraft.world.ItemInteractionResult useItemOn(net.minecraft.world.item.ItemStack stack, BlockState state, net.minecraft.world.level.Level level, BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult hit) {
if (level.getBlockEntity(pos) instanceof TileInfusionMonitor monitor) {
// 手持魔导手册 → 直接放入(返回 SUCCESS 拦截,避免魔导手册自身 use 打开界面)
if (TileInfusionMonitor.isThaumonomicon(stack)) {
if (!level.isClientSide) {
monitor.placeBook(player, stack);
}
return net.minecraft.world.ItemInteractionResult.sidedSuccess(level.isClientSide());
}
// Shift+右键(非手册物品)→ 取回手册
if (player.isShiftKeyDown()) {
if (!level.isClientSide) {
monitor.retrieveBook(player);
}
return net.minecraft.world.ItemInteractionResult.sidedSuccess(level.isClientSide());
}
// 普通右键(非手册/非Shift)→ 聊天框显示风险描述
if (!level.isClientSide) {
monitor.showDescriptionInChat(player);
}
return net.minecraft.world.ItemInteractionResult.sidedSuccess(level.isClientSide());
}
return net.minecraft.world.ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
// 空手右键(1.21 走 useWithoutItem):Shift+空手 → 取回手册;普通空手右键 → 聊天框显示描述
@Override
protected net.minecraft.world.InteractionResult useWithoutItem(BlockState state, net.minecraft.world.level.Level level, BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.phys.BlockHitResult hit) {
if (level.getBlockEntity(pos) instanceof TileInfusionMonitor monitor) {
if (player.isShiftKeyDown()) {
if (!level.isClientSide) {
monitor.retrieveBook(player);
}
return net.minecraft.world.InteractionResult.sidedSuccess(level.isClientSide());
}
if (!level.isClientSide) {
monitor.showDescriptionInChat(player);
}
return net.minecraft.world.InteractionResult.sidedSuccess(level.isClientSide());
}
return net.minecraft.world.InteractionResult.PASS;
}
@Override
public net.minecraft.world.phys.shapes.VoxelShape getShape(BlockState state, net.minecraft.world.level.BlockGetter level, BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) {
// 底座(高 0.25)+ 上部塔架(0.25~0.8)
return net.minecraft.world.phys.shapes.Shapes.or(
net.minecraft.world.phys.shapes.Shapes.box(0.0, 0.0, 0.0, 1.0, 0.25, 1.0),
net.minecraft.world.phys.shapes.Shapes.box(0.15, 0.25, 0.15, 0.85, 0.8, 0.85));
}
});
// ==================== Alkusure86 玩偶(Fumo) ====================
/** 水平朝向(韵魔观测器共用)。 */
public static final net.minecraft.world.level.block.state.properties.DirectionProperty FACING =
net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING;
// 姿态变体:0 = alkusure86fumo(默认坐姿),1 = a999csfumo。
public static final net.minecraft.world.level.block.state.properties.BooleanProperty VARIANT =
net.minecraft.world.level.block.state.properties.BooleanProperty.create("variant");
// 玩偶专用:低硬度 → 空手可快速挖掘(装饰物)。
private static final BlockBehaviour.Properties PD =
BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_PINK).strength(0.2f).sound(SoundType.WOOL);
// Alkusure86 玩偶:纯装饰方块,2 个姿态模型 + 水平朝向。
// 右键切换姿态;Shift+右键拿起方块到手。
public static final DeferredBlock<Block> ALKUSURE86_FUMO = REGISTRY.register("alkusure86fumo", () -> new Block(PD) {
@Override
protected void createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING, VARIANT);
}
@Override
public BlockState getStateForPlacement(net.minecraft.world.item.context.BlockPlaceContext context) {
// 默认坐姿(variant=0),面向放置者
return this.defaultBlockState()
.setValue(FACING, context.getHorizontalDirection().getOpposite())
.setValue(VARIANT, false);
}
@Override
protected net.minecraft.world.ItemInteractionResult useItemOn(net.minecraft.world.item.ItemStack stack, BlockState state, net.minecraft.world.level.Level level, BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult hit) {
if (player.isShiftKeyDown()) {
// Shift+右键:拿起方块到手(或背包)
pickUp(level, pos, player);
return net.minecraft.world.ItemInteractionResult.sidedSuccess(level.isClientSide());
}
// 右键:切换姿态
if (!level.isClientSide) {
level.setBlock(pos, state.setValue(VARIANT, !state.getValue(VARIANT)), 3);
}
return net.minecraft.world.ItemInteractionResult.sidedSuccess(level.isClientSide());
}
// 空手右键(1.21 走 useWithoutItem):Shift+空手拿起;右键切换姿态
@Override
protected net.minecraft.world.InteractionResult useWithoutItem(BlockState state, net.minecraft.world.level.Level level, BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.phys.BlockHitResult hit) {
if (player.isShiftKeyDown()) {
pickUp(level, pos, player);
return net.minecraft.world.InteractionResult.sidedSuccess(level.isClientSide());
}
if (!level.isClientSide) {
level.setBlock(pos, state.setValue(VARIANT, !state.getValue(VARIANT)), 3);
}
return net.minecraft.world.InteractionResult.sidedSuccess(level.isClientSide());
}
// Shift+右键拿起:移除方块,物品进主手(空手时)或背包。
private void pickUp(net.minecraft.world.level.Level level, BlockPos pos, net.minecraft.world.entity.player.Player player) {
if (level.isClientSide) return;
ItemStack item = new ItemStack(ModItems.ALKUSURE86_FUMO_ITEM.get());
if (player.getMainHandItem().isEmpty()) {
player.setItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND, item);
} else if (!player.getInventory().add(item)) {
net.minecraft.world.Containers.dropItemStack(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, item);
}
level.removeBlock(pos, false);
}
@Override
public net.minecraft.world.phys.shapes.VoxelShape getShape(BlockState state, net.minecraft.world.level.BlockGetter level, BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) {
// 玩偶整体占位:坐姿高度约 12 格单位(0.75 格),宽约 8(0.5 格)
return net.minecraft.world.phys.shapes.Shapes.box(0.25, 0.0, 0.25, 0.75, 0.75, 0.75);
}
// 纯 Block 无战利品表 → 必须覆写 getDrops,否则挖掘不掉落
@Override
public java.util.List<ItemStack> getDrops(BlockState state, net.minecraft.world.level.storage.loot.LootParams.Builder builder) {
return java.util.List.of(new ItemStack(ModItems.ALKUSURE86_FUMO_ITEM.get()));
}
});
}
@@ -38,6 +38,9 @@ public final class ModCreativeTab {
output.accept(ModItems.ARCANE_ASSEMBLER_ITEM.get()); output.accept(ModItems.ESSENTIA_VIBRATION_CHAMBER_ITEM.get());
output.accept(ModItems.KNOWLEDGE_INSCRIBER_ITEM.get()); output.accept(ModItems.ESSENTIA_CELL_WORKBENCH_ITEM.get());
output.accept(ModItems.DISTILLATION_ENCODER_ITEM.get());
output.accept(ModItems.INFUSION_MONITOR_ITEM.get());
// 玩偶不进创造物品栏:需 /give @p thaumicenergistics:alkusure86fumo 手动获取
// output.accept(ModItems.ALKUSURE86_FUMO_ITEM.get());
// 源质虚拟物品不再在创造标签页中注册(避免玩家拿到物品栏)
// 它们通过 JEI 插件注册,仅作为 ghost ingredient 可拖拽到 AE 筛选槽
@@ -78,4 +78,6 @@ public final class ModItems {
public static final DeferredItem<BlockItem> KNOWLEDGE_INSCRIBER_ITEM = REGISTRY.registerSimpleBlockItem(ModBlocks.KNOWLEDGE_INSCRIBER);
public static final DeferredItem<BlockItem> ESSENTIA_CELL_WORKBENCH_ITEM = REGISTRY.registerSimpleBlockItem(ModBlocks.ESSENTIA_CELL_WORKBENCH);
public static final DeferredItem<BlockItem> DISTILLATION_ENCODER_ITEM = REGISTRY.registerSimpleBlockItem(ModBlocks.DISTILLATION_ENCODER);
public static final DeferredItem<BlockItem> INFUSION_MONITOR_ITEM = REGISTRY.registerSimpleBlockItem(ModBlocks.INFUSION_MONITOR);
public static final DeferredItem<BlockItem> ALKUSURE86_FUMO_ITEM = REGISTRY.registerSimpleBlockItem(ModBlocks.ALKUSURE86_FUMO);
}
@@ -1,4 +1,4 @@
{
{
"itemGroup.thaumicenergistics": "Thaumic Energistics",
"block.thaumicenergistics.essentia_provider": "Essentia Provider",
"block.thaumicenergistics.infusion_provider": "Infusion Provider",
@@ -102,6 +102,8 @@
"tc.research_name.PSEUDO_SCEPTRE": "Crafting Scepters",
"tc.research_name.PSEUDO_COREGATHER": "Golem Core: Gather",
"gui.thaumicenergistics.ArcaneCraftingTerminal": "Arcane Crafting Terminal",
"thaumicenergistics.jade.current_aspect": "Fuel: %s",
"thaumicenergistics.jade.suction_type": "Suction: %s",
"thaumicenergistics.jade.essentia_stored": "Essentia: %d / %d",
"thaumicenergistics.jade.burning": "Burning %d%%, %.1f AE/tick",
@@ -114,5 +116,18 @@
"thaumicenergistics.gui.distillation_encoder.not_scanned": "Not scanned",
"thaumicenergistics.jei.transfer.missing": "Missing: %d",
"thaumicenergistics.jei.transfer.craftable": "Craftable: %d",
"thaumicenergistics.jei.transfer.ctrl_click": "Use Ctrl to craft missing items"
"thaumicenergistics.jei.transfer.ctrl_click": "Use Ctrl to craft missing items",
"block.thaumicenergistics.infusion_monitor": "Infusion Monitor",
"thaumicenergistics.jade.monitor.title": "Infusion Monitor",
"thaumicenergistics.jade.monitor.no_matrix": "No infusion altar detected",
"thaumicenergistics.jade.monitor.instability": "Instability: %s (base %s + altar %s)",
"thaumicenergistics.jade.monitor.crafting": "Infusion in progress",
"thaumicenergistics.jade.monitor.shortages": "Essentia shortage: %s",
"thaumicenergistics.jade.monitor.essence_ok": "Essentia sufficient",
"block.thaumicenergistics.alkusure86fumo": "Alkusure86 Fumo",
"tc.research_text.INFUSIONMONITOR.stage.1": "To observe is to command. You place the Thaumonomicon beside the altar, an observer peering into each pulse of the infusion — the stirring of aura, the opening of rifts, the first whisper of flux. Bound to an ME network, the observer truly opens its eyes.",
"tc.research_text.INFUSIONMONITOR.stage.2": "The Infusion Monitor takes the Thaumonomicon as its key and the network as its sight. Place the tome and connect to the network, and it shall hover above the void, truthfully telling the risk of the ritual — and on right-click, it whispers its deeper warnings.",
"tc.research_name.INFUSIONMONITOR": "Infusion Monitor",
"tc.research_name.GOLEMWIFIBACKPACK": "Golem WiFi Backpack"
}
@@ -1,4 +1,4 @@
{
{
"itemGroup.thaumicenergistics": "神秘能源",
"block.thaumicenergistics.essentia_provider": "源质供应器",
"block.thaumicenergistics.infusion_provider": "注魔供应器",
@@ -28,7 +28,7 @@
"item.thaumicenergistics.essentia_storage_bus": "源质存储总线",
"item.thaumicenergistics.essentia_terminal": "源质终端",
"item.thaumicenergistics.arcane_crafting_terminal": "奥术合成终端",
"gui.thaumicenergistics.ArcaneCraftingTerminal": "奥术合成终端",
"gui.thaumicenergistics.ArcaneCraftingTerminal": "奥术合成终端",
"item.thaumicenergistics.essentia_level_emitter": "源质发信器",
"item.thaumicenergistics.vis_interface": "要素中继接口",
"tooltip.thaumicenergistics.essentia_import_bus.desc": "从相邻的源质容器抽取源质导入ME网络",
@@ -133,5 +133,17 @@
"thaumicenergistics.gui.distillation_encoder.not_scanned": "未扫描",
"thaumicenergistics.jei.transfer.missing": "缺少: %d",
"thaumicenergistics.jei.transfer.craftable": "可合成: %d",
"thaumicenergistics.jei.transfer.ctrl_click": "按住 Ctrl 合成缺失物品"
"thaumicenergistics.jei.transfer.ctrl_click": "按住 Ctrl 合成缺失物品",
"block.thaumicenergistics.infusion_monitor": "韵魔观测器",
"thaumicenergistics.jade.monitor.title": "韵魔观测器",
"thaumicenergistics.jade.monitor.no_matrix": "未检测到注魔祭坛",
"thaumicenergistics.jade.monitor.instability": "不稳定度: %s (基础 %s + 祭坛 %s)",
"thaumicenergistics.jade.monitor.crafting": "注魔进行中",
"thaumicenergistics.jade.monitor.shortages": "源质缺口: %s",
"thaumicenergistics.jade.monitor.essence_ok": "源质充足",
"block.thaumicenergistics.alkusure86fumo": "Alkusure86 玩偶",
"tc.research_text.INFUSIONMONITOR.stage.1": "观测即是驾驭。你将魔导手册置于祭坛之侧,以侦测器窥探注魔的每一次脉动——灵光、裂隙、咒波的先兆,尽收眼底。当它与 ME 网络相连,观测者便真正睁开眼。",
"tc.research_text.INFUSIONMONITOR.stage.2": "韵魔观测器以魔导手册为钥、以网络为眼。放上手册并接入网络,它便会悬浮于虚空之中,如实告知你注魔之仪的风险——而按住右键,它将低语出更深层的告诫。",
"tc.research_name.INFUSIONMONITOR": "韵魔观测器",
"tc.research_name.GOLEMWIFIBACKPACK": "傀儡WiFi背包"
}
@@ -7,6 +7,8 @@
"thaumicenergistics:essentia_vibration_chamber",
"thaumicenergistics:knowledge_inscriber",
"thaumicenergistics:essentia_cell_workbench",
"thaumicenergistics:distillation_encoder"
"thaumicenergistics:distillation_encoder",
"thaumicenergistics:infusion_monitor",
"thaumicenergistics:alkusure86fumo"
]
}