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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@

### 🏗 导入神奇代码岛建筑

- **地形文件导入**:支持从 `config/box3mod/` 目录中的压缩地形文件(`.gz`)导入方块地图。
- **地形文件导入**:支持从 `config/box3/` 目录中的压缩地形文件(`.gz`)导入方块地图。
- **建筑迁移**:可将神奇代码岛中的建筑结构迁移到 Minecraft 世界中,保持方块外观一致。
- **获取建筑文件**:访问 https://box3lab.com/build2mc 获取神奇代码岛建筑的地形文件(`.gz`)。
- **导入指令**:
- `/box3import`
列出 `config/box3mod/` 目录下所有可导入的地形文件(`.gz`)。
列出 `config/box3/` 目录下所有可导入的地形文件(`.gz`)。
- `/box3import <fileName>`
从 `config/box3mod/<fileName>.gz` 导入建筑(命令中不需要带后缀,会自动补 `.gz`)。
从 `config/box3/<fileName>.gz` 导入建筑(命令中不需要带后缀,会自动补 `.gz`)。
- `/box3import <fileName> <ignoreBarrier>`
当 `ignoreBarrier = true` 时,跳过屏障方块(不会在世界中放置这些方块)。
- `/box3import <fileName> <ignoreBarrier> <ignoreWater>`
Expand Down
6 changes: 3 additions & 3 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ You can also migrate structures from Box3 directly into your Minecraft world, pr

### 🏗 Importing Box3 Structures

- **Terrain file import**: supports importing compressed terrain files (`.gz`) from the `config/box3mod/` directory into your world.
- **Terrain file import**: supports importing compressed terrain files (`.gz`) from the `config/box3/` directory into your world.
- **Structure migration**: migrate structures from Box3 into Minecraft while keeping the same block appearance.
- **Get terrain files**: visit https://box3lab.com/build2mc to download Box3 building terrain files (`.gz`).
- **Import commands**:
- `/box3import`
List all available terrain files (`.gz`) under `config/box3mod/`.
List all available terrain files (`.gz`) under `config/box3/`.
- `/box3import <fileName>`
Import a structure from `config/box3mod/<fileName>.gz`.
Import a structure from `config/box3/<fileName>.gz`.
(You don’t need to type the `.gz` extension in the command.)
- `/box3import <fileName> <ignoreBarrier>`
When `ignoreBarrier = true`, barrier blocks will be skipped (they will not be placed in the world).
Expand Down
2 changes: 1 addition & 1 deletion block_id.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Box3Mod 提供方块参考手册
# Box3 提供方块参考手册

