mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 11:44:21 -04:00
A small change regarding the rotation mode ids.
These cannot be modded, so it doesn't make sense to add "cubyz:" in front of the id.
This commit is contained in:
parent
3f73c81de3
commit
3fb17e24b9
@ -9,7 +9,7 @@
|
|||||||
"lightingTransparent" : true,
|
"lightingTransparent" : true,
|
||||||
"viewThrough" : true,
|
"viewThrough" : true,
|
||||||
"solid" : false,
|
"solid" : false,
|
||||||
"rotation" : "cubyz:no_rotation",
|
"rotation" : "no_rotation",
|
||||||
"degradable" : true,
|
"degradable" : true,
|
||||||
"hasItem" : false,
|
"hasItem" : false,
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"model" : "cube",
|
"model" : "cube",
|
||||||
"texture" : "cubyz:cobblestone",
|
"texture" : "cubyz:cobblestone",
|
||||||
|
|
||||||
"rotation" : "cubyz:multi_texture",
|
"rotation" : "multi_texture",
|
||||||
"multi_texture_variants" : [
|
"multi_texture_variants" : [
|
||||||
{
|
{
|
||||||
"texture" : "cubyz:cobblestone"
|
"texture" : "cubyz:cobblestone"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"model" : "cube",
|
"model" : "cube",
|
||||||
"texture" : "cubyz:mossy_cobblestone",
|
"texture" : "cubyz:mossy_cobblestone",
|
||||||
|
|
||||||
"rotation" : "cubyz:multi_texture",
|
"rotation" : "multi_texture",
|
||||||
"multi_texture_variants" : [
|
"multi_texture_variants" : [
|
||||||
{
|
{
|
||||||
"texture" : "cubyz:mossy_cobblestone"
|
"texture" : "cubyz:mossy_cobblestone"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"drops" : [
|
"drops" : [
|
||||||
"auto"
|
"auto"
|
||||||
],
|
],
|
||||||
"rotation" : "cubyz:fence",
|
"rotation" : "fence",
|
||||||
"model" : "fence",
|
"model" : "fence",
|
||||||
"texture" : "cubyz:oak_planks"
|
"texture" : "cubyz:oak_planks"
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"drops" : [
|
"drops" : [
|
||||||
"auto"
|
"auto"
|
||||||
],
|
],
|
||||||
"rotation" : "cubyz:log",
|
"rotation" : "log",
|
||||||
"model" : "log",
|
"model" : "log",
|
||||||
"texture" : "cubyz:oak_log_side",
|
"texture" : "cubyz:oak_log_side",
|
||||||
"texture_top" : "cubyz:oak_log_rings_top",
|
"texture_top" : "cubyz:oak_log_rings_top",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"drops" : [
|
"drops" : [
|
||||||
"auto"
|
"auto"
|
||||||
],
|
],
|
||||||
"rotation" : "cubyz:log",
|
"rotation" : "log",
|
||||||
"model" : "cube",
|
"model" : "cube",
|
||||||
"texture" : "cubyz:oak_log_side",
|
"texture" : "cubyz:oak_log_side",
|
||||||
"texture_top" : "cubyz:oak_log_top",
|
"texture_top" : "cubyz:oak_log_top",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"drops" : [
|
"drops" : [
|
||||||
"auto"
|
"auto"
|
||||||
],
|
],
|
||||||
"rotation" : "cubyz:stackable",
|
"rotation" : "stackable",
|
||||||
"model" : "cube",
|
"model" : "cube",
|
||||||
"texture" : "cubyz:snow",
|
"texture" : "cubyz:snow",
|
||||||
"blockEntity" : "cubyz.modding.base.MeltableBlockEntity"
|
"blockEntity" : "cubyz.modding.base.MeltableBlockEntity"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"solid" : false,
|
"solid" : false,
|
||||||
"emittedLight" : 0x00a09080,
|
"emittedLight" : 0x00a09080,
|
||||||
"viewThrough" : true,
|
"viewThrough" : true,
|
||||||
"rotation" : "cubyz:torch",
|
"rotation" : "torch",
|
||||||
"model" : "cubyz:torch.obj",
|
"model" : "cubyz:torch.obj",
|
||||||
"texture" : "cubyz:torch"
|
"texture" : "cubyz:torch"
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ pub fn register(_: []const u8, id: []const u8, json: JsonElement) !u16 {
|
|||||||
_id[size] = try allocator.dupe(u8, id);
|
_id[size] = try allocator.dupe(u8, id);
|
||||||
try reverseIndices.put(_id[size], @intCast(size));
|
try reverseIndices.put(_id[size], @intCast(size));
|
||||||
|
|
||||||
_mode[size] = rotation.getByID(json.get([]const u8, "rotation", "cubyz:no_rotation"));
|
_mode[size] = rotation.getByID(json.get([]const u8, "rotation", "no_rotation"));
|
||||||
_breakingPower[size] = json.get(f32, "breakingPower", 0);
|
_breakingPower[size] = json.get(f32, "breakingPower", 0);
|
||||||
_hardness[size] = json.get(f32, "hardness", 1);
|
_hardness[size] = json.get(f32, "hardness", 1);
|
||||||
|
|
||||||
|
@ -135,7 +135,6 @@ pub const RotationMode = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
id: []const u8,
|
|
||||||
/// if the block should be destroyed or changed when a certain neighbor is removed.
|
/// if the block should be destroyed or changed when a certain neighbor is removed.
|
||||||
dependsOnNeighbors: bool = false,
|
dependsOnNeighbors: bool = false,
|
||||||
|
|
||||||
@ -208,10 +207,10 @@ var rotationModes: std.StringHashMap(RotationMode) = undefined;
|
|||||||
|
|
||||||
const RotationModes = struct {
|
const RotationModes = struct {
|
||||||
pub const NoRotation = struct {
|
pub const NoRotation = struct {
|
||||||
pub const id: []const u8 = "cubyz:no_rotation";
|
pub const id: []const u8 = "no_rotation";
|
||||||
};
|
};
|
||||||
pub const Log = struct {
|
pub const Log = struct {
|
||||||
pub const id: []const u8 = "cubyz:log";
|
pub const id: []const u8 = "log";
|
||||||
|
|
||||||
pub fn model(block: Block) RotatedModel {
|
pub fn model(block: Block) RotatedModel {
|
||||||
const permutation: Permutation = switch(block.data) {
|
const permutation: Permutation = switch(block.data) {
|
||||||
@ -229,7 +228,7 @@ const RotationModes = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
pub const Fence = struct {
|
pub const Fence = struct {
|
||||||
pub const id: []const u8 = "cubyz:fence";
|
pub const id: []const u8 = "fence";
|
||||||
|
|
||||||
pub fn model(block: Block) RotatedModel {
|
pub fn model(block: Block) RotatedModel {
|
||||||
const data = block.data>>2 & 15; // TODO: This is just for compatibility with the java version. Remove it.
|
const data = block.data>>2 & 15; // TODO: This is just for compatibility with the java version. Remove it.
|
||||||
@ -290,12 +289,12 @@ pub fn deinit() void {
|
|||||||
|
|
||||||
pub fn getByID(id: []const u8) *RotationMode {
|
pub fn getByID(id: []const u8) *RotationMode {
|
||||||
if(rotationModes.getPtr(id)) |mode| return mode;
|
if(rotationModes.getPtr(id)) |mode| return mode;
|
||||||
std.log.warn("Could not find rotation mode {s}. Using cubyz:no_rotation instead.", .{id});
|
std.log.warn("Could not find rotation mode {s}. Using no_rotation instead.", .{id});
|
||||||
return rotationModes.getPtr("cubyz:no_rotation").?;
|
return rotationModes.getPtr("no_rotation").?;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register(comptime Mode: type) !void {
|
pub fn register(comptime Mode: type) !void {
|
||||||
var result: RotationMode = RotationMode{.id = Mode.id};
|
var result: RotationMode = RotationMode{};
|
||||||
inline for(@typeInfo(RotationMode).Struct.fields) |field| {
|
inline for(@typeInfo(RotationMode).Struct.fields) |field| {
|
||||||
if(@hasDecl(Mode, field.name)) {
|
if(@hasDecl(Mode, field.name)) {
|
||||||
if(field.type == @TypeOf(@field(Mode, field.name))) {
|
if(field.type == @TypeOf(@field(Mode, field.name))) {
|
||||||
@ -305,5 +304,5 @@ pub fn register(comptime Mode: type) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try rotationModes.putNoClobber(result.id, result);
|
try rotationModes.putNoClobber(Mode.id, result);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user