Change the asset keys

This commit is contained in:
2026-11-04 21:54:01 -03:00
parent ba4b2a8798
commit 4683b09e10
20 changed files with 39 additions and 39 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ const PIXEL = 1 / 16;
export function render_mod_entity(entity: RemoteEntity, camera: Camera, partial_tick: number) {
const json = EverythingRegistry.get<EntityJson>("entities", entity.type);
if (!json) return;
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
const region = get_sprite_region(json.texture);
const hurt = entity.hurt_time > 0 || entity.dead ? HURT_TINT : undefined;
const tint = entity_tint(entity, partial_tick, hurt, entity.data.on_fire === true);
+1 -1
View File
@@ -70,7 +70,7 @@ export function gui_player_faces(skin: Texture, slim: boolean, dx: number, dy: n
push_cube(skin, part, part.overlay, part.inflate, transform, undefined, emit_skin);
}
if (worn.length > 0) {
push_worn(worn, pose, undefined, collect(AssetManager.instance.get<Texture>("bworld:textures")));
push_worn(worn, pose, undefined, collect(AssetManager.instance.get<Texture>("cubi:textures")));
}
return faces
+3 -3
View File
@@ -64,7 +64,7 @@ export class HandRenderer {
const tint = entity_tint(player, partial_tick);
begin_view_model(FOV);
if (item) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
set_current_texture(atlas.tex);
const display = item_model_of(item)?.display.firstperson_righthand;
const transform = display
@@ -72,7 +72,7 @@ export class HandRenderer {
: pose(item, (1 - equip) * 0.6, Math.sin(swing_progress * Math.PI));
push_item(atlas, item, transform, tint);
} else {
const skin = player.skin ?? AssetManager.instance.get<Texture>("bworld:skin");
const skin = player.skin ?? AssetManager.instance.get<Texture>("cubi:skin");
const arm = right_arm(player.slim);
const transform = arm_pose(arm.pivot, 1 - equip, swing_progress);
set_current_texture(skin.tex);
@@ -80,7 +80,7 @@ export class HandRenderer {
push_cube(skin, arm, arm.overlay, arm.inflate, transform, tint);
// what's worn on it goes over it, from the atlas
if (player.worn.length > 0) {
use_texture(AssetManager.instance.get<Texture>("bworld:textures").tex);
use_texture(AssetManager.instance.get<Texture>("cubi:textures").tex);
render_worn_arm(player, transform, tint);
}
}
+2 -2
View File
@@ -92,7 +92,7 @@ export function ground_transform(item: ItemStack): ItemTransform {
// the atlas has to be the current texture
export function render_item_entity(entity: ItemEntity, partial_tick: number) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
// spinning and bobbing, like minecraft's ItemEntityRenderer
const time = entity.age + partial_tick;
@@ -130,7 +130,7 @@ const shown_stacks = new WeakMap<ItemData, ItemStack>();
// every item blocks with item_display show on top of them, their "item" client data, see BlockRegistry.item_display.
// the atlas has to be the current texture
export function render_block_items(level: ClientLevel) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
const blocks = EverythingRegistry.get_registry<BlockRegistry>("blocks");
for (const in_chunk of level.block_data.values()) {
for (const { x, y, z, data } of in_chunk.values()) {
+2 -2
View File
@@ -128,7 +128,7 @@ export class LevelRenderer {
this.#drawn_entities = 0;
if (!this.draw.entities) return;
flush_batch();
const default_skin = AssetManager.instance.get<Texture>("bworld:skin");
const default_skin = AssetManager.instance.get<Texture>("cubi:skin");
// what they wear is drawn with the atlas, after every skin
const posed: { player: RemotePlayer; pose: PlayerPose; tint: Vec3 }[] = [];
for (const entity of level.entities.values()) {
@@ -203,7 +203,7 @@ export class LevelRenderer {
if (!info) {
return;
}
const tex = AssetManager.instance.get<Texture>("bworld:textures");
const tex = AssetManager.instance.get<Texture>("cubi:textures");
const region = get_sprite_region(`cubi:break_${stage}`);
for (const quad of this.#destroy_quads(info, value)) {
push_decal_quad(tex, quad, x, y, z, region);
+4 -4
View File
@@ -142,7 +142,7 @@ function draw_item_item(item: ItemStack, item_info: ItemRegistry, x: number, y:
const draw = (texture_id: string, [r, g, b] = [1, 1, 1]) => {
const sprite_region = get_sprite_region(texture_id);
draw_texture_region(
AssetManager.instance.get("bworld:textures"),
AssetManager.instance.get("cubi:textures"),
sprite_region.x,
sprite_region.y,
sprite_region.width,
@@ -172,7 +172,7 @@ export function draw_fluid(fluid: FluidVariant, x: number, y: number, filled = 1
const region = get_sprite_region(texture);
const size = SLOT_SIZE - 6;
draw_texture_region(
AssetManager.instance.get("bworld:textures"),
AssetManager.instance.get("cubi:textures"),
region.x,
region.y + region.height * (1 - done),
region.width,
@@ -212,7 +212,7 @@ const model_icons = new WeakMap<ItemModel, Float32Array>();
// an item's model in a slot: its faces that face the viewer, back to front
function draw_item_model(model: ItemModel, x: number, y: number) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
use_texture(atlas.tex);
let icon = model_icons.get(model);
if (!icon) {
@@ -277,7 +277,7 @@ function draw_item_block(block_info: BlockRegistry, x: number, y: number) {
const front_texture = cube_face_texture(block_info, "front");
const left_texture = cube_face_texture(block_info, "side");
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
const top = get_sprite_region(top_texture);
const front = get_sprite_region(front_texture);
+2 -2
View File
@@ -24,7 +24,7 @@ export function render_worn(player: Player, pose: PlayerPose, tint?: Vec3) {
// what's worn on a player in that pose, its vertices to emit, the batch by default, like the player in the inventory
export function push_worn(worn_items: ItemStack[], pose: PlayerPose, tint?: Vec3, emit?: VertexSink) {
if (worn_items.length === 0) return;
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
const to_world = pose_to_world(pose);
for (const stack of worn_items) {
const worn = EverythingRegistry.get<ItemRegistry>("items", stack.type_id)?.worn;
@@ -48,7 +48,7 @@ export function push_worn(worn_items: ItemStack[], pose: PlayerPose, tint?: Vec3
// what's worn on a player's right arm, in first person, like artifacts' renderFirstPersonArm. transform is the arm's,
// from points around its pivot (see hand_renderer's arm_pose). the atlas has to be the current texture
export function render_worn_arm(player: Player, transform: (x: number, y: number, z: number) => Vec3, tint?: Vec3) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
const atlas = AssetManager.instance.get<Texture>("cubi:textures");
const [px, py, pz] = right_arm(player.slim).pivot;
// the model's pixels, standing still, to around the arm's pivot
const to_arm = (x: number, y: number, z: number) => transform(x - px, y - py, z - pz);