| ID | 注册表键 | 中文名称 | 英文名称 | 类型 | 分类 |
| :-- | :------------------------ | :------------ | :---------------------- | :--- | :-------- |
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ loom {
splitEnvironmentSourceSets()

mods {
"box3mod" {
"box3" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ loom_version=1.15-SNAPSHOT
# Mod Properties
mod_version=1.4.0
maven_group=com.box3lab
archives_base_name=box3mod
archives_base_name=box3

# Dependencies
fabric_api_version=0.141.3+1.21.11
26 changes: 26 additions & 0 deletions src/client/java/com/box3lab/Box3Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.box3lab;

import com.box3lab.register.ModBlocks;
import com.box3lab.util.BlockIndexUtil;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.BlockRenderLayerMap;
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
import net.minecraft.world.level.block.Block;

public class Box3Client implements ClientModInitializer {
@Override
public void onInitializeClient() {

for (var entry : ModBlocks.BLOCKS.entrySet()) {
String registryName = entry.getKey();
Block block = entry.getValue();

Integer id = BlockIndexUtil.getIdByName(registryName);
if (id != null && !BlockIndexUtil.isSolid(id)) {
BlockRenderLayerMap.putBlock(block, ChunkSectionLayer.TRANSLUCENT);
}
}

}
}
26 changes: 0 additions & 26 deletions src/client/java/com/box3lab/Box3ModClient.java

This file was deleted.

31 changes: 31 additions & 0 deletions src/main/java/com/box3lab/Box3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.box3lab;

import com.box3lab.command.ModCommands;
import com.box3lab.register.ModBlocks;
import com.box3lab.register.ModItems;

import net.fabricmc.api.ModInitializer;

// import org.slf4j.Logger;
// import org.slf4j.LoggerFactory;

public class Box3 implements ModInitializer {
public static final String MOD_ID = "box3";

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
// public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
ModBlocks.initialize();
ModItems.initialize();
ModCommands.register();

// LOGGER.info("Hello Fabric world!");
}
}
31 changes: 0 additions & 31 deletions src/main/java/com/box3lab/Box3Mod.java

This file was deleted.

18 changes: 9 additions & 9 deletions src/main/java/com/box3lab/command/ModCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@ private static int listBox3ImportFiles(CommandSourceStack source) {
if (files.isEmpty()) {
source.sendSuccess(
() -> Component.translatable(
"command.box3mod.box3import.list.empty",
"command.box3.box3import.list.empty",
dir.toString()),
false);
} else {
String joined = String.join(", ", files);
source.sendSuccess(
() -> Component.translatable(
"command.box3mod.box3import.list.success",
"command.box3.box3import.list.success",
dir.toString(), joined),
false);
}
} catch (IOException e) {
source.sendFailure(
Component.translatable(
"command.box3mod.box3import.list.error",
"command.box3.box3import.list.error",
dir.toString(), e.getMessage()));
}

Expand All @@ -127,7 +127,7 @@ private static String resolveMapName(String fileName) {
if (fileName != null && fileName.startsWith("Box3-")) {
String suffix = fileName.substring("Box3-".length());
if (!suffix.isEmpty()) {
return "https://static.pgaot.com/mc/build/" + suffix + ".gz";
return "https://box3lab.com/mc/build/" + suffix + ".gz";
}
}
return fileName;
Expand All @@ -146,20 +146,20 @@ private static int executeBox3Import(CommandSourceStack source, String fileName,
useVanillaWater);

source.sendSuccess(
() -> Component.translatable("command.box3mod.box3import.success",
() -> Component.translatable("command.box3.box3import.success",
mapName),
false);
} catch (Exception e) {
source.sendFailure(
Component.translatable("command.box3mod.box3import.failure", e.getMessage()));
Component.translatable("command.box3.box3import.failure", e.getMessage()));
}
return 1;
}

private static int showBarrierStatus(CommandSourceStack source) {
boolean visible = BarrierVoxelBlock.isVisible();
source.sendSuccess(
() -> Component.translatable("command.box3mod.box3barrier.status",
() -> Component.translatable("command.box3.box3barrier.status",
String.valueOf(visible)),
false);
return 1;
Expand All @@ -168,7 +168,7 @@ private static int showBarrierStatus(CommandSourceStack source) {
private static int setBarrierVisible(CommandSourceStack source, boolean value) {
BarrierVoxelBlock.setVisible(value);
source.sendSuccess(
() -> Component.translatable("command.box3mod.box3barrier.set", String.valueOf(value)),
() -> Component.translatable("command.box3.box3barrier.set", String.valueOf(value)),
false);
return 1;
}
Expand All @@ -178,7 +178,7 @@ private static int toggleBarrierVisible(CommandSourceStack source) {
boolean next = !current;
BarrierVoxelBlock.setVisible(next);
source.sendSuccess(
() -> Component.translatable("command.box3mod.box3barrier.toggled",
() -> Component.translatable("command.box3.box3barrier.toggled",
String.valueOf(next)),
false);
return 1;
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/com/box3lab/register/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.HashMap;
import java.util.Map;

import com.box3lab.Box3Mod;
import com.box3lab.Box3;
import com.box3lab.register.core.BlockRegistrar;
import com.box3lab.register.creative.CreativeTabRegistrar;
import com.box3lab.register.sound.CategorySoundTypes;
Expand Down Expand Up @@ -43,18 +43,25 @@ public static void initialize() {

boolean solid = BlockIndexUtil.isSolid(id);
boolean transparent = !solid;
var props = VoxelBlockPropertiesFactory.create(solid, soundType, lightLevel);

int index = data.indexById.get(id);
float hardness = data.blockHardness[index];
float resistance = data.blockResistance[index];
float friction = data.blockFriction[index];

var props = VoxelBlockPropertiesFactory.create(solid, soundType, lightLevel, hardness, resistance,
friction);

Block block = BlockRegistrar.register(
Box3Mod.MOD_ID,
Box3.MOD_ID,
texturePart,
VoxelBlockFactories.factoryFor(texturePart, transparent),
props,
true);
BLOCKS.put(texturePart, block);
}

CreativeTabRegistrar.registerCreativeTabs(Box3Mod.MOD_ID, BLOCKS, data);
CreativeTabRegistrar.registerCreativeTabs(Box3.MOD_ID, BLOCKS, data);
}

}
10 changes: 5 additions & 5 deletions src/main/java/com/box3lab/register/ModelItemRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import com.box3lab.Box3Mod;
import com.box3lab.Box3;
import com.box3lab.item.ModelDisplayItem;
import com.box3lab.register.creative.CreativeTabExtras;
import com.box3lab.register.creative.CreativeTabRegistrar;
Expand All @@ -26,7 +26,7 @@
import net.minecraft.world.item.Item;

public final class ModelItemRegistrar {
private static final String ITEMS_DIR_PREFIX = "assets/" + Box3Mod.MOD_ID + "/items/";
private static final String ITEMS_DIR_PREFIX = "assets/" + Box3.MOD_ID + "/items/";
public static final String DEFAULT_TAB = "models";

private ModelItemRegistrar() {
Expand All @@ -39,7 +39,7 @@ public static void registerAll() {
}

for (String path : itemPaths) {
Identifier id = Identifier.tryBuild(Box3Mod.MOD_ID, path);
Identifier id = Identifier.tryBuild(Box3.MOD_ID, path);
if (id == null) {
continue;
}
Expand All @@ -54,7 +54,7 @@ public static void registerAll() {
CreativeTabExtras.add(DEFAULT_TAB, item);
}

CreativeTabRegistrar.registerModelTab(Box3Mod.MOD_ID);
CreativeTabRegistrar.registerModelTab(Box3.MOD_ID);
}

private static Set<String> discoverModelItemPaths() {
Expand Down Expand Up @@ -84,7 +84,7 @@ private static boolean isArchive(Path path) {
}

private static void scanDirectoryPack(Path packDir, Set<String> out) {
Path itemsDir = packDir.resolve("assets").resolve(Box3Mod.MOD_ID).resolve("items");
Path itemsDir = packDir.resolve("assets").resolve(Box3.MOD_ID).resolve("items");
if (!Files.isDirectory(itemsDir)) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/box3lab/register/ModelToolRegistrar.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.box3lab.register;

import com.box3lab.Box3Mod;
import com.box3lab.Box3;
import com.box3lab.item.ModelDestroyerItem;
import com.box3lab.register.creative.CreativeTabExtras;

Expand All @@ -26,7 +26,7 @@ public static void registerAll() {
}

private static void registerDestroyer() {
Identifier id = Identifier.fromNamespaceAndPath(Box3Mod.MOD_ID, "model_destroyer");
Identifier id = Identifier.fromNamespaceAndPath(Box3.MOD_ID, "model_destroyer");
ResourceKey<Item> key = ResourceKey.create(Registries.ITEM, id);
if (BuiltInRegistries.ITEM.containsKey(key)) {
return;
Expand Down
Loading
Loading