Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/generated/resources/assets/anvilcraft/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,10 @@
"command.anvilcraft.multiphase.info.phase": "%4$s :sʇuǝɯʇuɐɥɔuǝ '%3$s :ʇsoɔ ɹᴉɐdǝɹ '%2$s [%1$s]",
"command.anvilcraft.multiphase.info.summary": "%2$s :ǝʌᴉʇɔɐ '%1$s :sǝɔɐds ǝsɐɥdᴉʇꞁnW",
"command.anvilcraft.multiphase.no_item": "ǝsɐɥdᴉʇꞁnW ǝʌɐɥ ʇou sǝop ɯǝʇᴉ puɐɥ-uᴉɐɯ ǝɥ⟘",
"command.anvilcraft.overseer.entry": "%3$s :ʞɔᴉʇ ɯopuɐɹ '%2$s˙ʌꞀ@[%1$s]",
"command.anvilcraft.overseer.entry": "(s)ʞunɥɔ %3$s :spɐoꞁ '%2$s˙ʌꞀ@[%1$s]",
"command.anvilcraft.overseer.head": "%s uᴉ sɹǝǝsɹǝʌo ꞁꞁⱯ",
"command.anvilcraft.overseer.invalid_dimension": "pᴉꞁɐʌuᴉ sᴉ uoᴉsuǝɯᴉᗡ",
"command.anvilcraft.overseer.summary": "ꞁɐʇoʇ uᴉ (s)ʞunɥɔ %s spɐoꞀ",
"command.anvilcraft.powergrid.info.components": ":pᴉɹᵷ ɹǝʍod ɟo sʇuǝuodɯoƆ",
"command.anvilcraft.powergrid.info.consumer": "(%6$s :ǝᵷuɐᴚ '%5$s :ǝɯnsuoɔ ɹǝʍoԀ) %4$s '%3$s '%2$s ʇɐ %1$s",
"command.anvilcraft.powergrid.info.dynamic_consumer": "(%5$s :ǝɯnsuoɔ ɹǝʍoԀ) %4$s '%3$s '%2$s ʇɐ %1$s",
Expand Down Expand Up @@ -2117,8 +2118,8 @@
"tooltip.anvilcraft.item.neutron_irradiator": "ssǝɔoɹd ꞁɐɹnpǝɔoɹd ʞɔoꞁq ɹoɟ suoꞁᴉʌuɐ pǝuᴉɟuoɔ sqɹosqɐ 'sǝdᴉɔǝɹ uoᴉʇɐᴉpɐɹɹᴉ uoɹʇnǝu sɯɹoɟɹǝԀ",
"tooltip.anvilcraft.item.neutronium_ingot": "ʞɔoɹpǝq puɐ 'ʞɔoꞁq ɹǝʇʇɐɯ ǝʌᴉʇɐᵷǝu 'ʇsnp puǝ ʇdǝɔxǝ sʞɔoꞁq ʇsoɯ ɥᵷnoɹɥʇ ssɐԀ",
"tooltip.anvilcraft.item.overheated_ember_metal_block": "ᵷuᴉꞁooɔ uodn ǝʇᴉɹǝɥʇǝN oʇuᴉ ǝpɐɹᵷǝp ʎɐW\nɯnᴉpuǝɔsuɐɹ⟘ oʇuᴉ ʇᴉ ɯɹoɟsuɐɹʇ ꞁꞁᴉʍ ssɐɯ ᵷuᴉʇɔǝɾuᴉ ⸵ǝɔuɐꞁɐq ʎᵷɹǝuǝ-ssɐɯ sʇᴉ uǝʞoɹq sɐɥ ʇɐǝɥ ǝɯǝɹʇxƎ",
"tooltip.anvilcraft.item.overseer": "ǝsɐq ꞁǝǝʇS ꞁɐʎoᴚ uo sʞɹoʍ ʇɐɥʇ ɹǝpɐoꞁ ʞunɥƆ",
"tooltip.anvilcraft.item.overseer.shift": "(ǝᵷuɐɹ ϛxϛ 'sɹǝʎɐꞁ Ɛ xɐɯ) ǝᵷuɐɹ pɐoꞁ ʞunɥɔ ǝsɐǝɹɔuᴉ sɹǝʎɐꞁ ǝsɐq ɹǝɥᵷᴉɥ 'ǝsɐq ꞁǝǝʇS ꞁɐʎoᴚ ƐxƐ uo ɹǝpɐoꞁ ʞunɥƆ",
"tooltip.anvilcraft.item.overseer": "ǝsɐq ǝꞁqɐʇᴉns uo sʞɹoʍ ʇɐɥʇ ɹǝpɐoꞁ ʞunɥƆ",
"tooltip.anvilcraft.item.overseer.shift": "sʇɔǝɟɟǝ ʇuǝɹǝɟɟᴉp ǝpᴉʌoɹd sʞɔoꞁq ǝsɐq ʇuǝɹǝɟɟᴉp '(ǝᵷuɐɹ 6x6 'sɹǝʎɐꞁ ߈ xɐɯ) ǝᵷuɐɹ pɐoꞁ ɯnɯᴉxɐɯ ɹǝᵷɹɐꞁ ɐ ǝpᴉʌoɹd sɹǝʎɐꞁ ǝsɐq ɹǝɥᵷᴉɥ 'ǝsɐq pǝdɐɥs-pᴉɯɐɹʎd ǝꞁqɐʇᴉns uo sʞɹoʍ ʇɐɥʇ ɹǝpɐoꞁ ʞunɥƆ",
"tooltip.anvilcraft.item.oxidized_copper_pressure_plate": "ǝʇɐꞁd ɹǝddoɔ ɐ osꞁɐ 'ǝɯᴉʇ ᵷuᴉssǝɹd ɥʇᴉʍ sǝsɐǝɹɔuᴉ ꞁɐuᵷᴉs ǝuoʇspǝᴚ",
"tooltip.anvilcraft.item.penrose_sphere_component": "ꞁᴉʌuⱯ ᵷuᴉᵷɹoℲ ꞁɐᴉʇsǝꞁǝƆ ǝɥʇ uᴉ pǝsn 'ǝɹǝɥdS ǝsoɹuǝԀ ɐ ᵷuᴉpꞁᴉnq ɹoɟ ꞁɐᴉɹǝʇɐW",
"tooltip.anvilcraft.item.piezoelectric_crystal": "ʇᴉ uo ꞁꞁɐɟ ꞁᴉʌuɐ uɐ ʎq pǝʇɐɹǝuǝᵷ ǝᵷɹɐɥƆ",
Expand Down
7 changes: 4 additions & 3 deletions src/generated/resources/assets/anvilcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,10 @@
"command.anvilcraft.multiphase.info.phase": "[%1$s] %2$s, repair cost: %3$s, enchantments: %4$s",
"command.anvilcraft.multiphase.info.summary": "Multiphase spaces: %1$s, active: %2$s",
"command.anvilcraft.multiphase.no_item": "The main-hand item does not have Multiphase",
"command.anvilcraft.overseer.entry": "[%1$s]@Lv.%2$s, random tick: %3$s",
"command.anvilcraft.overseer.entry": "[%1$s]@Lv.%2$s, loads: %3$s chunk(s)",
"command.anvilcraft.overseer.head": "All overseers in %s",
"command.anvilcraft.overseer.invalid_dimension": "Dimension is invalid",
"command.anvilcraft.overseer.summary": "Loads %s chunk(s) in total",
"command.anvilcraft.powergrid.info.components": "Components of power grid:",
"command.anvilcraft.powergrid.info.consumer": "%1$s at %2$s, %3$s, %4$s (Power consume: %5$s, Range: %6$s)",
"command.anvilcraft.powergrid.info.dynamic_consumer": "%1$s at %2$s, %3$s, %4$s (Power consume: %5$s)",
Expand Down Expand Up @@ -2117,8 +2118,8 @@
"tooltip.anvilcraft.item.neutron_irradiator": "Performs neutron irradiation recipes, absorbs confined anvilons for block procedural process",
"tooltip.anvilcraft.item.neutronium_ingot": "Pass through most blocks except end dust, negative matter block, and bedrock",
"tooltip.anvilcraft.item.overheated_ember_metal_block": "Extreme heat has broken its mass-energy balance; injecting mass will transform it into Transcendium\nMay degrade into Netherite upon cooling",
"tooltip.anvilcraft.item.overseer": "Chunk loader that works on Royal Steel base",
"tooltip.anvilcraft.item.overseer.shift": "Chunk loader on 3x3 Royal Steel base, higher base layers increase chunk load range (max 3 layers, 5x5 range)",
"tooltip.anvilcraft.item.overseer": "Chunk loader that works on suitable base",
"tooltip.anvilcraft.item.overseer.shift": "Chunk loader that works on suitable pyramid-shaped base, higher base layers provide a larger maximum load range (max 4 layers, 9x9 range), different base blocks provide different effects",
"tooltip.anvilcraft.item.oxidized_copper_pressure_plate": "Redstone signal increases with pressing time, also a copper plate",
"tooltip.anvilcraft.item.penrose_sphere_component": "Material for building a Penrose Sphere, used in the Celestial Forging Anvil",
"tooltip.anvilcraft.item.piezoelectric_crystal": "Charge generated by an anvil fall on it",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values": [
"anvilcraft:ember_metal_block",
"anvilcraft:cut_ember_metal_block",
"anvilcraft:cut_ember_metal_pillar",
"anvilcraft:cut_ember_metal_slab",
"anvilcraft:cut_ember_metal_stairs"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values": [
"anvilcraft:frost_metal_block",
"anvilcraft:cut_frost_metal_block",
"anvilcraft:cut_frost_metal_pillar",
"anvilcraft:cut_frost_metal_slab",
"anvilcraft:cut_frost_metal_stairs"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"minecraft:iron_block",
"minecraft:gold_block",
"minecraft:diamond_block",
"minecraft:emerald_block"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"#anvilcraft:royal_series",
"#anvilcraft:frost_series"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"values": [
"minecraft:netherite_block",
"#anvilcraft:ember_series",
"anvilcraft:multiphase_matter_block"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"anvilcraft:transcendium_block"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"values": [
"anvilcraft:royal_steel_block",
"anvilcraft:smooth_royal_steel_block",
"anvilcraft:cut_royal_steel_block",
"anvilcraft:cut_royal_steel_pillar",
"anvilcraft:cut_royal_steel_slab",
"anvilcraft:cut_royal_steel_stairs"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public class ItemTooltipManager {
ModItems.MULTIPHASE_MATTER.get(),
"Matter that exists in multiple stable phases simultaneously, switchable under special conditions"
);
NORMAL.put(ModBlocks.OVERSEER.asItem(), "Chunk loader that works on Royal Steel base");
NORMAL.put(ModBlocks.OVERSEER.asItem(), "Chunk loader that works on suitable base");
NORMAL.put(ModBlocks.PUMP.asItem(), "Pumps fluids, consumes 32 kW");
NORMAL.put(ModBlocks.CREATIVE_CRATE.asItem(), "Infinite item storage and supply");
NORMAL.put(ModBlocks.CREATIVE_FLUID_TANK.asItem(), "Infinite fluid storage and supply");
Expand Down Expand Up @@ -594,7 +594,7 @@ Supports pickup mode (from containers or drops) and move mode (direct block move
);
SHIFT.put(
ModBlocks.OVERSEER.asItem(),
"Chunk loader on 3x3 Royal Steel base, higher base layers increase chunk load range (max 3 layers, 5x5 range)"
"Chunk loader that works on suitable pyramid-shaped base, higher base layers provide a larger maximum load range (max 4 layers, 9x9 range), different base blocks provide different effects"
);
SHIFT.put(ModBlocks.PUMP.asItem(), """
Provides 10 blocks of headlift on both input and output sides (including the pump itself)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package dev.dubhe.anvilcraft.api.world.load;

import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class ChunkFeatureManager {
private static final Map<ResourceKey<Level>, Map<ChunkPos, Map<BlockPos, LoadChunkData>>> CHUNK_SOURCES = new HashMap<>();
public static final ThreadLocal<ChunkPos> CURRENT_SPAWNING_CHUNK = new ThreadLocal<>();
public static final ThreadLocal<ResourceKey<Level>> CURRENT_SPAWNING_DIMENSION = new ThreadLocal<>();
public static final int TRANSCENDIUM_DESPAWN_DISTANCE = 32768; // 2048 chunks

public static void registerChunkFeatures(ResourceKey<Level> dimension, ChunkPos pos, BlockPos sourcePos, LoadChunkData data) {
CHUNK_SOURCES
.computeIfAbsent(dimension, k -> new HashMap<>())
.computeIfAbsent(pos, k -> new HashMap<>())
.put(sourcePos, data);
}

public static void unregisterChunkFeatures(ResourceKey<Level> dimension, ChunkPos pos, BlockPos sourcePos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
if (dimSources == null) return;

Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources != null) {
sources.remove(sourcePos);
if (sources.isEmpty()) {
dimSources.remove(pos);
if (dimSources.isEmpty()) {
CHUNK_SOURCES.remove(dimension);
}
}
}
}

public static boolean isChunkManaged(ResourceKey<Level> dimension, ChunkPos pos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
return dimSources != null && dimSources.containsKey(pos);
}

public static boolean shouldSkipRandomTick(ResourceKey<Level> dimension, ChunkPos pos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
if (dimSources == null) return false;

Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources == null || sources.isEmpty()) return false; // 默认运算

for (LoadChunkData data : sources.values()) {
if (data.shouldSkipRandomTick(pos)) return true;
}
return false;
}

public static boolean shouldAllowFireSpread(ResourceKey<Level> dimension, ChunkPos pos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
if (dimSources == null) return false;

Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources == null || sources.isEmpty()) return false;

for (LoadChunkData data : sources.values()) {
if (data.shouldAllowFireSpread(pos)) return true;
}
return false;
}

public static boolean shouldAllowNaturalSpawn(ResourceKey<Level> dimension, ChunkPos pos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
if (dimSources == null) return false;

Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources == null || sources.isEmpty()) return false;

for (LoadChunkData data : sources.values()) {
if (data.shouldAllowNaturalSpawn(pos)) return true;
}
return false;
}

public static boolean shouldAllowNaturalSpawnAnyDimension(ChunkPos pos) {
for (Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources : CHUNK_SOURCES.values()) {
Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources == null) continue;
for (LoadChunkData data : sources.values()) {
if (data.shouldAllowNaturalSpawn(pos)) return true;
}
}
return false;
}

public static boolean shouldAllowSpawnerSpawn(ResourceKey<Level> dimension, ChunkPos pos) {
Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources = CHUNK_SOURCES.get(dimension);
if (dimSources == null) return false;

Map<BlockPos, LoadChunkData> sources = dimSources.get(pos);
if (sources == null || sources.isEmpty()) return false;

for (LoadChunkData data : sources.values()) {
if (data.shouldAllowSpawnerSpawn(pos)) return true;
}
return false;
}

public static Set<ChunkPos> getAllNaturalSpawnChunks() {
Set<ChunkPos> result = new HashSet<>();
for (Map<ChunkPos, Map<BlockPos, LoadChunkData>> dimSources : CHUNK_SOURCES.values()) {
for (Map.Entry<ChunkPos, Map<BlockPos, LoadChunkData>> entry : dimSources.entrySet()) {
ChunkPos chunkPos = entry.getKey();
for (LoadChunkData data : entry.getValue().values()) {
if (data.shouldAllowNaturalSpawn(chunkPos)) {
result.add(chunkPos);
break;
}
}
}
}
return result;
}

public static void clear() {
CHUNK_SOURCES.clear();
}
}
Loading
Loading