// Copyright 2023 drey7925
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package cuberef.protocol.blocks;
import "render.proto";
// Definition of a block type.
// In the future, server-side code may be able to define custom properties for individual
// instances of a block; the mechanism and structure for this is not defined yet.
message BlockTypeDef {
// Identifier for the block. Lowest 12 bits are 0 here, since those bits are used
// for block variants.
// The values of this field are assigned by the cuberef server.
uint32 id = 1;
// Unique name used to refer to the block in scripts and commands, e.g. base:dirt
string short_name = 2;
// How long the block should take to dig with a tool that uses scaled_time = 1.0
double base_dig_time = 3;
// Groups that this item pertains to
repeated string groups = 4;
// How the client should render the block
oneof render_info {
Empty empty = 10;
CubeRenderInfo cube = 11;
CubeExRendererInfo cube_ex = 12;
};
// How the client should handle physics when interacting with the block
oneof physics_info {
Empty air = 20;
Empty solid = 21;
FluidPhysicsInfo fluid = 22;
}
}
message Empty {}
message CubeRenderInfo {
cuberef.protocol.render.TextureReference tex_left = 1;
cuberef.protocol.render.TextureReference tex_right = 2;
cuberef.protocol.render.TextureReference tex_top = 3;
cuberef.protocol.render.TextureReference tex_bottom = 4;
cuberef.protocol.render.TextureReference tex_front = 5;
cuberef.protocol.render.TextureReference tex_back = 6;
}
message CubeExRendererInfo {
// todo define what CubeEx will include, probably translucency, block merging, etc
// with expanding definitions as time goes on
}
message FluidPhysicsInfo {
}
// Options available for the interact key when facing a block
message InteractKeyOption {
// internal ID, assigned and managed by cuberef core
uint32 id = 1;
// human readable label in-game
string label = 2;
}
message BlockTypeAssignment {
string short_name = 1;
uint32 id = 2;
}
message ServerBlockTypeAssignments {
repeated BlockTypeAssignment block_type = 1;
}