mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -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,
|
||||
"viewThrough" : true,
|
||||
"solid" : false,
|
||||
"rotation" : "cubyz:no_rotation",
|
||||
"rotation" : "no_rotation",
|
||||
"degradable" : true,
|
||||
"hasItem" : false,
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:cobblestone",
|
||||
|
||||
"rotation" : "cubyz:multi_texture",
|
||||
"rotation" : "multi_texture",
|
||||
"multi_texture_variants" : [
|
||||
{
|
||||
"texture" : "cubyz:cobblestone"
|
||||
|
@ -7,7 +7,7 @@
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:mossy_cobblestone",
|
||||
|
||||
"rotation" : "cubyz:multi_texture",
|
||||
"rotation" : "multi_texture",
|
||||
"multi_texture_variants" : [
|
||||
{
|
||||
"texture" : "cubyz:mossy_cobblestone"
|
||||
|
@ -4,7 +4,7 @@
|
||||
"drops" : [
|
||||
"auto"
|
||||
],
|
||||
"rotation" : "cubyz:fence",
|
||||
"rotation" : "fence",
|
||||
"model" : "fence",
|
||||
"texture" : "cubyz:oak_planks"
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
"drops" : [
|
||||
"auto"
|
||||
],
|
||||
"rotation" : "cubyz:log",
|
||||
"rotation" : "log",
|
||||
"model" : "log",
|
||||
"texture" : "cubyz:oak_log_side",
|
||||
"texture_top" : "cubyz:oak_log_rings_top",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"drops" : [
|
||||
"auto"
|
||||
],
|
||||
"rotation" : "cubyz:log",
|
||||
"rotation" : "log",
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:oak_log_side",
|
||||
"texture_top" : "cubyz:oak_log_top",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"drops" : [
|
||||
"auto"
|
||||
],
|
||||
"rotation" : "cubyz:stackable",
|
||||
"rotation" : "stackable",
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:snow",
|
||||
"blockEntity" : "cubyz.modding.base.MeltableBlockEntity"
|
||||
|
@ -7,7 +7,7 @@
|
||||
"solid" : false,
|
||||
"emittedLight" : 0x00a09080,
|
||||
"viewThrough" : true,
|
||||
"rotation" : "cubyz:torch",
|
||||
"rotation" : "torch",
|
||||
"model" : "cubyz:torch.obj",
|
||||
"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);
|
||||
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);
|
||||
_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.
|
||||
dependsOnNeighbors: bool = false,
|
||||
|
||||
@ -208,10 +207,10 @@ var rotationModes: std.StringHashMap(RotationMode) = undefined;
|
||||
|
||||
const RotationModes = 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 id: []const u8 = "cubyz:log";
|
||||
pub const id: []const u8 = "log";
|
||||
|
||||
pub fn model(block: Block) RotatedModel {
|
||||
const permutation: Permutation = switch(block.data) {
|
||||
@ -229,7 +228,7 @@ const RotationModes = struct {
|
||||
}
|
||||
};
|
||||
pub const Fence = struct {
|
||||
pub const id: []const u8 = "cubyz:fence";
|
||||
pub const id: []const u8 = "fence";
|
||||
|
||||
pub fn model(block: Block) RotatedModel {
|
||||
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 {
|
||||
if(rotationModes.getPtr(id)) |mode| return mode;
|
||||
std.log.warn("Could not find rotation mode {s}. Using cubyz:no_rotation instead.", .{id});
|
||||
return rotationModes.getPtr("cubyz:no_rotation").?;
|
||||
std.log.warn("Could not find rotation mode {s}. Using no_rotation instead.", .{id});
|
||||
return rotationModes.getPtr("no_rotation").?;
|
||||
}
|
||||
|
||||
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| {
|
||||
if(@hasDecl(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