装配矩阵上传核心

This commit is contained in:
GaLicn 2025-09-24 12:42:48 +08:00
parent 4de90feae2
commit 47aa90a438
19 changed files with 243 additions and 4 deletions

View File

@ -139,7 +139,7 @@ dependencies {
implementation "curse.maven:curios-309927:6529130"
compileOnly "curse.maven:ex-pattern-provider-892005:6863556"
compileOnly "curse.maven:applied-flux-965012:5614830"
implementation "curse.maven:applied-flux-965012:5614830"
compileOnly "dev.emi:emi-neoforge:1.1.10+1.21"
compileOnly "curse.maven:mega-cells-622112:6005043"
compileOnly "curse.maven:jade-324717:5427817"

View File

@ -0,0 +1,103 @@
# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the FML version. This is currently 2.
loaderVersion="[1,)" #mandatory
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All Rights Reserved"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="extendedae_plus" #mandatory
# The version number of the mod
version="1.21.1-1.4.2" #mandatory
# A display name for the mod
displayName="ExtendedAE-Plus" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
#credits="" #optional
# A text field displayed in the mod UI
authors="YourNameHere, OtherNameHere" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''Example mod description.
Newline characters can be used and will be replaced properly.'''
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
[[mixins]]
config="extendedae_plus.mixins.json"
# The [[accessTransformers]] block allows you to declare where your AT file is.
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
#[[accessTransformers]]
#file="META-INF/accesstransformer.cfg"
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.extendedae_plus]] #optional
# the modid of the dependency
modId="neoforge" #mandatory
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
# 'required' requires the mod to exist, 'optional' does not
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
type="required" #mandatory
# Optional field describing why the dependency is required or why it is incompatible
# reason="..."
# The version range of the dependency
versionRange="[21.1.1,)" #mandatory
# An ordering relationship for the dependency.
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.extendedae_plus]]
modId="minecraft"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.21.1]"
ordering="NONE"
side="BOTH"
# Require ExtendedAE (ExtendedAE-1.21-2.2.21-neoforge) to be present
[[dependencies.extendedae_plus]]
modId="extendedae"
type="required"
# Use a permissive range to tolerate upstream version string variations (e.g. 1.21-2.2.21-neoforge)
versionRange="*"
ordering="AFTER"
side="BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features.extendedae_plus]
#openGLVersion="[3.2,)"

View File

@ -32,7 +32,7 @@ mod_name=ExtendedAE-Plus
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.21.1-1.4.0-fix
mod_version=1.21.1-1.4.2
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -110,8 +110,17 @@ public class ExtendedAEPlus {
b256.setBlockEntity(CraftingBlockEntity.class, type, null, null);
b1024.setBlockEntity(CraftingBlockEntity.class, type, null, null);
LOGGER.info("Bound AE2 CraftingBlockEntity to ExtendedAE Plus accelerators.");
// 绑定装配矩阵上传核心方块实体类型避免 blockEntityClass null 的问题
ModBlocks.ASSEMBLER_MATRIX_UPLOAD_CORE.get().setBlockEntity(
com.extendedae_plus.content.matrix.UploadCoreBlockEntity.class,
ModBlockEntities.UPLOAD_CORE_BE.get(),
null,
null
);
LOGGER.info("Bound UploadCoreBlockEntity to assembler matrix upload core block.");
} catch (Throwable t) {
LOGGER.warn("Failed to bind CraftingBlockEntity to accelerators: {}", t.toString());
LOGGER.warn("Failed to bind block entities: {}", t.toString());
}
});
}

View File

@ -0,0 +1,26 @@
package com.extendedae_plus.content.matrix;
import com.glodblock.github.extendedae.common.blocks.matrix.BlockAssemblerMatrixBase;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.state.BlockBehaviour;
/**
* ExtendedAE_Plus: 装配矩阵上传核心方块内部功能块
* 仅用于作为多方块内部的"功能块"存在是否允许自动上传由工具类检查集群中是否存在该核心决定
*/
public class UploadCoreBlock extends BlockAssemblerMatrixBase<UploadCoreBlockEntity> {
public UploadCoreBlock() {
super();
}
public UploadCoreBlock(BlockBehaviour.Properties props) {
super(props);
}
@Override
public Item getPresentItem() {
// 由对应的 BlockItem 注册返回上传核心不需要特殊的 PresentItem可返回自身的 BlockItem
return com.extendedae_plus.init.ModItems.ASSEMBLER_MATRIX_UPLOAD_CORE.get();
}
}

View File

@ -0,0 +1,24 @@
package com.extendedae_plus.content.matrix;
import com.glodblock.github.extendedae.common.me.matrix.ClusterAssemblerMatrix;
import com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixFunction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
/**
* ExtendedAE_Plus: 装配矩阵上传核心方块实体
* 作为矩阵内部功能块仅用于标记该矩阵允许被自动上传工具类会在集群中查找此实体
*/
public class UploadCoreBlockEntity extends TileAssemblerMatrixFunction {
public UploadCoreBlockEntity(BlockPos pos, BlockState state) {
super((BlockEntityType<?>) com.extendedae_plus.init.ModBlockEntities.UPLOAD_CORE_BE.get(), pos, state);
}
@Override
public void add(ClusterAssemblerMatrix c) {
// 无需修改集群仅作为存在性标记
// 若后续需要限制为"最多一个"可在 ExtendedAE_Plus 工具类或事件中做校验与提示
}
}

View File

@ -3,6 +3,7 @@ package com.extendedae_plus.init;
import com.extendedae_plus.ExtendedAEPlus;
import com.extendedae_plus.content.wireless.WirelessTransceiverBlockEntity;
import com.extendedae_plus.content.controller.NetworkPatternControllerBlockEntity;
import com.extendedae_plus.content.matrix.UploadCoreBlockEntity;
import appeng.blockentity.crafting.CraftingBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.core.registries.Registries;
@ -42,4 +43,10 @@ public final class ModBlockEntities {
ref.set(type);
return type;
});
// 装配矩阵上传核心方块实体
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<UploadCoreBlockEntity>> UPLOAD_CORE_BE =
BLOCK_ENTITY_TYPES.register("upload_core",
() -> BlockEntityType.Builder.of(UploadCoreBlockEntity::new,
ModBlocks.ASSEMBLER_MATRIX_UPLOAD_CORE.get()).build(null));
}

View File

@ -3,6 +3,7 @@ package com.extendedae_plus.init;
import com.extendedae_plus.ExtendedAEPlus;
import com.extendedae_plus.content.wireless.WirelessTransceiverBlock;
import com.extendedae_plus.content.crafting.EPlusCraftingUnitType;
import com.extendedae_plus.content.matrix.UploadCoreBlock;
import appeng.block.crafting.CraftingUnitBlock;
import appeng.blockentity.crafting.CraftingBlockEntity;
import appeng.core.definitions.AEBlockEntities;
@ -73,4 +74,15 @@ public final class ModBlocks {
return new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_1024x);
}
);
// 装配矩阵上传核心方块
public static final DeferredBlock<UploadCoreBlock> ASSEMBLER_MATRIX_UPLOAD_CORE = BLOCKS.register(
"assembler_matrix_upload_core",
() -> new UploadCoreBlock(
BlockBehaviour.Properties.of()
.mapColor(MapColor.METAL)
.strength(1.5F, 6.0F)
.requiresCorrectToolForDrops()
)
);
}

View File

@ -23,6 +23,7 @@ public final class ModCreativeTabs {
output.accept(ModItems.ACCELERATOR_64x.get());
output.accept(ModItems.ACCELERATOR_256x.get());
output.accept(ModItems.ACCELERATOR_1024x.get());
output.accept(ModItems.ASSEMBLER_MATRIX_UPLOAD_CORE.get());
output.accept(ModItems.ENTITY_TICKER_PART_ITEM.get());
// 放入四个预设的 stacksx2,x4,x8,x16使用 ModItems 工厂创建
output.accept(ModItems.createEntitySpeedCardStack((byte) 2));

View File

@ -68,4 +68,10 @@ public final class ModItems {
public static ItemStack createEntitySpeedCardStack(byte multiplier) {
return EntitySpeedCardItem.withMultiplier(multiplier);
}
// 装配矩阵上传核心物品
public static final DeferredItem<Item> ASSEMBLER_MATRIX_UPLOAD_CORE = ITEMS.register(
"assembler_matrix_upload_core",
() -> new BlockItem(ModBlocks.ASSEMBLER_MATRIX_UPLOAD_CORE.get(), new Item.Properties())
);
}

View File

@ -525,7 +525,7 @@ public class ExtendedAEPatternUploadUtil {
var tiles = grid.getMachines(com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixPattern.class);
int idx = 0;
for (com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixPattern tile : tiles) {
if (tile != null && tile.isFormed() && tile.getMainNode().isActive()) {
if (tile != null && tile.isFormed() && tile.getMainNode().isActive() && clusterHasSingleUploadCore(tile)) {
var inv = tile.getExposedInventory();
if (inv != null) {
result.add(inv);
@ -1180,4 +1180,26 @@ public class ExtendedAEPatternUploadUtil {
}
return false;
}
/**
* 判断给定矩阵集群中是否存在"装配矩阵上传核心"
* 要求至少存在 1 个即可不限制数量
* 传入任意属于该集群的 Tile Pattern/Crafter/Frame
*/
private static boolean clusterHasSingleUploadCore(com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixBase any) {
try {
if (any == null || any.getCluster() == null) return false;
int cores = 0;
var it = any.getCluster().getBlockEntities();
while (it.hasNext()) {
var te = it.next();
if (te instanceof com.extendedae_plus.content.matrix.UploadCoreBlockEntity) {
cores++;
}
}
return cores >= 1; // 至少一个即可
} catch (Throwable t) {
return false;
}
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "extendedae_plus:block/assembler_matrix_upload_core" }
}
}

View File

@ -17,6 +17,7 @@
"item.extendedae_plus.256x_crafting_accelerator": "256x Crafting Accelerator",
"item.extendedae_plus.1024x_crafting_accelerator": "1024x Crafting Accelerator",
"item.extendedae_plus.network_pattern_controller": "Pattern Provider Status Controller",
"item.extendedae_plus.assembler_matrix_upload_core": "Assembly Matrix Upload Core",
"item.extendedae_plus.entity_speed_card": "Entity Speed Card",
"item.extendedae_plus.entity_speed_card.x2": "Entity Speed Card (x2)",
"item.extendedae_plus.entity_speed_card.x4": "Entity Speed Card (x4)",
@ -32,6 +33,7 @@
"block.extendedae_plus.256x_crafting_accelerator": "256x Crafting Accelerator",
"block.extendedae_plus.1024x_crafting_accelerator": "1024x Crafting Accelerator",
"block.extendedae_plus.network_pattern_controller": "Pattern Provider Status Controller",
"block.extendedae_plus.assembler_matrix_upload_core": "Assembly Matrix Upload Core",
"extendedae_plus.upload_to_matrix": "Upload to Assembly Matrix",
"extendedae_plus.upload_to_matrix.success": "Pattern Uploaded to Assembly Matrix",

View File

@ -17,6 +17,7 @@
"item.extendedae_plus.256x_crafting_accelerator": "256x并行处理单元",
"item.extendedae_plus.1024x_crafting_accelerator": "1024x并行处理单元",
"item.extendedae_plus.network_pattern_controller": "样板供应器状态控制器",
"item.extendedae_plus.assembler_matrix_upload_core": "装配矩阵上传核心",
"item.extendedae_plus.entity_speed_card": "实体加速卡",
"item.extendedae_plus.entity_speed_card.x2": "实体加速卡 (x2)",
"item.extendedae_plus.entity_speed_card.x4": "实体加速卡 (x4)",
@ -32,6 +33,7 @@
"block.extendedae_plus.256x_crafting_accelerator": "256x并行处理单元",
"block.extendedae_plus.1024x_crafting_accelerator": "1024x并行处理单元",
"block.extendedae_plus.network_pattern_controller": "样板供应器状态控制器",
"block.extendedae_plus.assembler_matrix_upload_core": "装配矩阵上传核心",
"extendedae_plus.upload_to_matrix": "上传到装配矩阵",
"extendedae_plus.upload_to_matrix.success": "样板已上传到装配矩阵",

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "extendedae_plus:block/assembler_matrix_upload_core"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "extendedae_plus:block/assembler_matrix_upload_core"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{ "item": "expatternprovider:assembler_matrix_wall" },
{ "item": "minecraft:lever" }
],
"result": {
"item": "extendedae_plus:assembler_matrix_upload_core",
"count": 1
}
}