超级装配矩阵样板核心
This commit is contained in:
parent
18331c6a6d
commit
7372389e95
|
|
@ -6,6 +6,7 @@ import com.extendedae_plus.api.storage.InfinityBigIntegerCellHandler;
|
|||
import com.extendedae_plus.client.ClientRegistrar;
|
||||
import com.extendedae_plus.config.ModConfig;
|
||||
import com.extendedae_plus.content.matrix.CrafterCorePlusBlockEntity;
|
||||
import com.extendedae_plus.content.matrix.PatternCorePlusBlockEntity;
|
||||
import com.extendedae_plus.init.*;
|
||||
import com.extendedae_plus.menu.locator.CuriosItemLocator;
|
||||
import com.extendedae_plus.util.command.InfinityDiskGiveCommand;
|
||||
|
|
@ -95,6 +96,14 @@ public class ExtendedAEPlus {
|
|||
null,
|
||||
null
|
||||
);
|
||||
|
||||
ModBlocks.ASSEMBLER_MATRIX_PATTERN_PLUS.get().setBlockEntity(
|
||||
PatternCorePlusBlockEntity.class,
|
||||
ModBlockEntities.ASSEMBLER_MATRIX_PATTERN_PLUS_BE.get(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.extendedae_plus.content.matrix;
|
||||
|
||||
import com.extendedae_plus.init.ModItems;
|
||||
import com.glodblock.github.extendedae.common.blocks.matrix.BlockAssemblerMatrixBase;
|
||||
import com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixPattern;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
public class PatternCorePlusBlock extends BlockAssemblerMatrixBase<PatternCorePlusBlockEntity> {
|
||||
|
||||
public PatternCorePlusBlock() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getPresentItem() {
|
||||
return ModItems.ASSEMBLER_MATRIX_PATTERN_PLUS.get();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
package com.extendedae_plus.content.matrix;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.api.crafting.PatternDetailsHelper;
|
||||
import appeng.api.implementations.blockentities.PatternContainerGroup;
|
||||
import appeng.api.inventories.InternalInventory;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.stacks.AEItemKey;
|
||||
import appeng.api.stacks.KeyCounter;
|
||||
import appeng.blockentity.crafting.IMolecularAssemblerSupportedPattern;
|
||||
import appeng.crafting.pattern.EncodedPatternItem;
|
||||
import appeng.helpers.patternprovider.PatternContainer;
|
||||
import appeng.util.inv.AppEngInternalInventory;
|
||||
import appeng.util.inv.FilteredInternalInventory;
|
||||
import appeng.util.inv.InternalInventoryHost;
|
||||
import appeng.util.inv.filter.AEItemFilters;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
import com.extendedae_plus.init.ModBlockEntities;
|
||||
import com.glodblock.github.extendedae.common.EPPItemAndBlock;
|
||||
import com.glodblock.github.extendedae.common.me.matrix.ClusterAssemblerMatrix;
|
||||
import com.glodblock.github.extendedae.common.tileentities.matrix.TileAssemblerMatrixPattern;
|
||||
import com.glodblock.github.glodium.util.GlodUtil;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.extendedae_plus.init.ModBlockEntities.BLOCK_ENTITY_TYPES;
|
||||
|
||||
public class PatternCorePlusBlockEntity extends TileAssemblerMatrixPattern {
|
||||
|
||||
public final static int INV_SIZE = 72;
|
||||
private final AppEngInternalInventory patternInventory;
|
||||
private final FilteredInternalInventory exposedInventory;
|
||||
private final List<IPatternDetails> patterns = new ArrayList<>();
|
||||
private final BlockEntityType<?> overriddenType;
|
||||
|
||||
public PatternCorePlusBlockEntity(BlockPos pos, BlockState blockState) {
|
||||
super(pos, blockState);
|
||||
this.overriddenType = ModBlockEntities.ASSEMBLER_MATRIX_PATTERN_PLUS_BE.get();
|
||||
|
||||
this.patternInventory = new AppEngInternalInventory(this, INV_SIZE, 1);
|
||||
this.patternInventory.setFilter(new Filter(this::getLevel));
|
||||
this.exposedInventory = new FilteredInternalInventory(this.patternInventory, AEItemFilters.INSERT_ONLY);
|
||||
this.getMainNode().addService(ICraftingProvider.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAdditional(CompoundTag data) {
|
||||
super.saveAdditional(data);
|
||||
this.patternInventory.writeToNBT(data, "pattern");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTag(CompoundTag data) {
|
||||
super.loadTag(data);
|
||||
this.patternInventory.readFromNBT(data, "pattern");
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getPatternInventory() {
|
||||
return this.patternInventory;
|
||||
}
|
||||
|
||||
public FilteredInternalInventory getExposedInventory() {
|
||||
return this.exposedInventory;
|
||||
}
|
||||
|
||||
public long getLocateID() {
|
||||
return this.worldPosition.asLong();
|
||||
}
|
||||
|
||||
public void updatePatterns() {
|
||||
this.patterns.clear();
|
||||
for (var stack : this.patternInventory) {
|
||||
var details = PatternDetailsHelper.decodePattern(stack, this.getLevel());
|
||||
if (details != null) {
|
||||
patterns.add(details);
|
||||
}
|
||||
}
|
||||
ICraftingProvider.requestUpdate(this.getMainNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalDrops(Level level, BlockPos pos, List<ItemStack> drops) {
|
||||
super.addAdditionalDrops(level, pos, drops);
|
||||
for (var pattern : this.patternInventory) {
|
||||
drops.add(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearContent() {
|
||||
super.clearContent();
|
||||
this.patternInventory.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(ClusterAssemblerMatrix c) {
|
||||
c.addPattern(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(InternalInventory inv, int slot) {
|
||||
this.saveChanges();
|
||||
this.updatePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady() {
|
||||
super.onReady();
|
||||
this.updatePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IPatternDetails> getAvailablePatterns() {
|
||||
return this.patterns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(IPatternDetails patternDetails, KeyCounter[] inputHolder) {
|
||||
if (!isFormed() || !this.getMainNode().isActive() || !this.patterns.contains(patternDetails)) {
|
||||
return false;
|
||||
}
|
||||
return this.cluster.pushCraftingJob(patternDetails, inputHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
return this.cluster == null || this.cluster.isBusy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable IGrid getGrid() {
|
||||
return this.getMainNode().getGrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalInventory getTerminalPatternInventory() {
|
||||
return this.patternInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTerminal() {
|
||||
return this.manager.getSetting(Settings.PATTERN_ACCESS_TERMINAL) == YesNo.YES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatternContainerGroup getTerminalGroup() {
|
||||
var icon = AEItemKey.of(EPPItemAndBlock.ASSEMBLER_MATRIX_PATTERN);
|
||||
return new PatternContainerGroup(icon, icon.getDisplayName(), List.of(Component.translatable("gui.expatternprovider.assembler_matrix.pattern")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<?> getType() {
|
||||
return this.overriddenType;
|
||||
}
|
||||
|
||||
public record Filter(Supplier<Level> world) implements IAEItemFilter {
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(InternalInventory inv, int slot, ItemStack stack) {
|
||||
if (stack.getItem() instanceof EncodedPatternItem) {
|
||||
return PatternDetailsHelper.decodePattern(stack, world.get()) instanceof IMolecularAssemblerSupportedPattern;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.extendedae_plus.init;
|
|||
|
||||
import com.extendedae_plus.ExtendedAEPlus;
|
||||
import com.extendedae_plus.content.matrix.CrafterCorePlusBlockEntity;
|
||||
import com.extendedae_plus.content.matrix.PatternCorePlusBlockEntity;
|
||||
import com.extendedae_plus.content.matrix.SpeedCorePlusBlockEntity;
|
||||
import com.extendedae_plus.content.wireless.WirelessTransceiverBlockEntity;
|
||||
import com.extendedae_plus.content.matrix.UploadCoreBlockEntity;
|
||||
|
|
@ -40,6 +41,12 @@ public final class ModBlockEntities {
|
|||
()-> BlockEntityType.Builder.of(CrafterCorePlusBlockEntity::new,
|
||||
ModBlocks.ASSEMBLER_MATRIX_CRAFTER_PLUS.get()).build(null));
|
||||
|
||||
//超级装配矩阵样板核心
|
||||
public static final RegistryObject<BlockEntityType<PatternCorePlusBlockEntity>> ASSEMBLER_MATRIX_PATTERN_PLUS_BE =
|
||||
BLOCK_ENTITY_TYPES.register("assmbler_matrix_pattern_plus",
|
||||
()-> BlockEntityType.Builder.of(PatternCorePlusBlockEntity::new,
|
||||
ModBlocks.ASSEMBLER_MATRIX_PATTERN_PLUS.get()).build(null));
|
||||
|
||||
// 装配矩阵上传核心
|
||||
public static final RegistryObject<BlockEntityType<UploadCoreBlockEntity>> UPLOAD_CORE_BE =
|
||||
BLOCK_ENTITY_TYPES.register("assembler_matrix_upload_core",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import appeng.core.definitions.AEBlockEntities;
|
|||
import com.extendedae_plus.ExtendedAEPlus;
|
||||
import com.extendedae_plus.content.crafting.EPlusCraftingUnitType;
|
||||
import com.extendedae_plus.content.matrix.CrafterCorePlusBlock;
|
||||
import com.extendedae_plus.content.matrix.PatternCorePlusBlock;
|
||||
import com.extendedae_plus.content.matrix.SpeedCorePlusBlock;
|
||||
import com.extendedae_plus.content.matrix.UploadCoreBlock;
|
||||
import com.extendedae_plus.content.wireless.WirelessTransceiverBlock;
|
||||
|
|
@ -52,7 +53,7 @@ public final class ModBlocks {
|
|||
}
|
||||
);
|
||||
|
||||
// 装配矩阵速度核心 Plus(内部功能块)
|
||||
// 超级装配矩阵速度核心
|
||||
public static final RegistryObject<SpeedCorePlusBlock> ASSEMBLER_MATRIX_SPEED_PLUS = BLOCKS.register(
|
||||
"assembler_matrix_speed_plus",
|
||||
SpeedCorePlusBlock::new
|
||||
|
|
@ -64,6 +65,11 @@ public final class ModBlocks {
|
|||
CrafterCorePlusBlock::new
|
||||
);
|
||||
|
||||
//超级装配矩阵样板核心
|
||||
public static final RegistryObject<PatternCorePlusBlock> ASSEMBLER_MATRIX_PATTERN_PLUS = BLOCKS.register(
|
||||
"assembler_matrix_pattern_plus",
|
||||
PatternCorePlusBlock::new
|
||||
);
|
||||
// Crafting Accelerators (reuse MAE2 textures/models)
|
||||
public static final RegistryObject<CraftingUnitBlock> CRAFTING_ACCELERATOR_4x = BLOCKS.register(
|
||||
"4x_crafting_accelerator",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ public final class ModCreativeTabs {
|
|||
output.accept(ModItems.ASSEMBLER_MATRIX_SPEED_PLUS.get());
|
||||
//超级装配矩阵合成核心
|
||||
output.accept(ModItems.ASSEMBLER_MATRIX_CRAFTER_PLUS.get());
|
||||
//超级装配矩阵样板核心
|
||||
output.accept(ModItems.ASSEMBLER_MATRIX_PATTERN_PLUS.get());
|
||||
|
||||
|
||||
//实体加速器&加速卡
|
||||
output.accept(ModItems.CRAFTING_ACCELERATOR_4x.get());
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ public final class ModItems {
|
|||
"assembler_matrix_crafter_plus",
|
||||
()-> new BlockItem(ModBlocks.ASSEMBLER_MATRIX_CRAFTER_PLUS.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
//超级装配矩阵样板核心
|
||||
public static final RegistryObject<Item> ASSEMBLER_MATRIX_PATTERN_PLUS = ITEMS.register(
|
||||
"assembler_matrix_pattern_plus",
|
||||
()-> new BlockItem(ModBlocks.ASSEMBLER_MATRIX_PATTERN_PLUS.get(), new Item.Properties())
|
||||
);
|
||||
// Crafting Accelerators
|
||||
public static final RegistryObject<Item> CRAFTING_ACCELERATOR_4x = ITEMS.register(
|
||||
"4x_crafting_accelerator",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "extendedae_plus:block/assembler_matrix_pattern_plus" }
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
"block.extendedae_plus.assembler_matrix_upload_core": "Assembler Matrix Upload Core",
|
||||
"block.extendedae_plus.assembler_matrix_speed_plus": "Assembler Matrix Speed Core Plus",
|
||||
"block.extendedae_plus.assembler_matrix_crafter_plus": "Assembler Matrix Crafter Core Plus",
|
||||
"block.extendedae_plus.assembler_matrix_pattern_plus": "Assembler Matrix Pattern Core Plus",
|
||||
|
||||
"extendedae_plus.upload_to_matrix": "Upload to Assembly Matrix",
|
||||
"extendedae_plus.upload_to_matrix.success": "Pattern uploaded to the assembly matrix",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
"block.extendedae_plus.assembler_matrix_upload_core": "装配矩阵上传核心",
|
||||
"block.extendedae_plus.assembler_matrix_speed_plus": "超级装配矩阵速度核心",
|
||||
"block.extendedae_plus.assembler_matrix_crafter_plus": "超级装配矩阵合成核心",
|
||||
"block.extendedae_plus.assembler_matrix_pattern_plus": "超级装配矩阵样板核心",
|
||||
|
||||
"extendedae_plus.upload_to_matrix": "上传到装配矩阵",
|
||||
"extendedae_plus.upload_to_matrix.success": "样板已上传到装配矩阵",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {
|
||||
"all": "extendedae_plus:block/assembler_matrix_pattern_plus"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "extendedae_plus:block/assembler_matrix_pattern_plus"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 254 B |
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "extendedae_plus:assembler_matrix_pattern_plus"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
"extendedae_plus:64x_crafting_accelerator",
|
||||
"extendedae_plus:256x_crafting_accelerator",
|
||||
"extendedae_plus:1024x_crafting_accelerator",
|
||||
"extendedae_plus:assembler_matrix_crafter_plus"
|
||||
"extendedae_plus:assembler_matrix_crafter_plus",
|
||||
"extendedae_plus:assembler_matrix_pattern_plus"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"extendedae_plus:64x_crafting_accelerator",
|
||||
"extendedae_plus:256x_crafting_accelerator",
|
||||
"extendedae_plus:1024x_crafting_accelerator",
|
||||
"extendedae_plus:assembler_matrix_crafter_plus"
|
||||
"extendedae_plus:assembler_matrix_crafter_plus",
|
||||
"extendedae_plus:assembler_matrix_pattern_plus"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user