添加1024并行处理单元
|
|
@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
loom.platform = forge
|
||||
|
||||
# Mod properties
|
||||
mod_version = 1.3.3-beta
|
||||
mod_version = 1.3.2-fix1
|
||||
maven_group = com.extendedae_plus
|
||||
archives_name = extendedae_plus
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ import net.minecraftforge.fml.common.Mod;
|
|||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import com.extendedae_plus.client.ClientProxy;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
/**
|
||||
* ExtendedAE Plus 主mod类
|
||||
|
|
@ -24,6 +29,14 @@ public class ExtendedAEPlus {
|
|||
|
||||
public static final String MODID = "extendedae_plus";
|
||||
|
||||
// 在类加载时(尽可能早)在客户端注册内置模型,避免首次资源加载时错过。
|
||||
static {
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
System.out.println("[ExtendedAE_Plus] Static init: register built-in models");
|
||||
ClientProxy.init();
|
||||
});
|
||||
}
|
||||
|
||||
public ExtendedAEPlus() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
|
|
@ -41,6 +54,9 @@ public class ExtendedAEPlus {
|
|||
|
||||
// 注册通用配置
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ModConfigs.COMMON_SPEC);
|
||||
|
||||
// 构造期在客户端再确保一次注册(幂等)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClientProxy::init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -54,4 +70,11 @@ public class ExtendedAEPlus {
|
|||
MenuLocators.register(CuriosItemLocator.class, CuriosItemLocator::writeToPacket, CuriosItemLocator::readFromPacket);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 便捷方法:生成 ResourceLocation
|
||||
*/
|
||||
public static ResourceLocation id(String path) {
|
||||
return new ResourceLocation(MODID, path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ package com.extendedae_plus.api;
|
|||
public interface AdvancedBlockingHolder {
|
||||
boolean eap$getAdvancedBlocking();
|
||||
void eap$setAdvancedBlocking(boolean value);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.extendedae_plus.client;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
/**
|
||||
* 确保在模型烘焙/资源重载期间也会注册内置模型,避免在刷新资源后丢失内置模型映射。
|
||||
*/
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public final class ClientModelEvents {
|
||||
private ClientModelEvents() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterAdditional(ModelEvent.RegisterAdditional event) {
|
||||
// 在每次模型重载开始时确保内置模型已注册
|
||||
ClientProxy.init();
|
||||
}
|
||||
}
|
||||
41
src/main/java/com/extendedae_plus/client/ClientProxy.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package com.extendedae_plus.client;
|
||||
|
||||
import appeng.client.render.crafting.CraftingCubeModel;
|
||||
import com.extendedae_plus.ExtendedAEPlus;
|
||||
import com.extendedae_plus.client.render.crafting.EPlusCraftingCubeModelProvider;
|
||||
import com.extendedae_plus.content.crafting.EPlusCraftingUnitType;
|
||||
import com.extendedae_plus.hooks.BuiltInModelHooks;
|
||||
|
||||
/**
|
||||
* 客户端模型注册,参照 MAE2 的做法将 formed 模型注册为内置模型。
|
||||
*/
|
||||
public final class ClientProxy {
|
||||
private ClientProxy() {}
|
||||
|
||||
private static boolean REGISTERED = false;
|
||||
|
||||
public static void init() {
|
||||
if (REGISTERED) return;
|
||||
REGISTERED = true;
|
||||
// 注册四种形成态模型为内置模型(使用 *_formed_v2 避免与现有 JSON 冲突)
|
||||
BuiltInModelHooks.addBuiltInModel(
|
||||
ExtendedAEPlus.id("block/crafting/4x_accelerator_formed_v2"),
|
||||
new CraftingCubeModel(new EPlusCraftingCubeModelProvider(EPlusCraftingUnitType.ACCELERATOR_4x)));
|
||||
|
||||
BuiltInModelHooks.addBuiltInModel(
|
||||
ExtendedAEPlus.id("block/crafting/16x_accelerator_formed_v2"),
|
||||
new CraftingCubeModel(new EPlusCraftingCubeModelProvider(EPlusCraftingUnitType.ACCELERATOR_16x)));
|
||||
|
||||
BuiltInModelHooks.addBuiltInModel(
|
||||
ExtendedAEPlus.id("block/crafting/64x_accelerator_formed_v2"),
|
||||
new CraftingCubeModel(new EPlusCraftingCubeModelProvider(EPlusCraftingUnitType.ACCELERATOR_64x)));
|
||||
|
||||
BuiltInModelHooks.addBuiltInModel(
|
||||
ExtendedAEPlus.id("block/crafting/256x_accelerator_formed_v2"),
|
||||
new CraftingCubeModel(new EPlusCraftingCubeModelProvider(EPlusCraftingUnitType.ACCELERATOR_256x)));
|
||||
|
||||
BuiltInModelHooks.addBuiltInModel(
|
||||
ExtendedAEPlus.id("block/crafting/1024x_accelerator_formed_v2"),
|
||||
new CraftingCubeModel(new EPlusCraftingCubeModelProvider(EPlusCraftingUnitType.ACCELERATOR_1024x)));
|
||||
}
|
||||
}
|
||||
|
|
@ -90,19 +90,9 @@ public final class InputEvents {
|
|||
|
||||
ITypedIngredient<?> typed = hovered.get();
|
||||
|
||||
String name = null;
|
||||
try {
|
||||
if (typed.getType() == VanillaTypes.ITEM_STACK) {
|
||||
//noinspection unchecked
|
||||
ItemStack stack = ((ITypedIngredient<ItemStack>) typed).getIngredient();
|
||||
if (stack != null) {
|
||||
name = stack.getHoverName().getString();
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
if (name == null || name.isEmpty()) return; // 非物品类型暂不处理(避免依赖未知 JEI 接口)
|
||||
// 通用获取显示名称(兼容物品/流体等)
|
||||
String name = JeiRuntimeProxy.getTypedIngredientDisplayName(typed);
|
||||
if (name == null || name.isEmpty()) return;
|
||||
|
||||
// 写入 AE2 终端的搜索框
|
||||
var screen = Minecraft.getInstance().screen;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
package com.extendedae_plus.client.render.crafting;
|
||||
|
||||
import appeng.client.render.crafting.AbstractCraftingUnitModelProvider;
|
||||
import appeng.client.render.crafting.LightBakedModel;
|
||||
import com.extendedae_plus.ExtendedAEPlus;
|
||||
import com.extendedae_plus.content.crafting.EPlusCraftingUnitType;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 参照 MAE2 的 DynamicCraftingCubeModelProvider,实现形成态光照模型。
|
||||
*/
|
||||
public class EPlusCraftingCubeModelProvider
|
||||
extends AbstractCraftingUnitModelProvider<EPlusCraftingUnitType> {
|
||||
|
||||
public static final ChunkRenderTypeSet CUTOUT = ChunkRenderTypeSet.of(RenderType.cutout());
|
||||
private static final List<Material> MATERIALS = new ArrayList<>();
|
||||
|
||||
// 与 MAE2 一致:将环形边框与基础发光底图放在本模组命名空间
|
||||
protected static final Material RING_CORNER = texture(ExtendedAEPlus.MODID, "ring_corner");
|
||||
protected static final Material RING_SIDE_HOR = texture(ExtendedAEPlus.MODID, "ring_side_hor");
|
||||
protected static final Material RING_SIDE_VER = texture(ExtendedAEPlus.MODID, "ring_side_ver");
|
||||
protected static final Material LIGHT_BASE = texture(ExtendedAEPlus.MODID, "light_base");
|
||||
|
||||
// 我们自己的亮面贴图(formed 时使用)
|
||||
protected static final Material ACCELERATOR_4X_LIGHT = texture(ExtendedAEPlus.MODID,
|
||||
"4x_accelerator_light");
|
||||
protected static final Material ACCELERATOR_16X_LIGHT = texture(ExtendedAEPlus.MODID,
|
||||
"16x_accelerator_light");
|
||||
protected static final Material ACCELERATOR_64X_LIGHT = texture(ExtendedAEPlus.MODID,
|
||||
"64x_accelerator_light");
|
||||
protected static final Material ACCELERATOR_256X_LIGHT = texture(ExtendedAEPlus.MODID,
|
||||
"256x_accelerator_light");
|
||||
protected static final Material ACCELERATOR_1024X_LIGHT = texture(ExtendedAEPlus.MODID,
|
||||
"1024x_accelerator_light");
|
||||
|
||||
public EPlusCraftingCubeModelProvider(EPlusCraftingUnitType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Material> getMaterials() {
|
||||
return Collections.unmodifiableList(MATERIALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel getBakedModel(Function<Material, TextureAtlasSprite> spriteGetter) {
|
||||
TextureAtlasSprite ringCorner = spriteGetter.apply(RING_CORNER);
|
||||
TextureAtlasSprite ringSideHor = spriteGetter.apply(RING_SIDE_HOR);
|
||||
TextureAtlasSprite ringSideVer = spriteGetter.apply(RING_SIDE_VER);
|
||||
|
||||
return new LightBakedModel(ringCorner, ringSideHor, ringSideVer,
|
||||
spriteGetter.apply(LIGHT_BASE), this.getLightMaterial(spriteGetter)) {
|
||||
public ChunkRenderTypeSet getRenderTypes(BlockState state, RandomSource rand, ModelData data) {
|
||||
return CUTOUT;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private TextureAtlasSprite getLightMaterial(Function<Material, TextureAtlasSprite> textureGetter) {
|
||||
return switch (this.type) {
|
||||
case ACCELERATOR_4x -> textureGetter.apply(ACCELERATOR_4X_LIGHT);
|
||||
case ACCELERATOR_16x -> textureGetter.apply(ACCELERATOR_16X_LIGHT);
|
||||
case ACCELERATOR_64x -> textureGetter.apply(ACCELERATOR_64X_LIGHT);
|
||||
case ACCELERATOR_256x -> textureGetter.apply(ACCELERATOR_256X_LIGHT);
|
||||
case ACCELERATOR_1024x -> textureGetter.apply(ACCELERATOR_1024X_LIGHT);
|
||||
};
|
||||
}
|
||||
|
||||
private static Material texture(String namespace, String name) {
|
||||
var mat = new Material(TextureAtlas.LOCATION_BLOCKS,
|
||||
new ResourceLocation(namespace, "block/crafting/" + name));
|
||||
MATERIALS.add(mat);
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.extendedae_plus.content.crafting;
|
||||
|
||||
import appeng.block.crafting.ICraftingUnitType;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
import com.extendedae_plus.init.ModItems;
|
||||
|
||||
public enum EPlusCraftingUnitType implements ICraftingUnitType {
|
||||
ACCELERATOR_4x(0, 4),
|
||||
ACCELERATOR_16x(0, 16),
|
||||
ACCELERATOR_64x(0, 64),
|
||||
ACCELERATOR_256x(0, 256),
|
||||
ACCELERATOR_1024x(0, 1024);
|
||||
|
||||
private final long storage;
|
||||
private final int threads;
|
||||
|
||||
EPlusCraftingUnitType(long storage, int threads) {
|
||||
this.storage = storage;
|
||||
this.threads = threads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStorageBytes() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAcceleratorThreads() {
|
||||
// 返回真实线程值,单块可能超过 16。上限校验已由 mixin 绕过。
|
||||
return this.threads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemFromType() {
|
||||
return switch (this) {
|
||||
case ACCELERATOR_4x -> ModItems.ACCELERATOR_4x.get();
|
||||
case ACCELERATOR_16x -> ModItems.ACCELERATOR_16x.get();
|
||||
case ACCELERATOR_64x -> ModItems.ACCELERATOR_64x.get();
|
||||
case ACCELERATOR_256x -> ModItems.ACCELERATOR_256x.get();
|
||||
case ACCELERATOR_1024x -> ModItems.ACCELERATOR_1024x.get();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.extendedae_plus.hooks;
|
||||
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 复刻 Fabric 的内置模型注册能力(与 AE2/MAE2 相同实现)。
|
||||
*/
|
||||
public final class BuiltInModelHooks {
|
||||
private static final Map<ResourceLocation, UnbakedModel> BUILTIN_MODELS = new ConcurrentHashMap<>();
|
||||
|
||||
private BuiltInModelHooks() {}
|
||||
|
||||
public static void addBuiltInModel(ResourceLocation id, UnbakedModel model) {
|
||||
var prev = BUILTIN_MODELS.putIfAbsent(id, model);
|
||||
if (prev != null) {
|
||||
throw new IllegalStateException("Duplicate built-in model ID: " + id);
|
||||
}
|
||||
}
|
||||
|
||||
public static UnbakedModel getBuiltInModel(ResourceLocation id) {
|
||||
return BUILTIN_MODELS.get(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,10 @@ 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 appeng.block.crafting.CraftingUnitBlock;
|
||||
import appeng.blockentity.crafting.CraftingBlockEntity;
|
||||
import appeng.core.definitions.AEBlockEntities;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
|
@ -23,4 +27,50 @@ public final class ModBlocks {
|
|||
.requiresCorrectToolForDrops()
|
||||
)
|
||||
);
|
||||
|
||||
// Crafting Accelerators (reuse MAE2 textures/models)
|
||||
public static final RegistryObject<CraftingUnitBlock> ACCELERATOR_4x = BLOCKS.register(
|
||||
"4x_crafting_accelerator",
|
||||
() -> {
|
||||
var b = new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_4x);
|
||||
b.setBlockEntity(CraftingBlockEntity.class, AEBlockEntities.CRAFTING_UNIT, null, null);
|
||||
return b;
|
||||
}
|
||||
);
|
||||
|
||||
public static final RegistryObject<CraftingUnitBlock> ACCELERATOR_16x = BLOCKS.register(
|
||||
"16x_crafting_accelerator",
|
||||
() -> {
|
||||
var b = new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_16x);
|
||||
b.setBlockEntity(CraftingBlockEntity.class, AEBlockEntities.CRAFTING_UNIT, null, null);
|
||||
return b;
|
||||
}
|
||||
);
|
||||
|
||||
public static final RegistryObject<CraftingUnitBlock> ACCELERATOR_64x = BLOCKS.register(
|
||||
"64x_crafting_accelerator",
|
||||
() -> {
|
||||
var b = new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_64x);
|
||||
b.setBlockEntity(CraftingBlockEntity.class, AEBlockEntities.CRAFTING_UNIT, null, null);
|
||||
return b;
|
||||
}
|
||||
);
|
||||
|
||||
public static final RegistryObject<CraftingUnitBlock> ACCELERATOR_256x = BLOCKS.register(
|
||||
"256x_crafting_accelerator",
|
||||
() -> {
|
||||
var b = new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_256x);
|
||||
b.setBlockEntity(CraftingBlockEntity.class, AEBlockEntities.CRAFTING_UNIT, null, null);
|
||||
return b;
|
||||
}
|
||||
);
|
||||
|
||||
public static final RegistryObject<CraftingUnitBlock> ACCELERATOR_1024x = BLOCKS.register(
|
||||
"1024x_crafting_accelerator",
|
||||
() -> {
|
||||
var b = new CraftingUnitBlock(EPlusCraftingUnitType.ACCELERATOR_1024x);
|
||||
b.setBlockEntity(CraftingBlockEntity.class, AEBlockEntities.CRAFTING_UNIT, null, null);
|
||||
return b;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ public final class ModCreativeTabs {
|
|||
.displayItems((params, output) -> {
|
||||
// 将本模组物品加入创造物品栏
|
||||
output.accept(ModItems.WIRELESS_TRANSCEIVER.get());
|
||||
output.accept(ModItems.ACCELERATOR_4x.get());
|
||||
output.accept(ModItems.ACCELERATOR_16x.get());
|
||||
output.accept(ModItems.ACCELERATOR_64x.get());
|
||||
output.accept(ModItems.ACCELERATOR_256x.get());
|
||||
output.accept(ModItems.ACCELERATOR_1024x.get());
|
||||
})
|
||||
.build());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,30 @@ public final class ModItems {
|
|||
"wireless_transceiver",
|
||||
() -> new BlockItem(ModBlocks.WIRELESS_TRANSCEIVER.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
// Crafting Accelerators
|
||||
public static final RegistryObject<Item> ACCELERATOR_4x = ITEMS.register(
|
||||
"4x_crafting_accelerator",
|
||||
() -> new BlockItem(ModBlocks.ACCELERATOR_4x.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
public static final RegistryObject<Item> ACCELERATOR_16x = ITEMS.register(
|
||||
"16x_crafting_accelerator",
|
||||
() -> new BlockItem(ModBlocks.ACCELERATOR_16x.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
public static final RegistryObject<Item> ACCELERATOR_64x = ITEMS.register(
|
||||
"64x_crafting_accelerator",
|
||||
() -> new BlockItem(ModBlocks.ACCELERATOR_64x.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
public static final RegistryObject<Item> ACCELERATOR_256x = ITEMS.register(
|
||||
"256x_crafting_accelerator",
|
||||
() -> new BlockItem(ModBlocks.ACCELERATOR_256x.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
public static final RegistryObject<Item> ACCELERATOR_1024x = ITEMS.register(
|
||||
"1024x_crafting_accelerator",
|
||||
() -> new BlockItem(ModBlocks.ACCELERATOR_1024x.get(), new Item.Properties())
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,4 +87,30 @@ public final class JeiRuntimeProxy {
|
|||
// 兼容不同 JEI 版本或在启动阶段尚未就绪
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取 JEI 悬浮配料的本地化显示名称(适配物品/流体等)。
|
||||
* 若无法安全获取,则返回空字符串。
|
||||
*/
|
||||
public static <T> String getTypedIngredientDisplayName(ITypedIngredient<T> typed) {
|
||||
IJeiRuntime rt = RUNTIME;
|
||||
if (rt == null || typed == null) return "";
|
||||
try {
|
||||
var manager = rt.getIngredientManager();
|
||||
var helper = manager.getIngredientHelper(typed.getType());
|
||||
// JEI 的 IIngredientHelper#getDisplayName 返回 Component(新版本)或 String(旧版本)
|
||||
// 统一转为字符串,使用 toString() 兜底
|
||||
Object display = helper.getDisplayName(typed.getIngredient());
|
||||
if (display == null) return "";
|
||||
// 新版:net.minecraft.network.chat.Component
|
||||
if (display instanceof net.minecraft.network.chat.Component comp) {
|
||||
String s = comp.getString();
|
||||
return s == null ? "" : s;
|
||||
}
|
||||
String s = display.toString();
|
||||
return s == null ? "" : s;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
|
||||
import appeng.blockentity.crafting.CraftingBlockEntity;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = CraftingCPUCluster.class, remap = false)
|
||||
public abstract class CraftingCPUClusterMixin {
|
||||
// Redirect the second call (ordinal=1) to getAcceleratorThreads in addBlockEntity,
|
||||
// which is used for the per-block <=16 validation in AE2. We return 1 so the check always passes.
|
||||
@Redirect(
|
||||
method = "addBlockEntity(Lappeng/blockentity/crafting/CraftingBlockEntity;)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lappeng/blockentity/crafting/CraftingBlockEntity;getAcceleratorThreads()I",
|
||||
ordinal = 1
|
||||
)
|
||||
)
|
||||
private int extendedae_plus$onGetThreadsForLimitCheck(CraftingBlockEntity te) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.extendedae_plus.mixin.hooks;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import com.extendedae_plus.hooks.BuiltInModelHooks;
|
||||
|
||||
/**
|
||||
* 复制 MAE2/AE2 的做法:在模型加载时优先查询我们的内置模型表,
|
||||
* 若命中则缓存并阻止继续查找 JSON 模型。
|
||||
*/
|
||||
@Mixin(ModelBakery.class)
|
||||
public class ModelBakeryMixin {
|
||||
@Inject(method = "loadModel", at = @At("HEAD"), cancellable = true)
|
||||
private void extendedae_plus$loadModelHook(ResourceLocation id, CallbackInfo ci) {
|
||||
var model = BuiltInModelHooks.getBuiltInModel(id);
|
||||
if (model != null) {
|
||||
cacheAndQueueDependencies(id, model);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected void cacheAndQueueDependencies(ResourceLocation id, UnbakedModel unbakedModel) {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"formed=false": { "model": "extendedae_plus:block/crafting/1024x_accelerator" },
|
||||
"formed=true": { "model": "extendedae_plus:block/crafting/1024x_accelerator_formed_v2" }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"formed=false": { "model": "extendedae_plus:block/crafting/16x_accelerator" },
|
||||
"formed=true": { "model": "extendedae_plus:block/crafting/16x_accelerator_formed_v2" }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"formed=false": { "model": "extendedae_plus:block/crafting/256x_accelerator" },
|
||||
"formed=true": { "model": "extendedae_plus:block/crafting/256x_accelerator_formed_v2" }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"formed=false": { "model": "extendedae_plus:block/crafting/4x_accelerator" },
|
||||
"formed=true": { "model": "extendedae_plus:block/crafting/4x_accelerator_formed_v2" }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"formed=false": { "model": "extendedae_plus:block/crafting/64x_accelerator" },
|
||||
"formed=true": { "model": "extendedae_plus:block/crafting/64x_accelerator_formed_v2" }
|
||||
}
|
||||
}
|
||||
|
|
@ -14,5 +14,17 @@
|
|||
"extendedae_plus.screen.reload_mapping": "重载映射",
|
||||
"extendedae_plus.screen.add_mapping": "增加映射",
|
||||
"extendedae_plus.screen.cn_name": "中文名",
|
||||
"extendedae_plus.button.choose_provider":"上传样板"
|
||||
"extendedae_plus.button.choose_provider":"上传样板",
|
||||
|
||||
"block.extendedae_plus.4x_crafting_accelerator": "4x并行处理单元",
|
||||
"block.extendedae_plus.16x_crafting_accelerator": "16x并行处理单元",
|
||||
"block.extendedae_plus.64x_crafting_accelerator": "64x并行处理单元",
|
||||
"block.extendedae_plus.256x_crafting_accelerator": "256x并行处理单元",
|
||||
"block.extendedae_plus.1024x_crafting_accelerator": "1024x并行处理单元",
|
||||
|
||||
"item.extendedae_plus.4x_crafting_accelerator": "4x并行处理单元",
|
||||
"item.extendedae_plus.16x_crafting_accelerator": "16x并行处理单元",
|
||||
"item.extendedae_plus.64x_crafting_accelerator": "64x并行处理单元",
|
||||
"item.extendedae_plus.256x_crafting_accelerator": "256x并行处理单元",
|
||||
"item.extendedae_plus.1024x_crafting_accelerator": "1024x并行处理单元"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": { "all": "extendedae_plus:block/crafting/1024x_accelerator" }
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": { "all": "extendedae_plus:block/crafting/16x_accelerator" }
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": { "all": "extendedae_plus:block/crafting/256x_accelerator" }
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": { "all": "extendedae_plus:block/crafting/4x_accelerator" }
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": { "all": "extendedae_plus:block/crafting/64x_accelerator" }
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "parent": "extendedae_plus:block/crafting/1024x_accelerator" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "parent": "extendedae_plus:block/crafting/16x_accelerator" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "parent": "extendedae_plus:block/crafting/256x_accelerator" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "parent": "extendedae_plus:block/crafting/4x_accelerator" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "parent": "extendedae_plus:block/crafting/64x_accelerator" }
|
||||
|
After Width: | Height: | Size: 794 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 179 B |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
" ",
|
||||
"ACA",
|
||||
" "
|
||||
],
|
||||
"key": {
|
||||
"A": { "item": "ae2:cell_component_256k" },
|
||||
"C": { "item": "extendedae_plus:256x_crafting_accelerator" }
|
||||
},
|
||||
"result": { "item": "extendedae_plus:1024x_crafting_accelerator", "count": 1 }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "ae2:crafting_accelerator" },
|
||||
{ "item": "ae2:cell_component_16k" }
|
||||
],
|
||||
"result": { "item": "extendedae_plus:16x_crafting_accelerator", "count": 1 }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "ae2:crafting_accelerator" },
|
||||
{ "item": "ae2:cell_component_256k" }
|
||||
],
|
||||
"result": { "item": "extendedae_plus:256x_crafting_accelerator", "count": 1 }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "ae2:crafting_accelerator" },
|
||||
{ "item": "ae2:cell_component_4k" }
|
||||
],
|
||||
"result": { "item": "extendedae_plus:4x_crafting_accelerator", "count": 1 }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "ae2:crafting_accelerator" },
|
||||
{ "item": "ae2:cell_component_64k" }
|
||||
],
|
||||
"result": { "item": "extendedae_plus:64x_crafting_accelerator", "count": 1 }
|
||||
}
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
"extendedae.HighlightButtonMixin",
|
||||
"extendedae.accessor.GuiExPatternTerminalAccessor",
|
||||
"extendedae.accessor.GuiExPatternTerminalSlotsRowAccessor",
|
||||
"jei.EncodePatternTransferHandlerMixin"
|
||||
"jei.EncodePatternTransferHandlerMixin",
|
||||
"hooks.ModelBakeryMixin"
|
||||
],
|
||||
"mixins": [
|
||||
"ae2.ContainerPatternEncodingTermMenuMixin",
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
"extendedae.ContainerExPatternProviderMixin",
|
||||
"extendedae.ContainerExPatternTerminalMixin",
|
||||
"extendedae.ContainerWirelessExPatternTerminalMixin",
|
||||
"ae2.CraftingCPUClusterMixin",
|
||||
"extendedae.PartExPatternProviderMixin",
|
||||
"extendedae.TileExPatternProviderMixin"
|
||||
],
|
||||
|
|
|
|||