This commit is contained in:
1820982382
2026-08-05 23:23:37 +08:00
parent 83143de9d3
commit 50969e9c26
14 changed files with 41 additions and 41 deletions
@@ -47,7 +47,7 @@ public class GuiArcaneCraftingTerminal extends MEStorageScreen<ContainerArcaneCr
if (cachedAnchorY < 0) { if (cachedAnchorY < 0) {
for (var slot : this.menu.slots) { for (var slot : this.menu.slots) {
// CRAFTING_RESULT 槽在 style JSON 中 bottom:140 // CRAFTING_RESULT 槽在 style JSON 中 bottom:140
if (slot instanceof AppEngCraftingSlot) { if (slot instanceof appeng.menu.slot.AppEngCraftingSlot) {
cachedAnchorY = slot.y; cachedAnchorY = slot.y;
break; break;
} }
@@ -5,22 +5,22 @@ import thaumicenergistics.ThaumicEnergistics;
/** /**
* 傀儡无线背包皮肤枚举。 * 傀儡无线背包皮肤枚举。
* 每种皮肤对应一个纹理文件:{@code textures/model/golemBackpack/{texId}.png}。 * 每种皮肤对应一个纹理文件:{@code textures/model/golembackpack/{texId}.png}。
* 皮肤通过 AE2 Facade 物品右键傀儡来更换。 * 皮肤通过 AE2 Facade 物品右键傀儡来更换。
* 对应 1.7.10 的 {@code ItemGolemWirelessBackpack.BackpackSkins}。 * 对应 1.7.10 的 {@code ItemGolemWirelessBackpack.BackpackSkins}。
*/ */
public enum BackpackSkins { public enum BackpackSkins {
Thaumium("Thaum"), Thaumium("thaum"),
Stone("Stone"), Stone("stone"),
Straw("Straw"), Straw("straw"),
Wood("Wood"), Wood("wood"),
Flesh("Flesh"), Flesh("flesh"),
Clay("Clay"), Clay("clay"),
Iron("Iron"), Iron("iron"),
Tallow("Tallow"), Tallow("tallow"),
Gold("Gold"), Gold("gold"),
Diamond("Diamond"); Diamond("diamond");
public static final BackpackSkins[] VALUES = values(); public static final BackpackSkins[] VALUES = values();
@@ -41,7 +41,7 @@ public enum BackpackSkins {
public ResourceLocation getTextureLocation() { public ResourceLocation getTextureLocation() {
if (this.texture == null) { if (this.texture == null) {
this.texture = ResourceLocation.fromNamespaceAndPath( this.texture = ResourceLocation.fromNamespaceAndPath(
ThaumicEnergistics.MODID, "textures/model/golemBackpack/" + this.texId + ".png"); ThaumicEnergistics.MODID, "textures/model/golembackpack/" + this.texId + ".png");
} }
return this.texture; return this.texture;
} }
@@ -383,11 +383,11 @@ public final class RecipeRegistration {
return new ItemStack(s.get()); return new ItemStack(s.get());
} }
private static ItemStack tc(String name) { private static ItemStack tc(String name) {
return new ItemStack(BuiltInRegistries.ITEM.get( return new ItemStack(net.minecraft.core.registries.BuiltInRegistries.ITEM.get(
ResourceLocation.fromNamespaceAndPath("thaumcraft", name))); ResourceLocation.fromNamespaceAndPath("thaumcraft", name)));
} }
private static ItemStack ae(String name) { private static ItemStack ae(String name) {
return new ItemStack(BuiltInRegistries.ITEM.get( return new ItemStack(net.minecraft.core.registries.BuiltInRegistries.ITEM.get(
ResourceLocation.fromNamespaceAndPath("ae2", name))); ResourceLocation.fromNamespaceAndPath("ae2", name)));
} }
} }
@@ -87,7 +87,7 @@ public class PseudoResearchItem extends ResearchItem {
} else { } else {
// 最终备选:ThE 研究 tab 图标 // 最终备选:ThE 研究 tab 图标
pseudo = new PseudoResearchItem(pseudoKey, category, column, row, pseudo = new PseudoResearchItem(pseudoKey, category, column, row,
ResourceLocation.fromNamespaceAndPath(ThaumicEnergistics.MODID, "textures/research/tab_icon.png"), ResourceLocation.fromNamespaceAndPath(thaumicenergistics.ThaumicEnergistics.MODID, "textures/research/tab_icon.png"),
realKey, realCategory); realKey, realCategory);
} }
@@ -36,7 +36,7 @@ public class ItemEssentiaCell extends Item implements IBasicCellItem {
private final int totalTypes; private final int totalTypes;
private final double idleDrain; private final double idleDrain;
public ItemEssentiaCell(Properties props, String tier, int kilobytes, int bytesPerType, int totalTypes, double idleDrain) { public ItemEssentiaCell(Item.Properties props, String tier, int kilobytes, int bytesPerType, int totalTypes, double idleDrain) {
super(props.stacksTo(1)); super(props.stacksTo(1));
this.tier = tier; this.tier = tier;
this.totalBytes = kilobytes * 1024; this.totalBytes = kilobytes * 1024;
@@ -77,7 +77,7 @@ public class ItemEssentiaCell extends Item implements IBasicCellItem {
@Override @Override
public boolean isBlackListed(ItemStack cellItem, appeng.api.stacks.AEKey requestedAddition) { public boolean isBlackListed(ItemStack cellItem, appeng.api.stacks.AEKey requestedAddition) {
if (requestedAddition instanceof AEssentiaKey) { if (requestedAddition instanceof thaumicenergistics.common.integration.appeng.AEssentiaKey) {
return false; return false;
} }
return true; return true;
@@ -208,19 +208,19 @@ public class ItemEssentiaCell extends Item implements IBasicCellItem {
} }
// ===== 工厂方法 ===== // ===== 工厂方法 =====
public static ItemEssentiaCell create1k(Properties props) { public static ItemEssentiaCell create1k(Item.Properties props) {
return new ItemEssentiaCell(props, "1k", 1, 8, ThEConfig.CELL_MAX_TYPES, 0.5); return new ItemEssentiaCell(props, "1k", 1, 8, ThEConfig.CELL_MAX_TYPES, 0.5);
} }
public static ItemEssentiaCell create4k(Properties props) { public static ItemEssentiaCell create4k(Item.Properties props) {
return new ItemEssentiaCell(props, "4k", 4, 8, ThEConfig.CELL_MAX_TYPES, 1.0); return new ItemEssentiaCell(props, "4k", 4, 8, ThEConfig.CELL_MAX_TYPES, 1.0);
} }
public static ItemEssentiaCell create16k(Properties props) { public static ItemEssentiaCell create16k(Item.Properties props) {
return new ItemEssentiaCell(props, "16k", 16, 8, ThEConfig.CELL_MAX_TYPES, 1.5); return new ItemEssentiaCell(props, "16k", 16, 8, ThEConfig.CELL_MAX_TYPES, 1.5);
} }
public static ItemEssentiaCell create64k(Properties props) { public static ItemEssentiaCell create64k(Item.Properties props) {
return new ItemEssentiaCell(props, "64k", 64, 8, ThEConfig.CELL_MAX_TYPES, 2.0); return new ItemEssentiaCell(props, "64k", 64, 8, ThEConfig.CELL_MAX_TYPES, 2.0);
} }
public static ItemEssentiaCell createCreative(Properties props) { public static ItemEssentiaCell createCreative(Item.Properties props) {
return new ItemEssentiaCell(props, "creative", Integer.MAX_VALUE / 1024, 8, 63, 0.0); return new ItemEssentiaCell(props, "creative", Integer.MAX_VALUE / 1024, 8, 63, 0.0);
} }
} }
@@ -17,7 +17,7 @@ public class ItemGolemWirelessBackpack extends Item {
public static final IGridLinkableHandler LINKABLE_HANDLER = new LinkableHandler(); public static final IGridLinkableHandler LINKABLE_HANDLER = new LinkableHandler();
public ItemGolemWirelessBackpack() { public ItemGolemWirelessBackpack() {
super(new Properties().stacksTo(1).durability(0)); super(new Item.Properties().stacksTo(1).durability(0));
} }
@Override @Override
@@ -16,7 +16,7 @@ import java.util.List;
public class PartItemEssentiaExportBus extends Item implements IPartItem<EssentiaExportBusPart> { public class PartItemEssentiaExportBus extends Item implements IPartItem<EssentiaExportBusPart> {
public static PartItemEssentiaExportBus create() { public static PartItemEssentiaExportBus create() {
return new PartItemEssentiaExportBus(new Properties().stacksTo(64)); return new PartItemEssentiaExportBus(new Item.Properties().stacksTo(64));
} }
public PartItemEssentiaExportBus(Properties properties) { public PartItemEssentiaExportBus(Properties properties) {
@@ -16,7 +16,7 @@ import java.util.List;
public class PartItemEssentiaImportBus extends Item implements IPartItem<EssentiaImportBusPart> { public class PartItemEssentiaImportBus extends Item implements IPartItem<EssentiaImportBusPart> {
public static PartItemEssentiaImportBus create() { public static PartItemEssentiaImportBus create() {
return new PartItemEssentiaImportBus(new Properties().stacksTo(64)); return new PartItemEssentiaImportBus(new Item.Properties().stacksTo(64));
} }
public PartItemEssentiaImportBus(Properties properties) { public PartItemEssentiaImportBus(Properties properties) {
@@ -16,7 +16,7 @@ import java.util.List;
public class PartItemEssentiaStorageBus extends Item implements IPartItem<EssentiaStorageBusPart> { public class PartItemEssentiaStorageBus extends Item implements IPartItem<EssentiaStorageBusPart> {
public static PartItemEssentiaStorageBus create() { public static PartItemEssentiaStorageBus create() {
return new PartItemEssentiaStorageBus(new Properties().stacksTo(64)); return new PartItemEssentiaStorageBus(new Item.Properties().stacksTo(64));
} }
public PartItemEssentiaStorageBus(Properties properties) { public PartItemEssentiaStorageBus(Properties properties) {
@@ -19,8 +19,8 @@ public class TransportPermissions implements IThETransportPermissions {
@Override @Override
public <T extends BlockEntity> boolean addTileToInject(Class<T> c, int cap) { return tileInject.putIfAbsent(c, cap) == null; } public <T extends BlockEntity> boolean addTileToInject(Class<T> c, int cap) { return tileInject.putIfAbsent(c, cap) == null; }
@Override @Override
public OptionalLong getCapacityForTile(Class<? extends BlockEntity> c) { public java.util.OptionalLong getCapacityForTile(Class<? extends BlockEntity> c) {
Integer v = tileExtract.get(c); return v != null ? OptionalLong.of(v) : OptionalLong.empty(); Integer v = tileExtract.get(c); return v != null ? java.util.OptionalLong.of(v) : java.util.OptionalLong.empty();
} }
@Override @Override
public boolean canExtract(BlockEntity tile) { return tile != null && tileExtract.containsKey(tile.getClass()); } public boolean canExtract(BlockEntity tile) { return tile != null && tileExtract.containsKey(tile.getClass()); }
@@ -141,7 +141,7 @@ public class TileArcaneAssembler extends ThETileBase
super(ModBlockEntities.ARCANE_ASSEMBLER.get(), pos, state); super(ModBlockEntities.ARCANE_ASSEMBLER.get(), pos, state);
mainNode = GridHelper.createManagedNode(this, nodeListener) mainNode = GridHelper.createManagedNode(this, nodeListener)
.setVisualRepresentation(ModItems.ARCANE_ASSEMBLER_ITEM.get()) .setVisualRepresentation(thaumicenergistics.init.ModItems.ARCANE_ASSEMBLER_ITEM.get())
.setInWorldNode(true) .setInWorldNode(true)
.setTagName("proxy") .setTagName("proxy")
.setFlags(GridFlags.REQUIRE_CHANNEL) .setFlags(GridFlags.REQUIRE_CHANNEL)
@@ -514,7 +514,7 @@ public class TileArcaneAssembler extends ThETileBase
@Override @Override
public PatternContainerGroup getCraftingMachineInfo() { public PatternContainerGroup getCraftingMachineInfo() {
ItemStack icon = new ItemStack(ModItems.ARCANE_ASSEMBLER_ITEM.get()); ItemStack icon = new ItemStack(thaumicenergistics.init.ModItems.ARCANE_ASSEMBLER_ITEM.get());
return new PatternContainerGroup( return new PatternContainerGroup(
AEItemKey.of(icon), AEItemKey.of(icon),
net.minecraft.network.chat.Component.translatable("block.thaumicenergistics.arcane_assembler"), net.minecraft.network.chat.Component.translatable("block.thaumicenergistics.arcane_assembler"),
@@ -577,7 +577,7 @@ public class TileArcaneAssembler extends ThETileBase
*/ */
public void onMemoryCardActivate(net.minecraft.world.entity.player.Player player, public void onMemoryCardActivate(net.minecraft.world.entity.player.Player player,
appeng.api.implementations.items.IMemoryCard memoryCard, appeng.api.implementations.items.IMemoryCard memoryCard,
ItemStack heldItem) { net.minecraft.world.item.ItemStack heldItem) {
Short freq = heldItem.get(appeng.api.ids.AEComponents.EXPORTED_P2P_FREQUENCY); Short freq = heldItem.get(appeng.api.ids.AEComponents.EXPORTED_P2P_FREQUENCY);
if (freq != null) { if (freq != null) {
// 卡上带 P2P 频率(从 vis_interface shift+右键复制来的)→ 设为 vis 源 // 卡上带 P2P 频率(从 vis_interface shift+右键复制来的)→ 设为 vis 源
@@ -37,14 +37,14 @@ public class TileEssentiaProvider extends TileProviderBase implements IEssentiaT
} }
/** getEssentiaList 短时缓存:TC 管道 suction 每 tick 调 getEssentiaType,避免每 tick 全量遍历。 */ /** getEssentiaList 短时缓存:TC 管道 suction 每 tick 调 getEssentiaType,避免每 tick 全量遍历。 */
private List<IAspectStack> cachedEssentiaList = List.of(); private List<IAspectStack> cachedEssentiaList = java.util.List.of();
private int essentiaListCacheTimer = 0; private int essentiaListCacheTimer = 0;
private static final int ESSENTIA_LIST_CACHE_TICKS = 20; private static final int ESSENTIA_LIST_CACHE_TICKS = 20;
private List<IAspectStack> getCachedEssentiaList() { private List<thaumicenergistics.api.storage.IAspectStack> getCachedEssentiaList() {
if (essentiaListCacheTimer <= 0) { if (essentiaListCacheTimer <= 0) {
essentiaListCacheTimer = ESSENTIA_LIST_CACHE_TICKS; essentiaListCacheTimer = ESSENTIA_LIST_CACHE_TICKS;
cachedEssentiaList = essentiaGrid != null ? essentiaGrid.getEssentiaList() : List.of(); cachedEssentiaList = essentiaGrid != null ? essentiaGrid.getEssentiaList() : java.util.List.of();
} }
return cachedEssentiaList; return cachedEssentiaList;
} }
@@ -45,7 +45,7 @@ public final class ModBlocks {
return net.minecraft.world.ItemInteractionResult.SUCCESS; return net.minecraft.world.ItemInteractionResult.SUCCESS;
} }
@Override @Override
protected MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) { protected net.minecraft.world.MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) {
TileArcaneAssembler tile = (TileArcaneAssembler) level.getBlockEntity(pos); TileArcaneAssembler tile = (TileArcaneAssembler) level.getBlockEntity(pos);
return new SimpleMenuProvider( return new SimpleMenuProvider(
(id, inv, p) -> new thaumicenergistics.common.container.ContainerArcaneAssembler(id, inv, tile), (id, inv, p) -> new thaumicenergistics.common.container.ContainerArcaneAssembler(id, inv, tile),
@@ -69,7 +69,7 @@ public final class ModBlocks {
return net.minecraft.world.ItemInteractionResult.SUCCESS; return net.minecraft.world.ItemInteractionResult.SUCCESS;
} }
@Override @Override
protected MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) { protected net.minecraft.world.MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) {
TileKnowledgeInscriber tile = (TileKnowledgeInscriber) level.getBlockEntity(pos); TileKnowledgeInscriber tile = (TileKnowledgeInscriber) level.getBlockEntity(pos);
return new SimpleMenuProvider( return new SimpleMenuProvider(
(id, inv, p) -> new thaumicenergistics.common.container.ContainerKnowledgeInscriber(id, inv, tile), (id, inv, p) -> new thaumicenergistics.common.container.ContainerKnowledgeInscriber(id, inv, tile),
@@ -92,7 +92,7 @@ public final class ModBlocks {
return net.minecraft.world.ItemInteractionResult.SUCCESS; return net.minecraft.world.ItemInteractionResult.SUCCESS;
} }
@Override @Override
protected MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) { protected net.minecraft.world.MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) {
TileDistillationPatternEncoder tile = (TileDistillationPatternEncoder) level.getBlockEntity(pos); TileDistillationPatternEncoder tile = (TileDistillationPatternEncoder) level.getBlockEntity(pos);
return new SimpleMenuProvider( return new SimpleMenuProvider(
(id, inv, p) -> new thaumicenergistics.common.container.ContainerDistillationPatternEncoder(id, inv, tile), (id, inv, p) -> new thaumicenergistics.common.container.ContainerDistillationPatternEncoder(id, inv, tile),
@@ -110,7 +110,7 @@ public final class ModBlocks {
return net.minecraft.world.ItemInteractionResult.SUCCESS; return net.minecraft.world.ItemInteractionResult.SUCCESS;
} }
@Override @Override
protected MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) { protected net.minecraft.world.MenuProvider getMenuProvider(BlockState state, net.minecraft.world.level.Level level, BlockPos pos) {
net.minecraft.world.level.block.entity.BlockEntity be = level.getBlockEntity(pos); net.minecraft.world.level.block.entity.BlockEntity be = level.getBlockEntity(pos);
if (be instanceof TileEssentiaCellWorkbench workbench) { if (be instanceof TileEssentiaCellWorkbench workbench) {
return new SimpleMenuProvider((id, inv, p) -> new thaumicenergistics.common.container.ContainerEssentiaCellWorkbench(id, inv, workbench), return new SimpleMenuProvider((id, inv, p) -> new thaumicenergistics.common.container.ContainerEssentiaCellWorkbench(id, inv, workbench),
@@ -45,11 +45,11 @@ public class ArcaneCraftingTransferInfo
@Override @Override
public List<Slot> getRecipeSlots(ContainerArcaneCraftingTerminal menu, RecipeHolder<CraftingRecipe> recipe) { public List<Slot> getRecipeSlots(ContainerArcaneCraftingTerminal menu, RecipeHolder<CraftingRecipe> recipe) {
return menu.getSlots(SlotSemantics.CRAFTING_GRID); return menu.getSlots(appeng.menu.SlotSemantics.CRAFTING_GRID);
} }
@Override @Override
public List<Slot> getInventorySlots(ContainerArcaneCraftingTerminal menu, RecipeHolder<CraftingRecipe> recipe) { public List<Slot> getInventorySlots(ContainerArcaneCraftingTerminal menu, RecipeHolder<CraftingRecipe> recipe) {
return menu.getSlots(SlotSemantics.PLAYER_INVENTORY); return menu.getSlots(appeng.menu.SlotSemantics.PLAYER_INVENTORY);
} }
} }